六、恢复备库
6.2、在主库执行,利用auxiliary来恢复备库
[oracle@rac1 ~]$ $ORACLE_HOME/bin/rman target / auxiliary sys/6212327@standby
RMAN> run
{
allocate channel c1 device type disk format '/soft/backup/%U' connect sys/6212327@rac1;
allocate channel c2 device type disk format '/soft/backup/%U' connect sys/6212327@rac2;
allocate auxiliary channel ac1 device type disk format '/soft/backup/%U';
allocate auxiliary channel ac2 device type disk format '/soft/backup/%U';
duplicate target database for standby;
}
从日志可以看到,oracle先根据参数文件把控制文件恢复到合适位置,然后再根据db_file_name_cover把数据文件恢复到合适位置。
七、后续工作
7.1、把备库至于恢复状态:
[oracle@standby admin]$ sqlplus "/as sysdba"
SQL> alter database recover managed standby database disconnect from session;
Database altered
此时观察备库的alert文件,可以发现有很多类似的信息:
Errors in file /opt/oracle/admin/rac/bdump/rac1_mrp0_10825.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '/soft/oradata/rac/raw11'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 4 /soft/oradata/rac/raw11
Clearing online log 4 of thread 2 sequence number 50
这是正常的,在第一次置于recover状态的时候,备库会生成对应的online redo log。
7.2、在备库添加standby redo log
Standby redo log比archivelog方式有更大的优势,且在最大保护、最大可用、实时恢复的情况下必须有standby redo log。
Standby redo log的组数一般为(N +1)* thread# (N分别为每个thread#的联机日志组数)。在本例,每一个thread的联机日志都是2组,所以,需要添加6组standby redo log:
SQL> alter database recover managed standby database cancel;
来源:( http://blog.sina.com.cn/s/blog_5ded2e5b0100f44b.html) - Oracle10g RAC环境下DataGuard备库搭建实例-3-eygle_伊帆_新浪博客SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 ('/soft/oradata/rac/slog4.ora') SIZE 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 ('/soft/oradata/rac/slog5.ora') SIZE 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 ('/soft/oradata/rac/slog6.ora') SIZE 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 ('/soft/oradata/rac/slog7.ora') SIZE 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 ('/soft/oradata/rac/slog8.ora') SIZE 52428800;
SQL> ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 ('/soft/oradata/rac/slog9.ora') SIZE 52428800;
注意:standby redo log的大小必须和联机日志一样。
八、遇到的问题
8.1、FAL[client, MRP0]: Error 12545 connecting to PRIMARY for fetching gap sequence
Wed Apr 30 20:21:23 2008
Errors in file /opt/oracle/admin/rac/bdump/rac1_mrp0_10965.trc:
ORA-12545: Connect failed because target host or object does not exist
Wed Apr 30 20:22:23 2008
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 88-88
DBID 2232067446 branch 644085430
FAL[client]: All defined FAL servers have been attempted.
这个问题和gap有关,备库尝试拿gap的时候,发现不能连接主库。这个问题是RAC的监听造成的,参考yangtingkun的解决方法,修改两个参数 即可:
ALTER SYSTEM SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.200.11)(PORT = 1521))' SID = 'rac1';
ALTER SYSTEM SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.200.22)(PORT = 1521))' SID = 'rac2';
8.2
FAL[client]: Failed to request gap sequence
GAP - thread 1 sequence 88-88
DBID 2232067446 branch 644085430
FAL[client]: All defined FAL servers have been attempted.
-------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
这个问题还是和gap有关。备库现在需要从主库上拿sequence 88这个归档,但这个归档在前面做备份的时候删除了。解决方法是从备份还原这个归档:
RMAN> restore archivelog sequence 88;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/90618/viewspace-665295/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/90618/viewspace-665295/