测试:
oracle源实例 SID=ORCL
oracle 目标实例 SID=YOYO
目标恢实例 SID=orcl 的数据库到SID=yoyo中
--源实例操作
1. backup format='/home/oracle/bak/full_%d_%T_%s' database include current controlfile plus archivelog;
查看源实例SID=ORCL备份历史:
RMAN> list backup summary;
using target database control file instead of recovery catalog
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
1 B A A DISK 20-JUN-20 1 1 NO TAG20200620T112823
2 B F A DISK 20-JUN-20 1 1 NO TAG20200620T112824
3 B F A DISK 20-JUN-20 1 1 NO TAG20200620T112824
4 B A A DISK 20-JUN-20 1 1 NO TAG20200620T112905
2.目前源实例SID=ORCL中的tb1只有2行数据库,最新的redolog的SEQUENCE是11,最新的archivelog的SEQUENCE是10:
SQL> select * from tb1;
ID NAME
---------- --------------------------------------------------------------------------------
1 yo1
2 yo2
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
1 1 10 52428800 512 1 YES INACTIVE 1627592 20-JUN-20 1627647 20-JUN-20 0
2 1 11 52428800 512 1 NO CURRENT 1627647 20-JUN-20 2.8147E+14 0
3 1 9 52428800 512 1 YES INACTIVE 1624541 20-JUN-20 1627592 20-JUN-20 0
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 9
Next log sequence to archive 11
Current log sequence 11
SQL> select SEQUENCE#,NAME,FIRST_CHANGE#,NEXT_CHANGE#,STATUS,COMPLETION_TIME,DELETED,ARCHIVED from v$archived_log order by SEQUENCE# desc;
SEQUENCE# NAME FIRST_CHANGE# NEXT_CHANGE# S COMPLETIO DEL ARC
---------- -------------------------------------------------------------------------------- ------------- ------------ - --------- --- ---
10 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_10_hgwbt0r 1627592 1627647 A 20-JUN-20 NO YES
l_.arc
9 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_9_hgwbrprn 1624541 1627592 A 20-JUN-20 NO YES
_.arc
8 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_8_hgw866bo 1624444 1624541 A 20-JUN-20 NO YES
_.arc
7 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_7_hgw81x8x 1624439 1624444 A 20-JUN-20 NO YES
_.arc
SEQUENCE# NAME FIRST_CHANGE# NEXT_CHANGE# S COMPLETIO DEL ARC
---------- -------------------------------------------------------------------------------- ------------- ------------ - --------- --- ---
6 /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_06_20/o1_mf_1_6_hgw81rq6 1618275 1624439 A 20-JUN-20 NO YES
_.arc
3.现在往tb1表继续添加2行数据,commit后,多次switchlog,并且archive log
alter system archive log current;
alter system switch logfile;
select * from v$log;
select SEQUENCE#,NAME,FIRST_CHANGE#,NEXT_CHANGE#,STATUS,COMPLETION_TIME,DELETED,ARCHIVED from v$archived_log order by SEQUENCE# desc;
archive log list;
SQL> insert into tb1 values(3,'yo3');
1 row created.
SQL> insert into tb1 values(33,'yo33');
1 row created.
SQL> select * from tb1;
ID NAME
---------- --------------------------------------------------------------------------------
1 yo1
2 yo2
3 yo3
33 yo33
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
1 1 10 52428800 512 1 YES INACTIVE 1627592 20-JUN-20 1627647 20-JUN-20 0
2 1 11 52428800 512 1 NO CURRENT 1627647 20-JUN-20 2.8147E+14 0
3 1 9 52428800 512 1 YES INACTIVE