rman备份与恢复脚本

create table t1 (id number(2));

insert into t1 values(0);

commit;

--bak0

run {
   

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

sql 'alter system checkpoint';

sql 'alter system switch logfile';

sql 'alter system archive log current';

backup incremental level 0 database format '/home/oracle/backup/bak0/bak0_%U';

backup archivelog all format '/home/oracle/backup/bak0/bak0_arch_%U';

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

}

insert into t1 values(11);

commit;

create table t2 as select * from dba_objects;

--bak1_1

run {
   

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

sql 'alter system checkpoint';

sql 'alter system switch logfile';

sql 'alter system archive log current';

backup incremental level 1 database format '/home/oracle/backup/bak1_1/bak1_1_

%U';

backup archivelog all not backed up format

'/home/oracle/backup/bak1_1/bak1_1_arch_%U';

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

}

insert into t1 values(12);

commit;

insert into t2 select * from dba_objects;

commit;

create table t3 as select * from dba_objects;

--bak1_2

run {
   

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

sql 'alter system checkpoint';

sql 'alter system switch logfile';

sql 'alter system archive log current';

backup incremental level 2 database format '/home/oracle/backup/bak1_2/bak1_2_

%U';

backup archivelog all not backed up format

'/home/oracle/backup/bak1_2/bak1_2_arch_%U';

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

}

--0 恢复

SQL> shut immediate

SQL> startup nomount;

RMAN> restore controlfile from

'/home/oracle/backup/bak0/o1_mf_s_1048151743_hm3wb0fd_.bkp';

RMAN> alter database mount;

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 08/11/2020 17:48:46

ORA-01103: 控制文件中的数据库名 ''ORCL11GR'' 不是 ''ORCL''

create pfile='/home/oracle/init.ora' from spfile;

shut immediate

create spfile from pfile='/home/oracle/init.ora';

startup mount;

--使用 restore database validate 验证备份时也报

RMAN> restore database;

using channel ORA_DISK_1

RMAN-00571: ===========================================================

RMAN-00569: ============
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

A Master

您的鼓励是对我最大的支持

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值