DATAGUARD手記(DUPLICATE)(四)

zhouwf0726發表於2019-06-02

http://zhouwf0726.itpub.net/post/9689/395349
http://zhouwf0726.itpub.net/post/9689/395350
http://zhouwf0726.itpub.net/post/9689/395437
http://zhouwf0726.itpub.net/post/9689/401874
http://zhouwf0726.itpub.net/post/9689/403401

為了測試在含有DG和STREAM環境的ORACLE升級,搭建一個測試環境,首先搭建DG環境。


一、登入主機備份資料庫

db-tfusn2cn-a-r1.amazon$ sudo -H -u oracle /opt/third-party/bin/logbash --login
amazon.com authorized use only. weifengz@db-tfusn2cn-a-r1 Password:
no VLM_WINDOW_SIZE entry for DEFAULT, using default (512MB)

LD_LIBRARY_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib:/opt/third-party/lib:/usr/lib
ORACLE_SID=DEFAULT
ORACLE_HOME=/opt/app/oracle/product/10.1.0.4/A04db
SHLIB_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib
TZ=UTC
VLM_WINDOW_SIZE=
DISABLE_MAP_LOCK - 1

logbash: /opt/app/oracle: is a directory
oracle:db-tfusn2cn-a-r1.amazon.com: /opt/app/oracle> oraenvamzn yudong
no VLM_WINDOW_SIZE entry for yudong, using default (512MB)

LD_LIBRARY_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib:/opt/third-party/lib:/usr/lib
ORACLE_SID=yudong
ORACLE_HOME=/opt/app/oracle/product/10.1.0.4/A04db
SHLIB_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib
TZ=UTC
VLM_WINDOW_SIZE=
DISABLE_MAP_LOCK - 1

oracle:db-tfusn2cn-a-r1.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> $ORACLE_HOME/bin/rman target /

Recovery Manager: Release 10.1.0.4.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

connected to target database: YUDONG (DBID=404134968)

RMAN> backup tag 'fullforstandby' database include current controlfile for standby plus archivelog;


Starting backup at 30-SEP-07
current log archived
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=106 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=700 recid=2612 stamp=634132672
input archive log thread=1 sequence=701 recid=2614 stamp=634132694

..................................................................
..................................................................

input archive log thread=1 sequence=758 recid=2771 stamp=634304182
input archive log thread=1 sequence=759 recid=2774 stamp=634307781
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7ait70oh_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=760 recid=2777 stamp=634311381
input archive log thread=1 sequence=761 recid=2780 stamp=634314983

..................................................................
..................................................................

input archive log thread=1 sequence=802 recid=2903 stamp=634458782
input archive log thread=1 sequence=803 recid=2906 stamp=634462384
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7bit70oq_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=804 recid=2909 stamp=634465983
input archive log thread=1 sequence=805 recid=2912 stamp=634469582

..................................................................
..................................................................

input archive log thread=1 sequence=850 recid=3043 stamp=634618289


input archive log thread=1 sequence=851 recid=3045

stamp=634618640
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7cit70p2_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 30-SEP-07

Starting backup at 30-SEP-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00017 name=/fs-a01-a/databases/yudong/large_idx-01.dbf
input datafile fno=00014 name=/fs-a01-a/databases/yudong/administrator-02.dbf
input datafile fno=00001 name=/fs-a01-b/databases/yudong/system-01.dbf
input datafile fno=00004 name=/fs-a01-a/databases/yudong/administrator-01.dbf
input datafile fno=00006 name=/fs-a01-b/databases/yudong/replication-01.dbf
input datafile fno=00008 name=/fs-a01-a/databases/yudong/precise_or_tab-01.dbf
input datafile fno=00002 name=/fs-a01-a/databases/yudong/undo_t1-01.dbf
input datafile fno=00003 name=/fs-a01-a/databases/yudong/sysaux-01.dbf
input datafile fno=00005 name=/fs-a01-b/databases/yudong/administrator_idx-01.dbf
input datafile fno=00009 name=/fs-a01-b/databases/yudong/system-02.dbf
input datafile fno=00010 name=/fs-a01-a/databases/yudong/large_idx-02.dbf
input datafile fno=00007 name=/fs-a01-a/databases/yudong/replication_idx-01.dbf
input datafile fno=00011 name=/fs-a01-b/databases/yudong/system-03.dbf
input datafile fno=00016 name=/fs-a01-a/databases/yudong/zwf_new.dbf
input datafile fno=00012 name=/fs-a01-a/databases/yudong/large_idx-03.dbf
input datafile fno=00013 name=/fs-a01-a/databases/yudong/sysaux-02.dbf
input datafile fno=00015 name=/fs-a01-a/databases/yudong/zwf.dbf
input datafile fno=00018 name=/fs-a01-a/databases/yudong/zwf_new_new.dbf
input datafile fno=00020 name=/fs-a01-a/databases/yudong/t_zwf.dbf
input datafile fno=00019 name=/fs-a01-a/databases/yudong/zwf_new_new_new.dbf
channel ORA_DISK_1: starting piece 1 at 30-SEP-07

channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7dit70pa_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:36

channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7eit70u6_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-SEP-07

Starting backup at 30-SEP-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set


input archive log thread=1 sequence=852 recid=3047

stamp=634618825
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7fit70u9_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-SEP-07

Starting Control File Autobackup at 30-SEP-07
piece handle=/oracle-backup/db-backup/databases/yudong/c-404134968-20070930-03 comment=NONE
Finished Control File Autobackup at 30-SEP-07

二、登入從機建立STANDBY


weifengz.desktop% sudo -H -u oracle /opt/third-party/bin/logbash --login
amazon.com authorized use only. weifengz@weifengz Password:

No such sid "DEFAULT".
Using default values.
no VLM_WINDOW_SIZE entry for , using default (512MB)

