设为首页 收藏本站
查看: 555|回复: 0

[经验分享] Install Oracle(Four)

[复制链接]

尚未签到

发表于 2018-5-15 13:36:46 | 显示全部楼层 |阅读模式
Steps


  • Change the file /etc/apt/sources.list and add the following line to it. The line describes the repository position for debian from oracle.

deb http://oss.oracle.com/debian unstable main non-free


  • When I use the command mode to install the oracle-xe and oracle-xe-client, it says it will remove a lot of package. I don't know why.
aptitude install oracle-xe oracle-xe-client

Then I abort the procedures. And resort to the Synaptic  Package Manager . At last, in the GUI Package Manager I  installed the 2 packages successfully, oracle-xe and oracle- xe-client.


  • Then config the instance and database sys/system users.
/etc/init.d/oracle-xe configure
In this steps, you will need to specify the ports and pasword. The details for my installation are as follows,
Webconsole Http Port: 1158
Database Listener: 1521
Database Password: *******


  • At this point we must say, we have installed two programs. One is oracle server and another is oracle client. In the bin directory in their root path, they all have a sqlplus client to use. Actually, the one in server side connects the database with local protocol, it don't need the network(for OS user login, it login directly, for the other user, it login with /app/oracle/product/10.2.0/server/network/admin/tnsnames.ora ). So it has more rights. Then one in client need the file /etc/tnsnames.ora to connect to db. Oracle and Oracle client ships with a shell to set the environment. We can source them like this,
source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
source /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh


  • Firstly, we need setup some users. So I login with sqlplus in server site. Before doing this, make sure the oracle user(automatically added by installer) belongs to the dba group. Only the oracle can be used to login dba with OS user, root can't. (Because I login after I login with sys and password I specified during installation, I can't login, it says Invalide Username or password . So I need this step to specify password again)

su oracle
source /usr/lib/oracle/xe/app/oracle/product/10.2.0/ server /bin/oracle_env.sh
sqlplus / as sysdba
alter user sys identified by *******
alter user system identified by *******

create user robert identifed by **********
default tablespace users
temporary tablespace temp
quota unlimited on users

grant create session,create table, create view, create procedure, create synonym to robert


  • Now the user sys/system/robert can be used to login database. You can use the command to login,
sqlplus sys/*******@xe as sysdba
sqlplus system/*******@xe
sqlplus robert/**********@xe

Until now, you are using the sqlplus from server site, you can login with OS user - oracle, you also can login with the sys/system users and your own user - robert.


  • Now we start to investigate how to login oracle with remote sqlplus - the on in client site.


  • Login web manager console, because oracle install the oracle server based on the loopback network adaptor, that is to say, you only can access web console by the loopback adaptor currently.

See my /etc/host s file,
127.0.0.1       localhost
127.0.1.1       debianlaptop

See my ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:1e:37:8a:71:c3  
         inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
         inet6 addr: fe80::21e:37ff:fe8a:71c3/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:1348 errors:0 dropped:0 overruns:0 frame:0
         TX packets:1596 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:100
         RX bytes:1021169 (997.2 KiB)  TX bytes:371191 (362.4 KiB)
         Base address:0x1840 Memory:fe200000-fe220000

lo        Link encap:Local Loopback  
         inet addr:127.0.0.1  Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING  MTU:16436  Metric:1
         RX packets:4002 errors:0 dropped:0 overruns:0 frame:0
         TX packets:4002 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:0
         RX bytes:1433549 (1.3 MiB)  TX bytes:1433549 (1.3 MiB)

That is to say, the 127.0.0.1(localhost) is an alias of the loopback adaptor while the 127.0.0.1(debianlaptop, 192.168.0.100) is an alias of my real network adaptor.

For the first time, oracle only bind itself with the loopback one. So you only can access it by

http://127.0.0.1:1158/apex/
http://localhost:1158/apex/


  • Now you can login web console with sys/*******, go to Administratoin item. In the right sidebar Task , click the link. Then enable the item Available from local server and remote clients .

Then you can login with the following address to console. This is the ip address of my real network adaptor.

http://127.0.1.1:1158/apex/
http://debianlaptop:1158/apex/
http://192.168.0.100:1158/apex/


  • After enable the remote clients, you must make a TNS file in /et c . So you can login remotely with sqlplus.

cp /app/oracle/product/10.2.0/server/network/admin/tnsnames.ora /etc/


  • Now you can login with client sqlplus.
source /app/oracle/product/10.2.0/client/bin/oracle_env.sh

sqlplus sys/*******@xe as sysdba
sqlplus system/*******@xe
sqlplus robert/youarebest@xe

Please note, this time, the sqlplus is from client site, you can run which sqlplus to see,

/usr/lib/oracle/xe/app/oracle/product/10.2.0/ client /bin/sqlplus

That is to say, it use the tnsnames.ora from /etc diretory. Without last step and the right one before last step, you can't login in the client sqlplus.

Reference

http://www.davidpashley.com/articles/oracle-install.html

http://www.debianhelp.co.uk/oracle.htm

http://sysop.com.cn/system5504,1.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-460625-1-1.html 上篇帖子: 什么的东西叫做教程:在 Debian 下篇帖子: The process of installing debian in my T61
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表