Oracle 11g的dataguard建立中ORA-01665解決過程,dataguardora-01665

來源:互聯網
上載者:User

Oracle 11g的dataguard建立中ORA-01665解決過程,dataguardora-01665
Oracle 11g在建立data guard時,恢複standby控制檔案不成功。在mount standby database時告訴我,控制檔案不是standby控制檔案,具體資訊為“ORA-01665: control file is not a standby control file”。 

控制檔案我在主庫中,使用rman產生的。 
backup current controlfile for standby format 'xxxxxx/ctl.stdy'; 

拷貝到備庫上恢複。按照10g的操作習慣,使用rman工具進行恢複操作。 


在11g的RMAN工具做了不少改動,如加了set功能直接修改產生適用於standby的spfile檔案,個人覺得是雞肋。我手工編輯修改比這裡敲命令操作爽多了。 

還有這裡恢複standby controlfile時,要手工指定,我恢複的控制檔案是用於standby,否則就不行了。 
restore controlfile from '/u01/backup/db7881/ctl.stdy'; 
恢複是恢複了,但在mount standby database時,出錯。 

SQL> alter database mount standby database; 
alter database mount standby database 

ERROR at line 1: 
ORA-01665: control file is not a standby control file 


如果不做standby database的mount,那麼則可以mount成功。 

SQL> alter database mount; 

Database altered. 

這點證明我的備份介質是沒有問題的。檢查一下控制檔案的類型,不是我需要的standby類型。 

SQL> select controlfile_type from v$database; 

CONTROL 
------- 
BACKUP 

好,再回到11g rman的恢複控制檔案的操作上來。 
RMAN 工具的restore 的restoreobject,有一項是standby controlfile. 

STANDBY CONTROLFILE Restores a control file for a standby database. RMAN can transparently restore a normal control file backup and make it usable for a standby database. 

RMAN restores either a normal or standby control file as appropriate, depending on the most recent database role known to the recovery catalog (RC_SITE.DATABASE_ROLE) for the target database. The purpose of this option to override the default setting in cases where the most recent database role is out-of-date. Assume that you perform a switchover from primary database dgny to standby database dgsf, so that dgsf is the new primary database. Later, you make dgny a standby database for dgsf. You want to restore a control file on dgny, but the recovery catalog was not resynchronized and still shows dgny as a primary database. In this case, you can specify STANDBY CONTROLFILE to override the default RMAN behavior and restore a standby control file. 

If you restore the control file of a database whose DB_UNIQUE_NAME is known to the recovery catalog, then RMAN updates all filenames in the control file to filenames known to the recovery catalog. Any filenames explicitly renamed with ALTER DATABASE RENAME FILE take precedence over the filenames in the recovery catalog. 

See Also: Table 2-36 for restrictions and usage notes 

Note: You must always run the RECOVER command after mounting a restored control file, and must also always open the database with the RESETLOGS option. 

使用”restore standby controlfile“ 進行恢複操作,成功。 

RMAN> restore standby controlfile from '/u01/backup/db7881/ctl.stdy'; 

Starting restore at 07-JAN-15 
using target database control file instead of recovery catalog 
allocated channel: ORA_DISK_1 
channel ORA_DISK_1: SID=62 device type=DISK 

channel ORA_DISK_1: restoring control file 
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02 
output file name=+VG1/db7881dg/controlfile/current.447.868357987 
output file name=+VG1/db7881dg/controlfile/current.507.868357987 
Finished restore at 07-JAN-15 

資料庫可以恢複控制檔案後,檢查v$database的controlfile_type,已經是我們需要的類型了。 

SQL> alter database mount standby database; 

Database altered. 

SQL> select controlfile_type from v$database; 

CONTROL 
------- 
STANDBY 


--end.

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.