升級可能導致資料庫不可用(一)

yangtingkun發表於2010-08-19

升級過程也是一個危險的過程,操作不當可能造成資料庫無法開啟,因此在升級之前應該做好備份。

描述問題產生的原因。

 

 

嘗試將一個9.2.0.4的資料庫手工升級為11.2.0.1。但是升級過程中犯了一個小錯誤,在升級之前沒有執行11.2ORACLE_HOME/rdbms/admin/utlu112i.sql

就是這個小錯誤,導致資料庫升級失敗。

在執行catupgrd.sql指令碼時,出現了ORA-00942: table or view does not exist錯誤:

SQL> spo upgrade.sql
SQL> @?/rdbms/admin/catupgrd
DOC>#######################################################################
DOC>#######################################################################
DOC>
DOC>   The first time this script. is run, there should be no error messages
DOC>   generated; all normal upgrade error messages are suppressed.
DOC>
DOC>   If this script. is being re-run after correcting some problem, then
DOC>   expect the following error which is not automatically suppressed:
DOC>
DOC>   ORA-00001: unique constraint () violated
DOC>              possibly in conjunction with
DOC>   ORA-06512: at "", line NN
DOC>
DOC>   These errors will automatically be suppressed by the Database Upgrade
DOC>   Assistant (DBUA) when it re-runs an upgrade.
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
.
.
.

DOC>#######################################################################
DOC>#######################################################################
DOC>   The following statement will cause:
DOC>   - "ORA-00942: table or view does not exist" ; or
DOC>   - "ORA-00904: "TZ_VERSION": invalid identifier"" ; or
DOC>   - "ORA-01722: invalid number"
DOC>     if the pre-upgrade utility (utlu112i.sql) has not been run to:
DOC>     a) create and update registry$database table to include the current
DOC>        database timezone file version used in the old release; or
DOC>     b) do inserts into sys.props$.
DOC>
DOC>     o Action:
DOC>       Shutdown ABORT and revert to the original ORACLE_HOME.  Then run
DOC>       utlu112i.sql to populate registry$database with the database timezone
DOC>       file version used by the lower version database and to populate
DOC>       sys.props$ with Day Light Saving Time (DST) properties information.
DOC>
DOC>   OR
DOC>   - An "ORA-01722: invalid number"
DOC>     if the old release uses a timezone file version newer than 8 (shipped with
DOC>     11.2) but the new release has not been patched yet.
DOC>
DOC>     o Action:
DOC>       Shutdown ABORT and patch new ORACLE_HOME to the same timezone file
DOC>       version as used in the old ORACLE_HOME.
DOC>
DOC>
DOC>#######################################################################
DOC>#######################################################################
DOC>#
       TO_NUMBER(value$) != (SELECT tz_version from registry$database))
                                                    *
6 行出現錯誤:
ORA-00942:
表或檢視不存在


Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
斷開

根據Oracle給出的解決方法,需要設定9.2ORACLE_HOME,啟動資料庫執行11.2ORACLE_HOME/rdbms/admin/utlu112i.sql。但是由於已經設定了COMPATIBLE11.2.0.1.0,並啟動過資料庫,導致9i環境已經無法開啟資料庫,啟動將報錯:

[oracle@bjtest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 4 30 22:05:47 2010

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


連線到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown abort
ORACLE
例程已經關閉。
SQL> exit
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
斷開

[oracle@bjtest ~]$ export ORACLE_HOME=/opt/oracle/product/9.2
[oracle@bjtest ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@bjtest ~]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on 星期五 4 30 22:06:42 2010

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

已連線到空閒例程。

SQL> startup pfile=inittest9.ora
ORA-00401: the value for parameter compatible is not supported by this release

初始化引數的值COMPATIBLE設定為11.2.0.1.0,在9i是無法啟動的,但是即使改成9.2.0.1.0,由於已經更改了CONTROL_FILE,因此也是無法啟動的。

修改初始化引數後,嘗試啟動:

SQL> startup pfile=inittest9.ora
ORACLE
例程已經啟動。

Total System Global Area  657246184 bytes
Fixed Size                   743400 bytes
Variable Size             385875968 bytes
Database Buffers          268435456 bytes
Redo Buffers                2191360 bytes
ORA-00201: ?????? 9.2.0.0.0 ? ORACLE ?? 9.2.0.0.0 ???
ORA-00202: ????: '/data/oradata/test9/control01.dbf'

而且這時在11g的環境下,利用UPGRADE方式啟動,也無法呼叫utlu112i.sql了,呼叫會報錯:

[oracle@bjtest ~]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on 星期五 4 30 22:11:26 2010

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


連線到:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> shutdown abort
ORACLE
例程已經關閉。
SQL> exit
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
中斷開

[oracle@bjtest ~]$ export ORACLE_HOME=/data/oracle/product/11.2
[oracle@bjtest ~]$ export PATH=$ORACLE_HOME/bin:$PATH
[oracle@bjtest ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期五 4 30 22:12:00 2010

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

已連線到空閒例程。

將初始化引數改回為11.2.0.1.0,利用UPGRADE啟動資料庫:

SQL> startup pfile=inittest9.ora upgrade
ORA-32006: BACKGROUND_DUMP_DEST initialization parameter has been deprecated
ORA-32006: USER_DUMP_DEST initialization parameter has been deprecated
ORACLE
例程已經啟動。

Total System Global Area  618012672 bytes
Fixed Size                  2215784 bytes
Variable Size             343933080 bytes
Database Buffers          268435456 bytes
Redo Buffers                3428352 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> @?/rdbms/admin/utlu112i.sql
ERROR:
ORA-04023:
無法驗證或授權物件 SYS.STANDARD


DECLARE
*
1 行出現錯誤:
ORA-04023:
無法驗證或授權物件 SYS.STANDARD


ERROR:
ORA-04023:
無法驗證或授權物件 SYS.STANDARD

現在已經陷入了兩難的境地,在9i11g都無法成功的開啟資料庫。如果在升級操作之前沒有備份,就很可能導致資料庫的徹底崩潰。

 

 

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

相關文章