LD_LIBRARY_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib:/opt/third-party/lib:/usr/lib
ORACLE_SID=
ORACLE_HOME=/opt/app/oracle/product/10.1.0.4/A04db
SHLIB_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib
TZ=UTC
VLM_WINDOW_SIZE=
DISABLE_MAP_LOCK - 1

logbash: /opt/app/oracle: is a directory
oracle:weifengz.desktop.amazon.com: /opt/app/oracle> oraenvamzn yudong
no VLM_WINDOW_SIZE entry for yudong, using default (512MB)

LD_LIBRARY_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib:/opt/third-party/lib:/usr/lib
ORACLE_SID=yudong
ORACLE_HOME=/opt/app/oracle/product/10.1.0.4/A04db
SHLIB_PATH=/opt/app/oracle/product/10.1.0.4/A04db/lib
TZ=UTC
VLM_WINDOW_SIZE=
DISABLE_MAP_LOCK - 1


oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6oit6r09_1_1 .
Password:
Response:
6oit6r09_1_1 100% 176MB 10.1MB/s 00:16
oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6pit6r0p_1_1 .
Password:
Response:
6pit6r0p_1_1 100% 175MB 10.0MB/s 00:16
oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6qit6r12_1_1 .
Password:
Response:
6qit6r12_1_1 100% 175MB 10.1MB/s 00:15
oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6rit6r1a_1_1 .
Password:
Response:
6rit6r1a_1_1 100% 1351MB 10.0MB/s 02:01
oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6sit6r67_1_1 .
Password:
Response:
6sit6r67_1_1 100% 9248KB 9.0MB/s 00:01
oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> scp weifengz@db-tfusn2cn-a-r1.amazon.com:/opt/app/oracle/product/10.1.0.4/A04db/dbs/6tit6r69_1_1 .
Password:
Response:
6tit6r69_1_1 100% 188KB 0.0KB/s 00:00


oracle:weifengz.desktop.amazon.com: /opt/app/oracle/product/10.1.0.4/A04db/dbs> $ORACLE_HOME/bin/rman target sys/sys@yudong_a auxiliary sys/sys@yudong_b

Recovery Manager: Release 10.1.0.4.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

connected to target database: YUDONG (DBID=404134968)
connected to auxiliary database (not started)

RMAN> startup auxiliary nomount;

Oracle instance started

Total System Global Area 490733568 bytes

Fixed Size 779456 bytes
Variable Size 407771968 bytes
Database Buffers 81920000 bytes
Redo Buffers 262144 bytes

RMAN> run{
2> set until sequence=851 thread=1;
3> duplicate target database for standby dorecover nofilenamecheck;
4> }

executing command: SET until clause
using target database controlfile instead of recovery catalog

Starting Duplicate Db at 30-SEP-07
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=141 devtype=DISK

