Centos-6.7下 - Oracle 11gR2静默详细安装过程及排错

oracle 15950 1 0 15:50 ? 00:00:00 ora_reco_ora11g

oracle 15952 1 0 15:50 ? 00:00:00 ora_mmon_ora11g

oracle 15954 1 0 15:50 ? 00:00:00 ora_mmnl_ora11g

oracle 15956 1 0 15:50 ? 00:00:00 ora_d000_ora11g

oracle 15958 1 0 15:50 ? 00:00:00 ora_s000_ora11g

oracle 15966 1 0 15:50 ? 00:00:00 ora_qmnc_ora11g

oracle 15980 1 0 15:50 ? 00:00:00 ora_cjq0_ora11g

oracle 15982 1 0 15:50 ? 00:00:00 ora_q000_ora11g

oracle 15984 1 0 15:50 ? 00:00:00 ora_q001_ora11g

建库后监听检查:

lsnrctlstatus

[oracle@DB_m2 database]$ lsnrctl status

LSNRCTL for Linux: Version11.2.0.1.0 - Production on 06-MAR-2016 15:55:31

Copyright (c) 1991, 2009,Oracle. All rights reserved.

Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of the LISTENER ------------------------

Alias LISTENER Version TNSLSNR for Linux: Version11.2.0.1.0 - Production

Start Date 06-MAR-2016 15:36:22

Uptime 0 days 0 hr. 19 min. 8 sec Trace Level off

Security ON: Local OS Authentication SNMP OFF

Listener Parameter

File /opt/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log

File /opt/app/oracle/diag/tnslsnr/DB_2/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DB_m2)(PORT=1521))) Services Summary...

Service \

Instance \Service\

Instance \The command completedsuccessfully

如果出现以下错误:

lsnrctl: error while loading shared

libraries:/u01/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1: cannotrestoresegmentprot after reloc: Permission denied 或者

ORA-12547: TNS:lost contact

解决办法:在root用户下执行以下命令

su - root

setenforce 0 不需要重启

修改/etc/selinux/config文件中的SELINUX=\为 disabled ,需要重启

注意:如果在没有将依赖包全部安装完成后强行安装数据库,那么登录数据库时将会出现:ORA-12547: TNS:lost contact错误,出现这个错误,就重新安装吧

修改oracle启动配置文件:

su - oracle vi /etc/oratab

orcl:/soft/u01/app/oracle/product/11.2.0/db_1:Y //把“N”改成“Y” 这样就可以通过dbstart启动此实例,监听器。

dbstart $ORACLE_HOME

此时所有oracle的进程关闭,监听器也停止。

dbshut $ORACLE_HOME 再次查看监听器状态。 lsnrctlstatus

启动数据库:

$ sqlplus / as sysdba //as前有个空格

[oracle@DB_m2 database]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 616:22:55 2016 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR:

ORA-12162: TNS:netservice name is incorrectly specified Enter user-name:

登录出现以上错误,诡异的故障背后的原因竟然是那样的基础:ORACLE_SID没有指定!

确认系统当前的ORACLE_HOME和ORACLE_SID环境变量

[oracle@DB_m2 database]$ echo $ORACLE_HOME /opt/app/oracle/product/11.2.0/dbhome_1 [oracle@DB_m2 database]$ echo $ORACLE_SID

[oracle@DB_m2 database]$

可见,此时只设置了ORACLE_HOME环境变量,但ORACLE_SID此时为空,这就是该问题的真实原因。 解决方法如下:

[oracle@DB_m2 database]$ cd [oracle@DB_m2 ~]$ pwd /home/oracle

[oracle@DB_m2 ~]$ vi .bash .bash_history .bash_profile .bash_logout .bashrc [oracle@DB_m2 ~]$ vi .bash_

.bash_history .bash_logout .bash_profile

[oracle@DB_m2 ~]$ vi .bash_profile 在最后面加入如下内容:

export ORACLE_SID=ora11g 后保存退出! [oracle@DB_m2 ~]$ source .bash_profile [oracle@DB_m2 ~]$ echo $ORACLE_SID ora11g

[oracle@DB_m2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0Production on Sun Mar 6 16:31:46 2016 Copyright (c) 1982, 2009,Oracle. All rights reserved.

Connected to:

Oracle Database 11g EnterpriseEdition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, DataMining and Real Application Testing options SQL>start SQL>startup

ORACLE instance started.

Total System Global Area 304807936 bytes

Fixed Size 2212856 bytes Variable Size 113249288 bytes Database Buffers 184549376 bytes Redo Buffers 4796416 bytes Database mounted. Database opened.

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4