ORACLE多版本数据库实例共存启动关闭时ORA-01804&SP2-0152

    今天,由于特殊原因,需要重启数据库,理论上应该是很简单的事;事实情况是,一台linux服务器上,有4个Oracle实例,3个实例是11.2.0.4的,1个实例是10.2.0.5的。
重启时,11g的三个实例很简单,但是10g的实例重启时,发现sys无法登陆,报错如下:
    设置10g的环境变量
[oracle@linux ~]$ ps -ef|grep _ora10|grep smon
1102      4306     1  0 08:39 ?        00:00:00 ora_smon_ora10g
[oracle@linux ~]$export ORACLE_SID=ora10g
[oracle@linux ~]$ echo $ORACLE_SID
ora10g
[oracle@linux ~]$ export ORACLE_HOME=/u02/app/oracle/10.2.0/db_1
[oracle@linux ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@linux ~]$ sqlplus sys/'eh8#5pK6' as sysdba
ERROR:
ORA-01804: failure to initialize timezone information
SP2-0152: ORACLE may not be functioning properly
[oracle@linux ~]$ 
    关于ORA-01804&SP2-0152报错,有资料说是环境变量问题,如果有数据库版本升级过,不排除环境变量设置不当引起ORA-01804,但是,我再三核实确保环境变量没问题;
真实原因是:11g的数据库操作系统管理用户是oracle,而10g的数据库操作系统管理用户是oracle10g。
    排查过程如下:
[root@linux ~]# cat /etc/passwd
oracle:x:1101:1000::/home/oracle:/bin/bash
oracle10g:x:1102:1000::/home/oracle10g:/bin/bash
[root@linux~]# ps -ef|grep smon
oracle    3856     1  0 08:35 ?        00:00:01 ora_smon_ora11a
oracle    3988     1  0 08:36 ?        00:00:00 ora_smon_ora11b
oracle    4119     1  0 08:37 ?        00:00:00 ora_smon_ora11c
1102      4306     1  0 08:39 ?        00:00:00 ora_smon_ora10g
root      5836  5758  0 09:50 pts/3    00:00:00 grep smon
[root@linux~]# 
    根据以上信息,可知3个11g的实例的管理用户是oracle,而10g的实例管理用户是oracle10g,但是很奇怪的是,查看进程启动的用户时,10g的却显示用户的主组、11g的显示用户名。
    找到原因,解决方法很简单,就是切换到oracle10g用户下,然后sys用户就可顺利登陆:
[root@linux ~]# su - oracle10g
[oracle10g@linux ~]$ sqlplus sys/eh8#5pK6 as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jul 21 09:56:10 2016
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> 
    附:通过如下命令,可以查看显示主组用户的用户名
[oracle10g@linux ~]$ cat /etc/passwd|grep 1102
oracle10g:x:1102:1000::/home/oracle10g:/bin/bash
[oracle10g@linux~]$
    问题解决!

请使用浏览器的分享功能分享到微信等