五:将备库的备份数据复制到主库,并使用catalog命令注册到主库的控制文件中
- [Oracle@db2 ~]$ scp test01_03novc2b_1_1 db1:/home/oracle/
- [oracle@db1 ~]$ rman target /
- Recovery Manager: Release 11.2.0.3.0 - Production on Mon Oct 29 11:45:02 2012
- Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
- connected to target database: DB1 (DBID=1387827106, not open)
- RMAN> list backup of tablespace test01;
- specification does not match any backup in the repository
- RMAN> catalog backuppiece '/home/oracle/test01_03novc2b_1_1';
- cataloged backup piece
- backup piece handle=/home/oracle/test01_03novc2b_1_1 RECID=42 STAMP=797946436
- RMAN> list backup of tablespace test01;
- List of Backup Sets
- ===================
- BS Key Type LV Size Device Type Elapsed Time Completion Time
- ------- ---- -- ---------- ----------- ------------ -------------------
- 42 Full 3.98M DISK 00:00:00 2012-10-29-11:38:51
- BP Key: 42 Status: AVAILABLE Compressed: NO Tag: TAG20121029T113851
- Piece Name: /home/oracle/test01_03novc2b_1_1
- List of Datafiles in backup set 42
- File LV Type Ckp SCN Ckp Time Name
- ---- -- ---- ---------- ------------------- ----
- 34 Full 10350465 2012-10-29-11:35:32 /u01/app/oracle/oradata/db1/test01.dbf
六:还原和恢复表空间test01,并将主库启动到读写状态,测试主备库数据实时同步情况
- RMAN> restore tablespace test01;
- Starting restore at 2012-10-29-11:47:50
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=21 device type=DISK
- channel ORA_DISK_1: starting datafile backup set restore
- channel ORA_DISK_1: specifying datafile(s) to restore from backup set
- channel ORA_DISK_1: restoring datafile 00034 to /u01/app/oracle/oradata/db1/test01.dbf
- channel ORA_DISK_1: reading from backup piece /home/oracle/test01_03novc2b_1_1
- channel ORA_DISK_1: piece handle=/home/oracle/test01_03novc2b_1_1 tag=TAG20121029T113851
- channel ORA_DISK_1: restored backup piece 1
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
- Finished restore at 2012-10-29-11:47:52
- RMAN> recover tablespace test01;
- Starting recover at 2012-10-29-11:48:02
- using channel ORA_DISK_1
- starting media recovery
- media recovery complete, elapsed time: 00:00:01
- Finished recover at 2012-10-29-11:48:03
- RMAN> alter database open;
- database opened
- [oracle@db1 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:48:47 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected.
- SQL> truncate table rman;
- Table truncated.
- [oracle@db2 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Mon Oct 29 11:49:12 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected.
- SQL> select count(*) from rman;
- COUNT(*)
- ----------
- 0
