ORACLE多版本資料庫例項共存啟動關閉時ORA-01804&SP2-0152

清風艾艾發表於2016-07-21
    今天,由於特殊原因,需要重啟資料庫,理論上應該是很簡單的事;事實情況是,一臺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~]$
    問題解決!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29357786/viewspace-2122318/,如需轉載,請註明出處,否則將追究法律責任。

相關文章