使用异地恢复的方式配置adg

版权声明:欢迎指正,评论,共同学习 https://blog.csdn.net/m18994118189/article/details/82770281

APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.0.1.0 to 11.2.0.3 [Release 9.0.1 to 11.2]

Oracle Database - Enterprise Edition - Version 11.2.0.4 to 11.2.0.4 [Release 11.2]

Information in this document applies to any platform.

***Checked for relevance on 12-Dec-2010***

GOAL

Step by step guide on how to create a physical standby database using RMAN without using duplicate command.

SOLUTION

Below are the steps to accomplish the task :

Step 1: Backup the database that includes backup of datafiles, archivelogs and controlfile for standby 

Step 2: Move the backups to the standby server 

Step 3: Make proper changes in the parameter files of both primary and standby database 

Step 4: Do the restore and recover on standby database 

Step 5: Put the standby database in recover managed mode 

 

Example : 

======= 

Step 1: Backup the primary database that includes backup of datafiles, archivelogs and controlfile for standby 

[oracle@test-br ~]$ rman target / 

Recovery Manager: Release 10.2.0.2.0 - Production on Sun Dec 9 14:56:49 2007 

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

connected to target database: ORA10G (DBID=3959250272) 

RMAN> run

{

 allocate channel c1 type disk;

 allocate channel c2 type disk;

allocate channel c3 type disk;

sql 'alter system archive log current';

 backup database plus archivelog;

 

备份的时候在备份的脚本里面切换日志,例如下面

run {

allocate channel a1 type disk;

sql 'alter system archive log current';

backup as compressed backupset filesperset 5 format '/u01/app/oracle/backup/db_%T_%d_%t_%s_%p.dbf' database plus archivelog;

release channel a1;

}

 

using target database control file instead of recovery catalog 

allocated channel: c1 

channel c1: sid=159 devtype=DISK 

allocated channel: c2 

channel c2: sid=138 devtype=DISK 

allocated channel: c3 

channel c3: sid=137 devtype=DISK 

Starting backup at 09:DEC:2007:14:57:27 

current log archived 

channel c1: starting archive log backupset 

channel c1: specifying archive log(s) in backup set 

input archive log thread=1 sequence=32 recid=44 stamp=640387774 

input archive log thread=1 sequence=33 recid=45 stamp=640387945 

input archive log thread=1 sequence=34 recid=48 stamp=640668312 

channel c1: starting piece 1 at 09:DEC:2007:14:57:32 

channel c2: starting archive log backupset 

channel c2: specifying archive log(s) in backup set 

input archive log thread=1 sequence=35 recid=50 stamp=640882651 

channel c2: starting piece 1 at 09:DEC:2007:14:57:32 

channel c3: starting archive log backupset 

channel c3: specifying archive log(s) in backup set 

input archive log thread=1 sequence=20 recid=20 stamp=640385760 

input archive log thread=1 sequence=21 recid=21 stamp=640385772 

input archive log thread=1 sequence=22 recid=22 stamp=640385775 

input archive log thread=1 sequence=23 recid=23 stamp=640385778 

input archive log thread=1 sequence=24 recid=24 stamp=640386245 

input archive log thread=1 sequence=25 recid=25 stamp=640386250 

channel c3: starting piece 1 at 09:DEC:2007:14:57:32 

channel c2: finished piece 1 at 09:DEC:2007:14:57:35 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84xl_.bkp tag=TAG20071209T145731 comment=NONE 

channel c2: backup set complete, elapsed time: 00:00:04 

channel c3: finished piece 1 at 09:DEC:2007:14:57:36 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84z6_.bkp tag=TAG20071209T145731 comment=NONE 

channel c3: backup set complete, elapsed time: 00:00:05 

channel c2: starting archive log backupset 

channel c2: specifying archive log(s) in backup set 

input archive log thread=1 sequence=26 recid=26 stamp=640386253 

input archive log thread=1 sequence=27 recid=27 stamp=640386256 

input archive log thread=1 sequence=28 recid=36 stamp=640387757 

input archive log thread=1 sequence=29 recid=37 stamp=640387764 

input archive log thread=1 sequence=30 recid=40 stamp=640387769 

input archive log thread=1 sequence=31 recid=41 stamp=640387771 

channel c2: starting piece 1 at 09:DEC:2007:14:57:37 

channel c2: finished piece 1 at 09:DEC:2007:14:57:40 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf892x_.bkp tag=TAG20071209T145731 comment=NONE 

channel c2: backup set complete, elapsed time: 00:00:04 

channel c1: finished piece 1 at 09:DEC:2007:14:57:41 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84xf_.bkp tag=TAG20071209T145731 comment=NONE 

channel c1: backup set complete, elapsed time: 00:00:10 

Finished backup at 09:DEC:2007:14:57:41 

Starting backup at 09:DEC:2007:14:57:41 

channel c1: starting full datafile backupset 

channel c1: specifying datafile(s) in backupset 

input datafile fno=00002 name=/u01/oracle/product/oradata/ora10g/data/undo01.dbf 

input datafile fno=00003 name=/u01/oracle/product/oradata/ora10g/data/sysaux01.dbf 

channel c1: starting piece 1 at 09:DEC:2007:14:57:41 

channel c2: starting full datafile backupset 

channel c2: specifying datafile(s) in backupset 

input datafile fno=00001 name=/u01/oracle/product/oradata/ora10g/data/sys01.dbf 

input datafile fno=00004 name=/u01/oracle/product/oradata/ora10g/data/rman.dbf 

channel c2: starting piece 1 at 09:DEC:2007:14:57:41 

channel c3: starting full datafile backupset 

channel c3: specifying datafile(s) in backupset 

including current control file in backupset 

channel c3: starting piece 1 at 09:DEC:2007:14:57:45 

channel c3: finished piece 1 at 09:DEC:2007:14:57:52 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_ncnnf_TAG20071209T145741_3oqf8kdz_.bkp tag=TAG20071209T145741 comment=NONE 

channel c3: backup set complete, elapsed time: 00:00:11 

channel c3: starting full datafile backupset 

channel c3: specifying datafile(s) in backupset 

including current SPFILE in backupset 

channel c3: starting piece 1 at 09:DEC:2007:14:57:53 

channel c3: finished piece 1 at 09:DEC:2007:14:57:56 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnsnf_TAG20071209T145741_3oqf8sq8_.bkp tag=TAG20071209T145741 comment=NONE 

channel c3: backup set complete, elapsed time: 00:00:04 

channel c1: finished piece 1 at 09:DEC:2007:14:58:31 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fk4_.bkp tag=TAG20071209T145741 comment=NONE 

channel c1: backup set complete, elapsed time: 00:00:50 

channel c2: finished piece 1 at 09:DEC:2007:14:58:31 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fod_.bkp tag=TAG20071209T145741 comment=NONE 

channel c2: backup set complete, elapsed time: 00:00:50 

Finished backup at 09:DEC:2007:14:58:31 

Starting backup at 09:DEC:2007:14:58:31 

current log archived 

channel c1: starting archive log backupset 

channel c1: specifying archive log(s) in backup set 

input archive log thread=1 sequence=36 recid=51 stamp=640882711 

channel c1: starting piece 1 at 09:DEC:2007:14:58:32 

channel c1: finished piece 1 at 09:DEC:2007:14:58:33 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145831_3oqfb0p6_.bkp tag=TAG20071209T145831 comment=NONE 

channel c1: backup set complete, elapsed time: 00:00:02 

Finished backup at 09:DEC:2007:14:58:33 

released channel: c1 

released channel: c2 

released channel: c3 

RMAN> run

{

allocate channel c1 type disk;

backup current controlfile for standby;

}

 备份的时候也可以指定格式和路径

RMAN> run

{

allocate channel c1 type disk;

backup current controlfile for standby format '/u01/app/oracle/backup/db_%T_%d_%t_%s_%p.ctl';

}

allocated channel: c1 

channel c1: sid=159 devtype=DISK 

Starting backup at 09:DEC:2007:15:00:09 

channel c1: starting full datafile backupset 

channel c1: specifying datafile(s) in backupset 

including standby control file in backupset 

channel c1: starting piece 1 at 09:DEC:2007:15:00:10 

channel c1: finished piece 1 at 09:DEC:2007:15:00:11 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_ncnnf_TAG20071209T150009_3oqff2fb_.bkp tag=TAG20071209T150009 comment=NONE 

channel c1: backup set complete, elapsed time: 00:00:01 

Finished backup at 09:DEC:2007:15:00:11 

released channel: c1

 

 

Step 2: Move the backups to the standby server 

+ FTP or SCP the backup pieces. 

+ If the backups are on NFS mount then mount the NFS on standby server with the same name as you mounted on primary database. 

+ Until 9i, you need to move the backup-pieces in exactly the same location on standby as they were created on primary. 

+ From 10g onwards, use CATALOG BACKUPPIECE command if you are moving backup-pieces to a different location. 

+ If the backups are on tape then make sure that you make proper changes on standby server so that you can restore the backups on standby server. 

Step 3: Make proper changes in the parameter files of both primary and standby database 

Add the below parameter in primary database parameter file :

log_archive_dest_2='SERVICE=STANDBY'

Add the below parameters in standby database parameter file : 

Copy the primary database parameter file and make necessary changes :

db_unique_name='standby'

instance_name='standby'

db_file_name_convert='/u01/oracle/product/oradata/ora10g/data/','/u01/oracle/product/ora10g/oradata/standby/data/','/tmp/','/u01/oracle/product/ora10g/oradata/standby/data/'

log_file_name_convert='/u01/oracle/product/oradata/ora10g/log/','/u01/oracle/product/ora10g/oradata/standby/log'

standby_archive_dest='/u01/oracle/product/ora10g/oradata/standby/arch1'

 

 

Comment:

---------

# The  below convert parameters are only applicable only when you use RMAN DUPLICATE .

They donot work  for  Normal  RMAN RESTORE operation  (You would need to use Set newname for datafile )

#

  db_file_name_convert=####一定要来连临时文件的路径一起转换#####

  log_file_name_convert=####一定要把standbylog日志的路径也要转换####

使用异地恢复的方式配置ADG,这两个参数在主库中需要配置,

备库是在adg配置成功后(在restore,recover之后并查看adg没有问题后,在修改参数文件将这两个参数添加进去

出现的问题:

(1)如果备库是在restore,recover之前添加进去,后出现

SQL> alter system set standby_file_management=manual scope=both;----####要是spfile参数文件#######

System altered.

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/redo01.log' to '/u01/app/oracle/oradata/ogg1/redo01.log';

找不到路径和文件

(2)如果配置了adg完成后,就要将这两个参数添加进去,不然数据文件的路径会发生变化

两个参数未添加的时候

/u01/app/oracle/oradata/ogg2/test031.dbf--ogg2是主库上的路径,在添加test031.dbf这个文件的时候将ogg2这个文件创建出来了

两个参数添加之后

/u01/app/oracle/oradata/ogg1/test032.dbf

 

o Exception:

  If "STANDBY CONTROLFILE" is used/restored o like use option 'standby controlfile' 

   RMAN> RESTORE STANDBY CONTROLFILE from ... 

  else convert parameter DB_FILE_NAME_CONVERT is NOT used.

After STANDBY CONTROLFILE is restored, you can mount the AUX Instance and verify DB_FILE_NAME_CONVERT 

  parameter is used and show correct datafile path/name  using for example:

   RMAN> REPORT SCHEMA ;       ( or sql> select name from v$datafile ; ) 

 

Note : In 8i and 9i in-place of db_unique_name='standby' you have to use lock_name_space='standby'

Step 4: Do the restore and recover on standby database 

 

Note : After the restore try to identify the last archivelog sequence that is backed up and add 1 to it and do the recovery using it. In the below example the last archivelog that is backed up is sequence 36 and we added 1 to it that becomes 37 and we recovered till sequence 37.

[oracle@test-br ~]$ export ORACLE_SID=standby 

[oracle@test-br ~]$ rman target / 

 

Recovery Manager: Release 10.2.0.2.0 - Production on Sun Dec 9 15:18:28 2007 

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

connected to target database (not started) 

RMAN> startup nomount; 

Oracle instance started 

Total System Global Area 603979776 bytes 

Fixed Size 1262224 bytes 

Variable Size 163581296 bytes 

Database Buffers 432013312 bytes 

Redo Buffers 7122944 bytes 

 

RMAN> set dbid=3959250272; 

executing command: SET DBID

For 9i to restore controlfile you need to use the below command :

RMAN>restore controlfile from '/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_ncnnf_TAG20071209T150009_3oqff2fb_.bkp';

 

From  10g onwards you need to use the below command to restore controlfile :

RMAN> restore standby controlfile from '/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_ncnnf_TAG20071209T150009_3oqff2fb_.bkp';

如果是rac或者控制文件是两个路径的话

 restore standby  controlfile  to '/u01/app/oracle/oradata/oradgphy/crontal01.ctl' from '/u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak';

 

 restore standby  controlfile  to '/u01/app/oracle/oradata/oradgphy/crontal02.ctl' from '/u05/oracle/standby_ORADG11G_20150823_2tqfbpf0_1_1.bak';

 

 

Starting restore at 09:DEC:2007:15:19:50 

using target database control file instead of recovery catalog 

allocated channel: ORA_DISK_1 

channel ORA_DISK_1: sid=156 devtype=DISK 

 

channel ORA_DISK_1: restoring control file 

channel ORA_DISK_1: restore complete, elapsed time: 00:00:02 

output filename=/u01/oracle/product/ora10g/oradata/standby/control01.ctl 

output filename=/u01/oracle/product/ora10g/oradata/standby/control02.ctl 

output filename=/u01/oracle/product/ora10g/oradata/standby/control03.ctl 

Finished restore at 09:DEC:2007:15:19:53 

 

RMAN> sql 'alter database mount standby database'; 

sql statement: alter database mount standby database 

released channel: ORA_DISK_1

# Sample script:

# ---------------

# If filesystem layout is different at standby, use SET NEWNAME to restore files 

# for more details see RMAN documentation

 

这一步要注意:

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/redo01.log' to '/u01/app/oracle/oradata/ogg1/redo01.log';

alter database rename file '/u01/app/oracle/oradata/ogg2/redo01.log' to '/u01/app/oracle/oradata/ogg1/redo01.log'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-01275: Operation RENAME is not allowed if standby file management is

automatic.

 

SQL> alter system set standby_file_management=manual scope=both;

System altered.

 

SQL> alter database rename file '/u01/app/oracle/oradata/ogg2/redo01.log' to '/u01/app/oracle/oradata/ogg1/redo01.log';

Database altered.

 

alter database rename file '/u01/app/oracle/oradata/ogg2/redo01.log' to '/u01/app/oracle/oradata/ogg1/redo01.log';

 

alter database rename file '/u01/app/oracle/oradata/ogg2/redo02.log' to '/u01/app/oracle/oradata/ogg1/redo02.log';

 

alter database rename file '/u01/app/oracle/oradata/ogg2/redo03.log' to '/u01/app/oracle/oradata/ogg1/redo03.log';

 

alter system set standby_file_management=auto scope=both sid='*';

 

RMAN> catalog start with '/tmp/rman/';             <--备份目录不一致时使用

####恢复时,备份端的数据文件名和日志文件的名称,一定要严格按照主库的数据文件名,命名,,否则进行增量恢复时会出现主库和备库的数据文件名称不一致,还要在进行数据文件名称的rename#####

RMAN> run { 

  ALLOCATE CHANNEL c1 DEVICE TYPE DISK ;

  set newname for datafile 1 to '/u01/oracle/product/ora10g/oradata/standby/data/sys01.dbf'; 

  set newname for datafile 2 to '/u01/oracle/product/ora10g/oradata/standby/data/undo01.dbf';

  set newname for datafile 3 to '/u01/oracle/product/ora10g/oradata/standby/data/sysaux01.dbf';

  set newname for datafile 4 to '/u01/oracle/product/ora10g/oradata/standby/data/rman.dbf';

  restore database; 

  switch datafile all ; 

}

Starting restore at 09:DEC:2007:15:20:18 

Starting implicit crosscheck backup at 09:DEC:2007:15:20:18 

allocated channel: ORA_DISK_1 

channel ORA_DISK_1: sid=156 devtype=DISK 

Crosschecked 14 objects 

Finished implicit crosscheck backup at 09:DEC:2007:15:20:20 

 

Starting implicit crosscheck copy at 09:DEC:2007:15:20:20 

using channel ORA_DISK_1 

Crosschecked 1 objects 

Finished implicit crosscheck copy at 09:DEC:2007:15:20:20 

 

searching for all files in the recovery area 

cataloging files... 

no files cataloged 

 

using channel ORA_DISK_1 

 

channel ORA_DISK_1: starting datafile backupset restore 

channel ORA_DISK_1: specifying datafile(s) to restore from backup set 

restoring datafile 00002 to /u01/oracle/product/ora10g/oradata/standby/data/undo01.dbf 

restoring datafile 00003 to /u01/oracle/product/ora10g/oradata/standby/data/sysaux01.dbf 

channel ORA_DISK_1: reading from backup piece /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fk4_.bkp 

channel ORA_DISK_1: restored backup piece 1 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fk4_.bkp tag=TAG20071209T145741 

channel ORA_DISK_1: restore complete, elapsed time: 00:00:35 

channel ORA_DISK_1: starting datafile backupset restore 

channel ORA_DISK_1: specifying datafile(s) to restore from backup set 

restoring datafile 00001 to /u01/oracle/product/ora10g/oradata/standby/data/sys01.dbf 

restoring datafile 00004 to /u01/oracle/product/ora10g/oradata/standby/data/rman.dbf 

channel ORA_DISK_1: reading from backup piece /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fod_.bkp 

channel ORA_DISK_1: restored backup piece 1 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_nnndf_TAG20071209T145741_3oqf8fod_.bkp tag=TAG20071209T145741 

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25 

Finished restore at 09:DEC:2007:15:21:21

..

datafile 1 switched to datafile copy

datafile 2 switched to datafile copy

datafile 3 switched to datafile copy

datafile 4 switched to datafile copy

..

RMAN>

 

# The below command will list all the archivelogs which are backed up and from this list we need to identify the maximum sequence for recovery.

 

RMAN> list backup of archivelog all; 

 

 

List of Backup Sets 

=================== 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

4 65.50K DISK 00:00:01 03:DEC:2007:20:10:18 

BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20071203T201017 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_03/o1_mf_annnn_TAG20071203T201017_3o85blm6_.bkp 

 

List of Archived Logs in backup set 4 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 9 272579 03:DEC:2007:20:08:38 272631 03:DEC:2007:20:10:16 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

5 688.80M DISK 00:00:48 03:DEC:2007:20:12:22 

BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20071203T201133 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_03/o1_mf_annnn_TAG20071203T201133_3o85f0hl_.bkp 

 

List of Archived Logs in backup set 5 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 1 1 03:DEC:2007:18:49:10 66282 03:DEC:2007:18:54:55 

1 2 66282 03:DEC:2007:18:54:55 100553 03:DEC:2007:18:56:09 

1 3 100553 03:DEC:2007:18:56:09 131293 03:DEC:2007:18:57:52 

1 4 131293 03:DEC:2007:18:57:52 168479 03:DEC:2007:19:05:44 

1 5 168479 03:DEC:2007:19:05:44 210171 03:DEC:2007:19:06:50 

1 6 210171 03:DEC:2007:19:06:50 240733 03:DEC:2007:19:08:25 

1 7 240733 03:DEC:2007:19:08:25 266780 03:DEC:2007:19:10:40 

1 8 266780 03:DEC:2007:19:10:40 272579 03:DEC:2007:20:08:38 

1 9 272579 03:DEC:2007:20:08:38 272631 03:DEC:2007:20:10:16 

1 10 272631 03:DEC:2007:20:10:16 272683 03:DEC:2007:20:10:42 

1 11 272683 03:DEC:2007:20:10:42 272706 03:DEC:2007:20:10:54 

1 12 272706 03:DEC:2007:20:10:54 272724 03:DEC:2007:20:10:57 

1 13 272724 03:DEC:2007:20:10:57 272744 03:DEC:2007:20:11:00 

1 14 272744 03:DEC:2007:20:11:00 272763 03:DEC:2007:20:11:03 

1 15 272763 03:DEC:2007:20:11:03 272782 03:DEC:2007:20:11:06 

1 16 272782 03:DEC:2007:20:11:06 272802 03:DEC:2007:20:11:09 

1 17 272802 03:DEC:2007:20:11:09 272821 03:DEC:2007:20:11:12 

1 18 272821 03:DEC:2007:20:11:12 272840 03:DEC:2007:20:11:15 

1 19 272840 03:DEC:2007:20:11:15 272861 03:DEC:2007:20:11:33 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

7 61.54M DISK 00:00:04 09:DEC:2007:14:57:35 

BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20071209T145731 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84xl_.bkp 

 

List of Archived Logs in backup set 7 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 35 400351 07:DEC:2007:03:25:09 489499 09:DEC:2007:14:57:27 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

8 3.08M DISK 00:00:04 09:DEC:2007:14:57:35 

BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20071209T145731 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84z6_.bkp 

 

List of Archived Logs in backup set 8 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 20 272861 03:DEC:2007:20:11:33 274614 03:DEC:2007:20:56:00 

1 21 274614 03:DEC:2007:20:56:00 274621 03:DEC:2007:20:56:12 

1 22 274621 03:DEC:2007:20:56:12 274624 03:DEC:2007:20:56:15 

1 23 274624 03:DEC:2007:20:56:15 274627 03:DEC:2007:20:56:18 

1 24 274627 03:DEC:2007:20:56:18 274796 03:DEC:2007:21:04:05 

1 25 274796 03:DEC:2007:21:04:05 274800 03:DEC:2007:21:04:10 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

9 25.00K DISK 00:00:02 09:DEC:2007:14:57:38 

BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20071209T145731 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf892x_.bkp 

 

List of Archived Logs in backup set 9 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 26 274800 03:DEC:2007:21:04:10 274803 03:DEC:2007:21:04:13 

1 27 274803 03:DEC:2007:21:04:13 274806 03:DEC:2007:21:04:16 

1 28 274806 03:DEC:2007:21:04:16 275324 03:DEC:2007:21:29:17 

1 29 275324 03:DEC:2007:21:29:17 275328 03:DEC:2007:21:29:24 

1 30 275328 03:DEC:2007:21:29:24 275332 03:DEC:2007:21:29:29 

1 31 275332 03:DEC:2007:21:29:29 275335 03:DEC:2007:21:29:31 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

10 95.73M DISK 00:00:09 09:DEC:2007:14:57:40 

BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20071209T145731 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145731_3oqf84xf_.bkp 

 

List of Archived Logs in backup set 10 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 32 275335 03:DEC:2007:21:29:31 275338 03:DEC:2007:21:29:34 

1 33 275338 03:DEC:2007:21:29:34 275545 03:DEC:2007:21:32:25 

1 34 275545 03:DEC:2007:21:32:25 400351 07:DEC:2007:03:25:09 

 

BS Key Size Device Type Elapsed Time Completion Time 

------- ---------- ----------- ------------ -------------------- 

15 2.00K DISK 00:00:01 09:DEC:2007:14:58:32 

BP Key: 15 Status: AVAILABLE Compressed: NO Tag: TAG20071209T145831 

Piece Name: /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145831_3oqfb0p6_.bkp 

 

List of Archived Logs in backup set 15 

Thrd Seq Low SCN Low Time Next SCN Next Time 

---- ------- ---------- -------------------- ---------- --------- 

1 36 489499 09:DEC:2007:14:57:27 489527 09:DEC:2007:14:58:31 

 

RMAN> recover database until sequence 37; 

 

Starting recover at 09:DEC:2007:15:22:38 

using channel ORA_DISK_1 

 

starting media recovery 

 

channel ORA_DISK_1: starting archive log restore to default destination 

channel ORA_DISK_1: restoring archive log 

archive log thread=1 sequence=36 

channel ORA_DISK_1: reading from backup piece /u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145831_3oqfb0p6_.bkp 

channel ORA_DISK_1: restored backup piece 1 

piece handle=/u01/oracle/product/ora10g/flash_recovery_area/ORA10G/backupset/2007_12_09/o1_mf_annnn_TAG20071209T145831_3oqfb0p6_.bkp tag=TAG20071209T145831 

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 

archive log filename=/u01/oracle/product/ora10g/flash_recovery_area/ABC/archivelog/2007_12_09/o1_mf_1_36_3oqgq81h_.arc thread=1 sequence=36 

channel default: deleting archive log(s) 

archive log filename=/u01/oracle/product/ora10g/flash_recovery_area/ABC/archivelog/2007_12_09/o1_mf_1_36_3oqgq81h_.arc recid=1 stamp=640884160 

Oracle Error: 

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below 

ORA-01152: file 1 was not restored from a sufficiently old backup 

ORA-01110: data file 1: '/u01/oracle/product/ora10g/oradata/standby/data/sys01.dbf' 

 

media recovery complete, elapsed time: 00:00:00 

Finished recover at 09:DEC:2007:15:22:41 

 

RMAN> exit 

 

Recovery Manager complete.

 

Note : No need to worry about the errors, you can safely ignore and move to step 5.    

Oracle Error:  

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below  

ORA-01152: file 1 was not restored from a sufficiently old backup  

ORA-01110: data file 1: '/u01/oracle/product/ora10g/oradata/standby/data/sys01.dbf' 

 

 

  

 

 

Step 5: Put the standby database in recover managed mode  

After ensuring connectivity from primary to standby using the service specified in LOG_ARCHIVE_DEST_2 parameter of primary and creating a password file on standby with the same sys password as primary, we can start managed recovery on standby.

[oracle@test-br ~]$ sqlplus "/ as sysdba"   

SQL*Plus: Release 10.2.0.2.0 - Production on Sun Dec 9 15:49:26 2007   

Copyright (c) 1982, 2005, Oracle. All Rights Reserved.   

Connected to:   

Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production   

With the Partitioning, OLAP and Data Mining options   

SQL> alter database recover managed standby database disconnect from session;

Database altered. 

猜你喜欢

转载自blog.csdn.net/m18994118189/article/details/82770281
今日推荐