contents of Memory Script:
{
set until scn 260704166;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 30-SEP-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
ORA-19624: operation failed, retry possible
ORA-19505: failed to identify file "/opt/app/oracle/product/10.1.0.4/A04db/dbs/73it70b7_1_1"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory

Additional information: 3
failover to previous backup

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/6sit6r67_1_1 tag=TAG20070930T011938
channel ORA_AUX_DISK_1: restore complete
output filename=/ctl-01/databases/yudong/control.ctl
output filename=/ctl-02/databases/yudong/control.ctl
Finished restore at 30-SEP-07

sql statement: alter database mount standby database

contents of Memory Script:
{
set until scn 260704166;
set newname for datafile 1 to
"/fs-a01-b/databases/yudong/system-01.dbf";
set newname for datafile 2 to
"/fs-a01-a/databases/yudong/undo_t1-01.dbf";
set newname for datafile 3 to
"/fs-a01-a/databases/yudong/sysaux-01.dbf";
set newname for datafile 4 to
"/fs-a01-a/databases/yudong/administrator-01.dbf";
set newname for datafile 5 to
"/fs-a01-b/databases/yudong/administrator_idx-01.dbf";
set newname for datafile 6 to
"/fs-a01-b/databases/yudong/replication-01.dbf";
set newname for datafile 7 to
"/fs-a01-a/databases/yudong/replication_idx-01.dbf";
set newname for datafile 8 to
"/fs-a01-a/databases/yudong/precise_or_tab-01.dbf";
set newname for datafile 9 to
"/fs-a01-b/databases/yudong/system-02.dbf";
set newname for datafile 10 to
"/fs-a01-a/databases/yudong/large_idx-02.dbf";
set newname for datafile 11 to
"/fs-a01-b/databases/yudong/system-03.dbf";
set newname for datafile 12 to
"/fs-a01-a/databases/yudong/large_idx-03.dbf";
set newname for datafile 13 to
"/fs-a01-a/databases/yudong/sysaux-02.dbf";
set newname for datafile 14 to
"/fs-a01-a/databases/yudong/administrator-02.dbf";
set newname for datafile 15 to
"/fs-a01-a/databases/yudong/zwf.dbf";
set newname for datafile 16 to
"/fs-a01-a/databases/yudong/zwf_new.dbf";
set newname for datafile 17 to
"/fs-a01-a/databases/yudong/large_idx-01.dbf";
set newname for datafile 18 to
"/fs-a01-a/databases/yudong/zwf_new_new.dbf";
set newname for datafile 19 to
"/fs-a01-a/databases/yudong/zwf_new_new_new.dbf";
set newname for datafile 20 to
"/fs-a01-a/databases/yudong/t_zwf.dbf";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-SEP-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /fs-a01-b/databases/yudong/system-01.dbf
restoring datafile 00002 to /fs-a01-a/databases/yudong/undo_t1-01.dbf
restoring datafile 00003 to /fs-a01-a/databases/yudong/sysaux-01.dbf
restoring datafile 00004 to /fs-a01-a/databases/yudong/administrator-01.dbf
restoring datafile 00005 to /fs-a01-b/databases/yudong/administrator_idx-01.dbf
restoring datafile 00006 to /fs-a01-b/databases/yudong/replication-01.dbf
restoring datafile 00007 to /fs-a01-a/databases/yudong/replication_idx-01.dbf
restoring datafile 00008 to /fs-a01-a/databases/yudong/precise_or_tab-01.dbf
restoring datafile 00009 to /fs-a01-b/databases/yudong/system-02.dbf
restoring datafile 00010 to /fs-a01-a/databases/yudong/large_idx-02.dbf
restoring datafile 00011 to /fs-a01-b/databases/yudong/system-03.dbf
restoring datafile 00012 to /fs-a01-a/databases/yudong/large_idx-03.dbf
restoring datafile 00013 to /fs-a01-a/databases/yudong/sysaux-02.dbf
restoring datafile 00014 to /fs-a01-a/databases/yudong/administrator-02.dbf
restoring datafile 00015 to /fs-a01-a/databases/yudong/zwf.dbf
restoring datafile 00016 to /fs-a01-a/databases/yudong/zwf_new.dbf
restoring datafile 00017 to /fs-a01-a/databases/yudong/large_idx-01.dbf
restoring datafile 00018 to /fs-a01-a/databases/yudong/zwf_new_new.dbf
restoring datafile 00019 to /fs-a01-a/databases/yudong/zwf_new_new_new.dbf
restoring datafile 00020 to /fs-a01-a/databases/yudong/t_zwf.dbf
ORA-19624: operation failed, retry possible
ORA-19505: failed to identify file "/opt/app/oracle/product/10.1.0.4/A04db/dbs/72it706b_1_1"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
failover to previous backup

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /fs-a01-b/databases/yudong/system-01.dbf
restoring datafile 00002 to /fs-a01-a/databases/yudong/undo_t1-01.dbf
restoring datafile 00003 to /fs-a01-a/databases/yudong/sysaux-01.dbf
restoring datafile 00004 to /fs-a01-a/databases/yudong/administrator-01.dbf
restoring datafile 00005 to /fs-a01-b/databases/yudong/administrator_idx-01.dbf
restoring datafile 00006 to /fs-a01-b/databases/yudong/replication-01.dbf
restoring datafile 00007 to /fs-a01-a/databases/yudong/replication_idx-01.dbf
restoring datafile 00008 to /fs-a01-a/databases/yudong/precise_or_tab-01.dbf
restoring datafile 00009 to /fs-a01-b/databases/yudong/system-02.dbf
restoring datafile 00010 to /fs-a01-a/databases/yudong/large_idx-02.dbf
restoring datafile 00011 to /fs-a01-b/databases/yudong/system-03.dbf
restoring datafile 00012 to /fs-a01-a/databases/yudong/large_idx-03.dbf
restoring datafile 00013 to /fs-a01-a/databases/yudong/sysaux-02.dbf
restoring datafile 00014 to /fs-a01-a/databases/yudong/administrator-02.dbf
restoring datafile 00015 to /fs-a01-a/databases/yudong/zwf.dbf
restoring datafile 00016 to /fs-a01-a/databases/yudong/zwf_new.dbf
restoring datafile 00017 to /fs-a01-a/databases/yudong/large_idx-01.dbf
restoring datafile 00018 to /fs-a01-a/databases/yudong/zwf_new_new.dbf
restoring datafile 00019 to /fs-a01-a/databases/yudong/zwf_new_new_new.dbf
restoring datafile 00020 to /fs-a01-a/databases/yudong/t_zwf.dbf

channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/6rit6r1a_1_1 tag=TAG20070930T011938
channel ORA_AUX_DISK_1: restore complete
Finished restore at 30-SEP-07

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafilecopy recid=37 stamp=634621649 filename=/fs-a01-b/databases/yudong/system-01.dbf
datafile 2 switched to datafile copy
input datafilecopy recid=38 stamp=634621649 filename=/fs-a01-a/databases/yudong/undo_t1-01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=39 stamp=634621649 filename=/fs-a01-a/databases/yudong/sysaux-01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=40 stamp=634621649 filename=/fs-a01-a/databases/yudong/administrator-01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=41 stamp=634621649 filename=/fs-a01-b/databases/yudong/administrator_idx-01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=42 stamp=634621649 filename=/fs-a01-b/databases/yudong/replication-01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=43 stamp=634621649 filename=/fs-a01-a/databases/yudong/replication_idx-01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=44 stamp=634621649 filename=/fs-a01-a/databases/yudong/precise_or_tab-01.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=45 stamp=634621650 filename=/fs-a01-b/databases/yudong/system-02.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=46 stamp=634621650 filename=/fs-a01-a/databases/yudong/large_idx-02.dbf
datafile 11 switched to datafile copy
input datafilecopy recid=47 stamp=634621650 filename=/fs-a01-b/databases/yudong/system-03.dbf
datafile 12 switched to datafile copy
input datafilecopy recid=48 stamp=634621650 filename=/fs-a01-a/databases/yudong/large_idx-03.dbf
datafile 13 switched to datafile copy
input datafilecopy recid=49 stamp=634621650 filename=/fs-a01-a/databases/yudong/sysaux-02.dbf
datafile 14 switched to datafile copy
input datafilecopy recid=50 stamp=634621650 filename=/fs-a01-a/databases/yudong/administrator-02.dbf
datafile 15 switched to datafile copy
input datafilecopy recid=51 stamp=634621650 filename=/fs-a01-a/databases/yudong/zwf.dbf
datafile 16 switched to datafile copy
input datafilecopy recid=52 stamp=634621650 filename=/fs-a01-a/databases/yudong/zwf_new.dbf
datafile 17 switched to datafile copy
input datafilecopy recid=53 stamp=634621650 filename=/fs-a01-a/databases/yudong/large_idx-01.dbf
datafile 18 switched to datafile copy
input datafilecopy recid=54 stamp=634621650 filename=/fs-a01-a/databases/yudong/zwf_new_new.dbf
datafile 19 switched to datafile copy
input datafilecopy recid=55 stamp=634621650 filename=/fs-a01-a/databases/yudong/zwf_new_new_new.dbf
datafile 20 switched to datafile copy
input datafilecopy recid=56 stamp=634621650 filename=/fs-a01-a/databases/yudong/t_zwf.dbf

contents of Memory Script:
{
set until scn 260704166;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 30-SEP-07
using channel ORA_AUX_DISK_1

starting media recovery

archive log thread 1 sequence 846 is already on disk as file /arch-01/databases/yudong/redolog/-846-1-632058350.arc
archive log filename=/arch-01/databases/yudong/redolog/-846-1-632058350.arc thread=1 sequence=846
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=847
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=848
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=849
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=850
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7cit70p2_1_1 tag=FULLFORSTANDBY
channel ORA_AUX_DISK_1: restore complete
archive log filename=/arch-01/databases/yudong/redolog/-847-1-632058350.arc thread=1 sequence=847
channel clone_default: deleting archive log(s)
archive log filename=/arch-01/databases/yudong/redolog/-847-1-632058350.arc recid=1 stamp=634621653
archive log filename=/arch-01/databases/yudong/redolog/-848-1-632058350.arc thread=1 sequence=848
channel clone_default: deleting archive log(s)
archive log filename=/arch-01/databases/yudong/redolog/-848-1-632058350.arc recid=3 stamp=634621655
archive log filename=/arch-01/databases/yudong/redolog/-849-1-632058350.arc thread=1 sequence=849
channel clone_default: deleting archive log(s)
archive log filename=/arch-01/databases/yudong/redolog/-849-1-632058350.arc recid=2 stamp=634621655
archive log filename=/arch-01/databases/yudong/redolog/-850-1-632058350.arc thread=1 sequence=850
channel clone_default: deleting archive log(s)
archive log filename=/arch-01/databases/yudong/redolog/-850-1-632058350.arc recid=4 stamp=634621655
media recovery complete
Finished recover at 30-SEP-07
Finished Duplicate Db at 30-SEP-07


RMAN> exit


Recovery Manager complete.
oracle:weifengz.desktop.amazon.com: /redo-04-a/databases/yudong> sqlplus "/as sysdba"

SQL*Plus: Release 10.1.0.4.0 - Production on Sun Sep 30 03:55:03 2007

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select database_role,switchover_status,protection_mode,protection_level from v$database;

DATABASE_ROLE SWITCHOVER_STATUS PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- -------------------- --------------------
PHYSICAL STANDBY NOT ALLOWED MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE

SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 NO
851 NO
852 NO
853 NO

7 rows selected.


三、登入到主機

SYS.YUDONG>select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
853

1 row selected.

SYS.YUDONG>alter system switch logfile;

System altered.

SYS.YUDONG>select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------
854

1 row selected.

四、登入到從機

SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS
RFS
RFS

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 NO
851 NO
852 NO
853 NO
854 NO

8 rows selected.


SQL> recover managed standby database disconnect from session;
Media recovery complete.
SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS
RFS
RFS
MRP0

6 rows selected.

注意這裡增加了MRP0程式。

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 NO
851 NO
852 NO
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 NO
852 NO
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 YES
852 NO
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 YES
852 NO
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 YES
852 NO
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 YES
852 YES
853 NO
854 NO

8 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
847 YES
849 YES
848 YES
850 YES
851 YES
852 YES
853 YES
854 YES

8 rows selected.

/***************************************一個需要注意的問題***********************************/

大家注意到上邊duplicate過程中的一個錯誤:

ORA-19624: operation failed, retry possible
ORA-19505: failed to identify file "/opt/app/oracle/product/10.1.0.4/A04db/dbs/73it70b7_1_1"
ORA-27037: unable to obtain file status

這個錯誤產生原因是我們指定了:

set until sequence=851 thread=1;

來進行不完全恢復,我們指定的sequence比備份的控制檔案要早,所以在恢復的過程報錯,不過本次案例幸好存在一個比較早的備份檔案可用,所以RMAN自動使用了上一次的備份來進進行DUPLICATE。如果我們是在一套新的環境執行,一定要記住行不完全恢復的時候,一定要指定until sequence大於等於備份集中的max(seq)+1,

按照上邊的備份max(sequence)為852(input archive log thread=1 sequence=852 recid=3047 stamp=634618825),所以我們就該指定set until sequence=853 thread=1;

否則,如果不是我們的系統中存在一箇舊版本的可用備份而是在新環境執行不完全恢復,我們會收到以下錯誤:


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/30/2007 06:29:51
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the controlfile found to restore


或者我們也可以直接按照下邊的例子做就可以了(不指定until)。


DUPLICATE過程:

RMAN> duplicate target database for standby dorecover nofilenamecheck;

Starting Duplicate Db at 30-SEP-07
using channel ORA_AUX_DISK_1

contents of Memory Script:
{
set until scn 260772926;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 30-SEP-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7lit7eh5_1_1 tag=FULLFORSTANDBY
channel ORA_AUX_DISK_1: restore complete
output filename=/ctl-01/databases/yudong/control.ctl
output filename=/ctl-02/databases/yudong/control.ctl
Finished restore at 30-SEP-07

sql statement: alter database mount standby database

contents of Memory Script:
{
set until scn 260772926;
set newname for datafile 1 to
"/fs-a01-b/databases/yudong/system-01.dbf";
set newname for datafile 2 to
"/fs-a01-a/databases/yudong/undo_t1-01.dbf";
set newname for datafile 3 to
"/fs-a01-a/databases/yudong/sysaux-01.dbf";
set newname for datafile 4 to
"/fs-a01-a/databases/yudong/administrator-01.dbf";
set newname for datafile 5 to
"/fs-a01-b/databases/yudong/administrator_idx-01.dbf";
set newname for datafile 6 to
"/fs-a01-b/databases/yudong/replication-01.dbf";
set newname for datafile 7 to
"/fs-a01-a/databases/yudong/replication_idx-01.dbf";
set newname for datafile 8 to
"/fs-a01-a/databases/yudong/precise_or_tab-01.dbf";
set newname for datafile 9 to
"/fs-a01-b/databases/yudong/system-02.dbf";
set newname for datafile 10 to
"/fs-a01-a/databases/yudong/large_idx-02.dbf";
set newname for datafile 11 to
"/fs-a01-b/databases/yudong/system-03.dbf";
set newname for datafile 12 to
"/fs-a01-a/databases/yudong/large_idx-03.dbf";
set newname for datafile 13 to
"/fs-a01-a/databases/yudong/sysaux-02.dbf";
set newname for datafile 14 to
"/fs-a01-a/databases/yudong/administrator-02.dbf";
set newname for datafile 15 to
"/fs-a01-a/databases/yudong/zwf.dbf";
set newname for datafile 16 to
"/fs-a01-a/databases/yudong/zwf_new.dbf";
set newname for datafile 17 to
"/fs-a01-a/databases/yudong/large_idx-01.dbf";
set newname for datafile 18 to
"/fs-a01-a/databases/yudong/zwf_new_new.dbf";
set newname for datafile 19 to
"/fs-a01-a/databases/yudong/zwf_new_new_new.dbf";
set newname for datafile 20 to
"/fs-a01-a/databases/yudong/t_zwf.dbf";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 30-SEP-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /fs-a01-b/databases/yudong/system-01.dbf
restoring datafile 00002 to /fs-a01-a/databases/yudong/undo_t1-01.dbf
restoring datafile 00003 to /fs-a01-a/databases/yudong/sysaux-01.dbf
restoring datafile 00004 to /fs-a01-a/databases/yudong/administrator-01.dbf
restoring datafile 00005 to /fs-a01-b/databases/yudong/administrator_idx-01.dbf
restoring datafile 00006 to /fs-a01-b/databases/yudong/replication-01.dbf
restoring datafile 00007 to /fs-a01-a/databases/yudong/replication_idx-01.dbf
restoring datafile 00008 to /fs-a01-a/databases/yudong/precise_or_tab-01.dbf
restoring datafile 00009 to /fs-a01-b/databases/yudong/system-02.dbf
restoring datafile 00010 to /fs-a01-a/databases/yudong/large_idx-02.dbf
restoring datafile 00011 to /fs-a01-b/databases/yudong/system-03.dbf
restoring datafile 00012 to /fs-a01-a/databases/yudong/large_idx-03.dbf
restoring datafile 00013 to /fs-a01-a/databases/yudong/sysaux-02.dbf
restoring datafile 00014 to /fs-a01-a/databases/yudong/administrator-02.dbf
restoring datafile 00015 to /fs-a01-a/databases/yudong/zwf.dbf
restoring datafile 00016 to /fs-a01-a/databases/yudong/zwf_new.dbf
restoring datafile 00017 to /fs-a01-a/databases/yudong/large_idx-01.dbf
restoring datafile 00018 to /fs-a01-a/databases/yudong/zwf_new_new.dbf
restoring datafile 00019 to /fs-a01-a/databases/yudong/zwf_new_new_new.dbf
restoring datafile 00020 to /fs-a01-a/databases/yudong/t_zwf.dbf


channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7kit7ec9_1_1 tag=FULLFORSTANDBY
channel ORA_AUX_DISK_1: restore complete
Finished restore at 30-SEP-07

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafilecopy recid=37 stamp=634672246 filename=/fs-a01-b/databases/yudong/system-01.dbf
datafile 2 switched to datafile copy
input datafilecopy recid=38 stamp=634672246 filename=/fs-a01-a/databases/yudong/undo_t1-01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=39 stamp=634672246 filename=/fs-a01-a/databases/yudong/sysaux-01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=40 stamp=634672246 filename=/fs-a01-a/databases/yudong/administrator-01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=41 stamp=634672246 filename=/fs-a01-b/databases/yudong/administrator_idx-01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=42 stamp=634672246 filename=/fs-a01-b/databases/yudong/replication-01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=43 stamp=634672246 filename=/fs-a01-a/databases/yudong/replication_idx-01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=44 stamp=634672246 filename=/fs-a01-a/databases/yudong/precise_or_tab-01.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=45 stamp=634672246 filename=/fs-a01-b/databases/yudong/system-02.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=46 stamp=634672246 filename=/fs-a01-a/databases/yudong/large_idx-02.dbf
datafile 11 switched to datafile copy
input datafilecopy recid=47 stamp=634672246 filename=/fs-a01-b/databases/yudong/system-03.dbf
datafile 12 switched to datafile copy
input datafilecopy recid=48 stamp=634672246 filename=/fs-a01-a/databases/yudong/large_idx-03.dbf
datafile 13 switched to datafile copy
input datafilecopy recid=49 stamp=634672246 filename=/fs-a01-a/databases/yudong/sysaux-02.dbf
datafile 14 switched to datafile copy
input datafilecopy recid=50 stamp=634672246 filename=/fs-a01-a/databases/yudong/administrator-02.dbf
datafile 15 switched to datafile copy
input datafilecopy recid=51 stamp=634672246 filename=/fs-a01-a/databases/yudong/zwf.dbf
datafile 16 switched to datafile copy
input datafilecopy recid=52 stamp=634672246 filename=/fs-a01-a/databases/yudong/zwf_new.dbf
datafile 17 switched to datafile copy
input datafilecopy recid=53 stamp=634672246 filename=/fs-a01-a/databases/yudong/large_idx-01.dbf
datafile 18 switched to datafile copy
input datafilecopy recid=54 stamp=634672246 filename=/fs-a01-a/databases/yudong/zwf_new_new.dbf
datafile 19 switched to datafile copy
input datafilecopy recid=55 stamp=634672246 filename=/fs-a01-a/databases/yudong/zwf_new_new_new.dbf
datafile 20 switched to datafile copy
input datafilecopy recid=56 stamp=634672246 filename=/fs-a01-a/databases/yudong/t_zwf.dbf

contents of Memory Script:
{
set until scn 260772926;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 30-SEP-07
using channel ORA_AUX_DISK_1

starting media recovery

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: '/fs-a01-b/databases/yudong/system-01.dbf'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/30/2007 17:50:48
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 868 lowscn 260768306 found to restore
RMAN-06025: no backup of log thread 1 seq 867 lowscn 260763636 found to restore
RMAN-06025: no backup of log thread 1 seq 866 lowscn 260758927 found to restore
RMAN-06025: no backup of log thread 1 seq 865 lowscn 260750826 found to restore
RMAN-06025: no backup of log thread 1 seq 864 lowscn 260746255 found to restore
RMAN-06025: no backup of log thread 1 seq 863 lowscn 260741667 found to restore
RMAN-06025: no backup of log thread 1 seq 862 lowscn 260737009 found to restore
RMAN-06025: no backup of log thread 1 seq 861 lowscn 260732431 found to restore
RMAN-06025: no backup of log thread 1 seq 860 lowscn 260727834 found to restore
RMAN-06025: no backup of log thread 1 seq 859 lowscn 260723155 found to restore

RMAN> exit


Recovery Manager complete.
oracle:weifengz.desktop.amazon.com: /arch-01/databases/yudong/redolog> sqlplus "/as sysdba"

SQL*Plus: Release 10.1.0.4.0 - Production on Sun Sep 30 17:52:14 2007

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SQL> select sequence#,applied from v$archived_log;

no rows selected

SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS
RFS

SQL> recover managed standby database disconnect;
Media recovery complete.
SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS
RFS
RFS
MRP0

6 rows selected.

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
869 NO

SQL> /

SEQUENCE# APP
---------- ---
869 NO
859 NO
860 NO
861 NO
862 NO
864 NO

6 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
869 NO
859 NO
860 NO
861 NO
862 NO
864 NO
865 NO
866 NO
867 NO

9 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
869 NO
859 NO
860 NO
861 NO
862 NO
864 NO
865 NO
866 NO
867 NO
868 NO

10 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
869 NO
859 YES
860 YES
861 YES
862 YES
864 NO
865 NO
866 NO
867 NO
868 NO
858 YES

SEQUENCE# APP
---------- ---
863 NO

12 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
869 YES
859 YES
860 YES
861 YES
862 YES
864 YES
865 YES
866 YES
867 YES
868 YES
858 YES

SEQUENCE# APP
---------- ---
863 YES

12 rows selected.


該過程我們會看到如下警告提示,這個不會影響我們的建立過程:


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: '/fs-a01-b/databases/yudong/system-01.dbf'

如果想回避這個警告,我們可以執行不完全恢復,但是一定要記得set until sequence = max(備份集sequence) + 1

過程示例如下:

備份過程:

RMAN> backup tag 'fullforstandby' database include current controlfile for standby plus archivelog;


Starting backup at 30-SEP-07
current log archived
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=127 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=700 recid=2612 stamp=634132672
input archive log thread=1 sequence=701 recid=2614 stamp=634132694

..................................................................
..................................................................

input archive log thread=1 sequence=759 recid=2774 stamp=634307781
input archive log thread=1 sequence=760 recid=2777 stamp=634311381
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7hit7eb7_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:17
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=761 recid=2780 stamp=634314983
input archive log thread=1 sequence=762 recid=2783 stamp=634318581

..................................................................
..................................................................

input archive log thread=1 sequence=808 recid=2921 stamp=634480383
input archive log thread=1 sequence=809 recid=2924 stamp=634483985
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7iit7ebo_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=810 recid=2927 stamp=634487584
input archive log thread=1 sequence=811 recid=2930 stamp=634491183

..................................................................
..................................................................

input archive log thread=1 sequence=856 recid=3063 stamp=634629391


input archive log thread=1 sequence=857 recid=3065

stamp=634632550
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7jit7ec0_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 30-SEP-07

Starting backup at 30-SEP-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00017 name=/fs-a01-a/databases/yudong/large_idx-01.dbf
input datafile fno=00014 name=/fs-a01-a/databases/yudong/administrator-02.dbf
input datafile fno=00001 name=/fs-a01-b/databases/yudong/system-01.dbf
input datafile fno=00004 name=/fs-a01-a/databases/yudong/administrator-01.dbf
input datafile fno=00006 name=/fs-a01-b/databases/yudong/replication-01.dbf
input datafile fno=00008 name=/fs-a01-a/databases/yudong/precise_or_tab-01.dbf
input datafile fno=00002 name=/fs-a01-a/databases/yudong/undo_t1-01.dbf
input datafile fno=00003 name=/fs-a01-a/databases/yudong/sysaux-01.dbf
input datafile fno=00005 name=/fs-a01-b/databases/yudong/administrator_idx-01.dbf
input datafile fno=00009 name=/fs-a01-b/databases/yudong/system-02.dbf
input datafile fno=00010 name=/fs-a01-a/databases/yudong/large_idx-02.dbf
input datafile fno=00007 name=/fs-a01-a/databases/yudong/replication_idx-01.dbf
input datafile fno=00011 name=/fs-a01-b/databases/yudong/system-03.dbf
input datafile fno=00016 name=/fs-a01-a/databases/yudong/zwf_new.dbf
input datafile fno=00012 name=/fs-a01-a/databases/yudong/large_idx-03.dbf
input datafile fno=00013 name=/fs-a01-a/databases/yudong/sysaux-02.dbf
input datafile fno=00015 name=/fs-a01-a/databases/yudong/zwf.dbf
input datafile fno=00018 name=/fs-a01-a/databases/yudong/zwf_new_new.dbf
input datafile fno=00020 name=/fs-a01-a/databases/yudong/t_zwf.dbf
input datafile fno=00019 name=/fs-a01-a/databases/yudong/zwf_new_new_new.dbf
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7kit7ec9_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:35
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby controlfile in backupset
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7lit7eh5_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-SEP-07

Starting backup at 30-SEP-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set


input archive log thread=1 sequence=858 recid=3067

stamp=634632748
channel ORA_DISK_1: starting piece 1 at 30-SEP-07
channel ORA_DISK_1: finished piece 1 at 30-SEP-07
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7mit7ehc_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 30-SEP-07

Starting Control File Autobackup at 30-SEP-07
piece handle=/oracle-backup/db-backup/databases/yudong/c-404134968-20070930-04 comment=NONE
Finished Control File Autobackup at 30-SEP-07

DUPLICATE過程:

RMAN> run{
2> set until sequence=859 thread=1;3> duplicate target database for standby dorecover nofilenamecheck;
4> }

executing command: SET until clause

Starting Duplicate Db at 01-OCT-07
using channel ORA_AUX_DISK_1

contents of Memory Script:
{
set until scn 260723155;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 01-OCT-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: restoring controlfile
channel ORA_AUX_DISK_1: restored backup piece 1


piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7lit7eh5_1_1 tag=FULLFORSTANDBY


channel ORA_AUX_DISK_1: restore complete
output filename=/ctl-01/databases/yudong/control.ctl
output filename=/ctl-02/databases/yudong/control.ctl
Finished restore at 01-OCT-07

sql statement: alter database mount standby database

contents of Memory Script:
{
set until scn 260723155;
set newname for datafile 1 to
"/fs-a01-b/databases/yudong/system-01.dbf";
set newname for datafile 2 to
"/fs-a01-a/databases/yudong/undo_t1-01.dbf";
set newname for datafile 3 to
"/fs-a01-a/databases/yudong/sysaux-01.dbf";
set newname for datafile 4 to
"/fs-a01-a/databases/yudong/administrator-01.dbf";
set newname for datafile 5 to
"/fs-a01-b/databases/yudong/administrator_idx-01.dbf";
set newname for datafile 6 to
"/fs-a01-b/databases/yudong/replication-01.dbf";
set newname for datafile 7 to
"/fs-a01-a/databases/yudong/replication_idx-01.dbf";
set newname for datafile 8 to
"/fs-a01-a/databases/yudong/precise_or_tab-01.dbf";
set newname for datafile 9 to
"/fs-a01-b/databases/yudong/system-02.dbf";
set newname for datafile 10 to
"/fs-a01-a/databases/yudong/large_idx-02.dbf";
set newname for datafile 11 to
"/fs-a01-b/databases/yudong/system-03.dbf";
set newname for datafile 12 to
"/fs-a01-a/databases/yudong/large_idx-03.dbf";
set newname for datafile 13 to
"/fs-a01-a/databases/yudong/sysaux-02.dbf";
set newname for datafile 14 to
"/fs-a01-a/databases/yudong/administrator-02.dbf";
set newname for datafile 15 to
"/fs-a01-a/databases/yudong/zwf.dbf";
set newname for datafile 16 to
"/fs-a01-a/databases/yudong/zwf_new.dbf";
set newname for datafile 17 to
"/fs-a01-a/databases/yudong/large_idx-01.dbf";
set newname for datafile 18 to
"/fs-a01-a/databases/yudong/zwf_new_new.dbf";
set newname for datafile 19 to
"/fs-a01-a/databases/yudong/zwf_new_new_new.dbf";
set newname for datafile 20 to
"/fs-a01-a/databases/yudong/t_zwf.dbf";
restore
check readonly
clone database
;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 01-OCT-07
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /fs-a01-b/databases/yudong/system-01.dbf
restoring datafile 00002 to /fs-a01-a/databases/yudong/undo_t1-01.dbf
restoring datafile 00003 to /fs-a01-a/databases/yudong/sysaux-01.dbf
restoring datafile 00004 to /fs-a01-a/databases/yudong/administrator-01.dbf
restoring datafile 00005 to /fs-a01-b/databases/yudong/administrator_idx-01.dbf
restoring datafile 00006 to /fs-a01-b/databases/yudong/replication-01.dbf
restoring datafile 00007 to /fs-a01-a/databases/yudong/replication_idx-01.dbf
restoring datafile 00008 to /fs-a01-a/databases/yudong/precise_or_tab-01.dbf
restoring datafile 00009 to /fs-a01-b/databases/yudong/system-02.dbf
restoring datafile 00010 to /fs-a01-a/databases/yudong/large_idx-02.dbf
restoring datafile 00011 to /fs-a01-b/databases/yudong/system-03.dbf
restoring datafile 00012 to /fs-a01-a/databases/yudong/large_idx-03.dbf
restoring datafile 00013 to /fs-a01-a/databases/yudong/sysaux-02.dbf
restoring datafile 00014 to /fs-a01-a/databases/yudong/administrator-02.dbf
restoring datafile 00015 to /fs-a01-a/databases/yudong/zwf.dbf
restoring datafile 00016 to /fs-a01-a/databases/yudong/zwf_new.dbf
restoring datafile 00017 to /fs-a01-a/databases/yudong/large_idx-01.dbf
restoring datafile 00018 to /fs-a01-a/databases/yudong/zwf_new_new.dbf
restoring datafile 00019 to /fs-a01-a/databases/yudong/zwf_new_new_new.dbf
restoring datafile 00020 to /fs-a01-a/databases/yudong/t_zwf.dbf


channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7kit7ec9_1_1 tag=FULLFORSTANDBY
channel ORA_AUX_DISK_1: restore complete
Finished restore at 01-OCT-07

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafilecopy recid=37 stamp=634789706 filename=/fs-a01-b/databases/yudong/system-01.dbf
datafile 2 switched to datafile copy
input datafilecopy recid=38 stamp=634789706 filename=/fs-a01-a/databases/yudong/undo_t1-01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=39 stamp=634789706 filename=/fs-a01-a/databases/yudong/sysaux-01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=40 stamp=634789706 filename=/fs-a01-a/databases/yudong/administrator-01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=41 stamp=634789706 filename=/fs-a01-b/databases/yudong/administrator_idx-01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=42 stamp=634789706 filename=/fs-a01-b/databases/yudong/replication-01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=43 stamp=634789706 filename=/fs-a01-a/databases/yudong/replication_idx-01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=44 stamp=634789706 filename=/fs-a01-a/databases/yudong/precise_or_tab-01.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=45 stamp=634789706 filename=/fs-a01-b/databases/yudong/system-02.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=46 stamp=634789706 filename=/fs-a01-a/databases/yudong/large_idx-02.dbf
datafile 11 switched to datafile copy
input datafilecopy recid=47 stamp=634789706 filename=/fs-a01-b/databases/yudong/system-03.dbf
datafile 12 switched to datafile copy
input datafilecopy recid=48 stamp=634789707 filename=/fs-a01-a/databases/yudong/large_idx-03.dbf
datafile 13 switched to datafile copy
input datafilecopy recid=49 stamp=634789707 filename=/fs-a01-a/databases/yudong/sysaux-02.dbf
datafile 14 switched to datafile copy
input datafilecopy recid=50 stamp=634789707 filename=/fs-a01-a/databases/yudong/administrator-02.dbf
datafile 15 switched to datafile copy
input datafilecopy recid=51 stamp=634789707 filename=/fs-a01-a/databases/yudong/zwf.dbf
datafile 16 switched to datafile copy
input datafilecopy recid=52 stamp=634789707 filename=/fs-a01-a/databases/yudong/zwf_new.dbf
datafile 17 switched to datafile copy
input datafilecopy recid=53 stamp=634789707 filename=/fs-a01-a/databases/yudong/large_idx-01.dbf
datafile 18 switched to datafile copy
input datafilecopy recid=54 stamp=634789707 filename=/fs-a01-a/databases/yudong/zwf_new_new.dbf
datafile 19 switched to datafile copy
input datafilecopy recid=55 stamp=634789707 filename=/fs-a01-a/databases/yudong/zwf_new_new_new.dbf
datafile 20 switched to datafile copy
input datafilecopy recid=56 stamp=634789707 filename=/fs-a01-a/databases/yudong/t_zwf.dbf

contents of Memory Script:
{
set until scn 260723155;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 01-OCT-07
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=858
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/opt/app/oracle/product/10.1.0.4/A04db/dbs/7mit7ehc_1_1 tag=FULLFORSTANDBY
channel ORA_AUX_DISK_1: restore complete
archive log filename=/arch-01/databases/yudong/redolog/-858-1-632058350.arc thread=1 sequence=858
channel clone_default: deleting archive log(s)
archive log filename=/arch-01/databases/yudong/redolog/-858-1-632058350.arc recid=1 stamp=634789708
media recovery complete
Finished recover at 01-OCT-07
Finished Duplicate Db at 01-OCT-07


oracle:weifengz.desktop.amazon.com: /opt/app/oracle> sqlplus "/as sysdba"

SQL*Plus: Release 10.1.0.4.0 - Production on Mon Oct 1 02:31:14 2007

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
858 NO
859 NO
860 NO
861 NO
862 NO
863 NO
864 NO
865 NO
866 NO
867 NO
868 NO

SEQUENCE# APP
---------- ---
869 NO
870 NO
871 NO
872 NO
873 NO
874 NO
875 NO
876 NO
877 NO

20 rows selected.

SQL> recover managed standby database disconnect;
Media recovery complete.
SQL> select process from v$managed_standby;

PROCESS
---------
ARCH
ARCH
RFS
MRP0

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP
---------- ---
858 YES
859 YES
860 YES
861 YES
862 YES
863 YES
864 YES
865 NO
866 NO
867 NO
868 NO

SEQUENCE# APP
---------- ---
869 NO
870 NO
871 NO
872 NO
873 NO
874 NO
875 NO
876 NO
877 NO

20 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
858 YES
859 YES
860 YES
861 YES
862 YES
863 YES
864 YES
865 YES
866 YES
867 YES
868 YES

SEQUENCE# APP
---------- ---
869 YES
870 YES
871 YES
872 YES
873 YES
874 YES
875 NO
876 NO
877 NO

20 rows selected.

SQL> /

SEQUENCE# APP
---------- ---
858 YES
859 YES
860 YES
861 YES
862 YES
863 YES
864 YES
865 YES
866 YES
867 YES
868 YES

SEQUENCE# APP
---------- ---
869 YES
870 YES
871 YES
872 YES
873 YES
874 YES
875 YES
876 YES
877 YES

20 rows selected.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242469/,如需轉載,請註明出處,否則將追究法律責任。

相關文章