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.