利用Oracle的STANDBY技術,可以將單一實例資料庫升級到RAC資料庫。這種方式可以有效降低單一實例遷移到RAC環境的停機時間。
這篇文章描述整個操作過程中碰到的錯誤。
最開始碰了幾個初始化參數設定的小錯誤,主要問題是FLASH_RECOVERY_AREA設定到ASM執行個體上導致了問題:
SQL> startup nomount pfile=/export/home/oracle/inittest11gr1.ora
ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
將DB_RECOVERY_FILE_DEST設定到本地磁碟後,問題解決。
由於SWITCHOVER過程中,設定DB_RECOVERY_FILE_DEST可能會引發bug,因此在主庫和STANDBY資料庫,都先將DB_RECOVERY_FILE_DEST關閉。
隨後檢查主庫到STANDBY資料庫的遠端歸檔時發現,查詢V$ARCHIVE_DEST視圖,對應遠端歸檔的目的地出現ORA-1031錯誤。
SQL> select dest_name, status, target, destination, error
2 from v$archive_dest
3 where dest_id in (1, 2);
DEST_NAME STATUS TARGET DESTINATION ERROR
-------------------- ------ ------- -------------------------------- -------------------
LOG_ARCHIVE_DEST_1 VALID PRIMARY /data/oradata/test11g/archivelog
LOG_ARCHIVE_DEST_2 ERROR STANDBY TEST11GR ORA-01031:許可權不足
這個沒有許可權的錯誤是由於沒有拷貝密碼檔案造成的。將遠端的密碼檔案拷貝到本地的$ORACLE_HOME/dbs目錄下,並進行重新命名,修改為orapwtest11gr1。這時必須重啟本地的執行個體,才能載入密碼檔案。成功載入密碼檔案後,查詢V$ARCHIVE_DEST視圖,結果恢複正常:
SQL> select dest_name, status, target, destination, error
2 from v$archive_dest
3 where dest_id in (1, 2);
DEST_NAME STATUS TARGET DESTINATION ERROR
-------------------- ------ ------- -------------------------------- -----------------------
LOG_ARCHIVE_DEST_1 VALID PRIMARY /data/oradata/test11g/archivelog
LOG_ARCHIVE_DEST_2 VALID STANDBY TEST11GR
隨後在啟動standby資料庫的恢複過程後,檢查不到對應的進程在工作,檢查後台alert檔案,發現出現了很多錯誤:
Mon Jul 13 16:55:17 2009
alter database recover managed standby database disconnect from session
Attempt to start background Managed Standby Recovery process (test11gr1)
Mon Jul 13 16:55:17 2009
MRP0 started with pid=15, OS id=8356
MRP0: Background Managed Standby Recovery process started (test11gr1)
Fast Parallel Media Recovery enabled
Mon Jul 13 16:55:22 2009
Managed Standby Recovery not using Real Time Apply
MRP0: Background Media Recovery terminated with error 1110
Errors in file /data/oracle/diag/rdbms/test11gr/test11gr1/trace/test11gr1_mrp0_8356.trc:
ORA-01110: data file 1: '+DATA/test11g/system01.dbf'
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '+DATA/test11g/system01.dbf'
ORA-01251: Unknown File Header Version read for file number 1
Errors in file /data/oracle/diag/rdbms/test11gr/test11gr1/trace/test11gr1_mrp0_8356.trc:
ORA-01110: data file 1: '+DATA/test11g/system01.dbf'
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '+DATA/test11g/system01.dbf'
ORA-01251: Unknown File Header Version read for file number 1
MRP0: Background Media Recovery process shutdown (test11gr1)
Completed: alter database recover managed standby database disconnect from session
Mon Jul 13 17:07:05 2009
db_recovery_file_dest_size of 4096 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this