设置到相同SID仍无法连接实例

今天有同事问,为什么设置了正确的SID后仍然连接到空闲实例,且启动到MOUNT状态就报错。
根据他的描述,基本上可以判断是ORACLE_HOME的设置问题,于是做了一个简单的例子重新了这个问题:

[orat0@hpserver2 ~]$ env|grep ORACLE
ORACLE_SID=orcl10g
ORACLE_BASE=/t0/orat0/app/oracle
ORACLE_HOME=/t0/orat0/app/oracle/product/10.2.0/db_1
[orat0@hpserver2 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.5.0 - Production ON Thu Mar 22 16:06:48 2012
Copyright (c) 1982, 2010, Oracle. ALL Rights Reserved.
Connected TO an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed SIZE 2097560 bytes
Variable SIZE 146804328 bytes
DATABASE Buffers 373293056 bytes
Redo Buffers 2093056 bytes
DATABASE mounted.
DATABASE opened.
SQL> exit
Disconnected FROM Oracle DATABASE 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options
[orat0@hpserver2 ~]$ export ORACLE_HOME=/t0/orat0/app/oracle/product/10.2.0/db_1/
[orat0@hpserver2 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 10.2.0.5.0 - Production ON Thu Mar 22 16:07:21 2012
Copyright (c) 1982, 2010, Oracle. ALL Rights Reserved.
Connected TO an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 524288000 bytes
Fixed SIZE 2097560 bytes
Variable SIZE 146804328 bytes
DATABASE Buffers 373293056 bytes
Redo Buffers 2093056 bytes
ORA-01102: cannot mount DATABASE IN EXCLUSIVE mode

Oracle在启动实例时,根据ORACLE_HOME和ORACLE_SID的值来唯一确定实例的,虽然/t0/orat0/app/oracle/product/10.2.0/db_1和/t0/orat0/app/oracle/product/10.2.0/db_1/是同一个目录,但是对Oracle而言,二者是不同的,因此在启动实例的时候,会启动额外的实例。
而尝试MOUNT时,由于尝试加载相同的控制文件,导致了上面的报错。
此外,如果ORACLE_HOME的设置不同,还可能造成监听的异常。

This entry was posted in ORACLE and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *