遗失的星空

导航

【Wonder原创】RMAN实践一--DB数据同步

背景说明:

VM:Linux-wonder这台机安装完Oracle,创建了一个名字为TEST的DB,然后Clone成另外一台机 Linux-DG

在linux-wonder 这台机的DB上做了一些操作,新建了表空间、用户,以及插入了一些数据后,想直接把TEST这个DB,更新到 Linux-DG这台机的TEST这个DB

以下为实践记录:

linux-wonder这台机上做备份等操作:

1、RMAN备份
RMAN> backup database format '/u01/app/oracle/backup/full/full%u_%s_%p' plus archivelog format '/u01/app/oracle/backup/full/arv%u_%s_%p' delete input;

备份得到如下文件:

/u01/app/oracle/backup/full/arv0blnb88l_11_1
/u01/app/oracle/backup/full/arv0dlnb8bn_13_1
/u01/app/oracle/backup/full/full0clnb88n_12_1
/u01/app/oracle/flash_recovery_area/TEST/autobackup/2010_09_07/o1_mf_s_729129337_68dr3tjl_.bkp

2、传送文件到 linux-DG这台机,以下在 oracle 系统用户下操作

cd /u01/app/oracle/backup/full

scp arv0blnb88l_11_1 arv0dlnb8bn_13_1 full0clnb88n_12_1 oracle@10.91.53.162:/u01/app/oracle/rmanbak

cd /u01/app/oracle/flash_recovery_area/TEST/autobackup/2010_09_07
scp o1_mf_s_729129337_68dr3tjl_.bkp oracle@10.91.53.162:/u01/app/oracle/rmanbak

cd /u01/app/oracle/oradata/TEST
scp redo0[1-3].log oracle@10.91.53.162:/u01/app/oracle/oradata/TEST

linux-DG这台机上的操作:

3、恢复Control file

SQL> shutdown immediate;
SQL> startup nomount;
RMAN> restore controlfile from '/u01/app/oracle/rmanbak/o1_mf_s_729129337_68dr3tjl_.bkp';

4、恢复数据

SQL> alter database mount;
RMAN> catalog start with '/u01/app/oracle/rmanbak/arv0blnb88l_11_1';
RMAN> catalog start with '/u01/app/oracle/rmanbak/arv0dlnb8bn_13_1' ;
RMAN> catalog start with '/u01/app/oracle/rmanbak/full0clnb88n_12_1';
RMAN> catalog start with '/u01/app/oracle/rmanbak/o1_mf_s_729129337_68dr3tjl_.bkp';

RMAN> list backup; 【查看是否能找到RMAN备份记录】
RMAN> restore database;
RMAN> restore archivelog all; 【手动恢复日志】

【以下可能需要多试几次,分别使用redo01.log redo02.log redo03.log】

SQL> recover database using backup controlfile until cancel;
输入:/u01/app/oracle/oradata/TEST/redo01.log

【以下可能需要多试几次,分别使用redo01.log redo02.log redo03.log】

SQL> recover database using backup controlfile;
输入:/u01/app/oracle/oradata/TEST/redo01.log

SQL> alter database open resetlogs;

posted on 2010-09-10 08:47  遗失的星空  阅读(361)  评论(0编辑  收藏  举报