1.使用 28号控制文件,恢复29号的数据文件.
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2316_1_934419516';
release channel ch00;
}
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
restore database until time "TO_DATE('2017-01-29 12:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-01-29 12:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
成功
2.使用 29 号控制文件,恢复28号数据文件
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2325_1_934586046';
release channel ch00;
}
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx.cn,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
restore database until time "TO_DATE('2017-01-28 12:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-01-28 12:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
成功
3. 主库添加数据文件,发起备份, 采用28号控制文件,恢复2月13号数据文件
SQL> alter tablespace users add datafile '+DATAC1/fcfbom/datafile/users02.dbf' size 20G autoextend off;
Tablespace altered.
此时控制文件已改变
[root@xx scripts]# ./hot_database_backup_fcfbom.sh
发起NBU备份
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2325_1_934586046';
release channel ch00;
}
依然采用29号的控制文件
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
set newname for datafile 8 to '/oradata/fcfbom/users021.dbf';
restore database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
数据库恢复到2月13号早9点,需要注意文件8的设置
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch command at 02/12/2017 18:32:11
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20230: datafile copy not found in the repository
RMAN-06015: error while looking up datafile copy name: /oradata/fcfbom/users021.dbf
恢复报错
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 8 to '/oradata/fcfbom/users021.dbf';
restore datafile 8;
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
单独恢复datafile 8
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
恢复成功,可见,控制文件,在nbu恢复中,不是最重要的
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2316_1_934419516';
release channel ch00;
}
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
restore database until time "TO_DATE('2017-01-29 12:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-01-29 12:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
成功
2.使用 29 号控制文件,恢复28号数据文件
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2325_1_934586046';
release channel ch00;
}
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx.cn,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
restore database until time "TO_DATE('2017-01-28 12:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-01-28 12:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
成功
3. 主库添加数据文件,发起备份, 采用28号控制文件,恢复2月13号数据文件
SQL> alter tablespace users add datafile '+DATAC1/fcfbom/datafile/users02.dbf' size 20G autoextend off;
Tablespace altered.
此时控制文件已改变
[root@xx scripts]# ./hot_database_backup_fcfbom.sh
发起NBU备份
run
{
allocate channel ch00 type 'SBT_TAPE' ;
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore controlfile from 'cntrl_2325_1_934586046';
release channel ch00;
}
依然采用29号的控制文件
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 7 to '/oradata/fcfbom/users.3185.930147467';
set newname for datafile 1 to '/oradata/fcfbom/system.2967.905593955';
set newname for datafile 2 to '/oradata/fcfbom/sysaux.2845.905593963';
set newname for datafile 3 to '/oradata/fcfbom/undotbs1.3417.905593965';
set newname for datafile 4 to '/oradata/fcfbom/undotbs2.1162.905593977';
set newname for datafile 5 to '/oradata/fcfbom/users.1167.905593981';
set newname for datafile 6 to '/oradata/fcfbom/fbom_data.dbf';
set newname for datafile 8 to '/oradata/fcfbom/users021.dbf';
restore database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
数据库恢复到2月13号早9点,需要注意文件8的设置
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch command at 02/12/2017 18:32:11
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20230: datafile copy not found in the repository
RMAN-06015: error while looking up datafile copy name: /oradata/fcfbom/users021.dbf
恢复报错
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
set newname for datafile 8 to '/oradata/fcfbom/users021.dbf';
restore datafile 8;
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
单独恢复datafile 8
run
{
allocate channel ch00 type 'SBT_TAPE';
allocate channel ch01 type 'SBT_TAPE';
allocate channel ch02 type 'SBT_TAPE';
allocate channel ch03 type 'SBT_TAPE';
allocate channel ch04 type 'SBT_TAPE';
allocate channel ch05 type 'SBT_TAPE';
allocate channel ch06 type 'SBT_TAPE';
allocate channel ch07 type 'SBT_TAPE';
allocate channel ch08 type 'SBT_TAPE';
allocate channel ch09 type 'SBT_TAPE';
allocate channel ch10 type 'SBT_TAPE';
allocate channel ch11 type 'SBT_TAPE';
allocate channel ch12 type 'SBT_TAPE';
allocate channel ch13 type 'SBT_TAPE';
SEND 'NB_ORA_CLIENT=xx,NB_ORA_SERV=nbumaster,NB_ORA_POLICY=xx,NB_ORA_SCHED=default-FCFBOM';
restore database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
recover database until time "TO_DATE('2017-02-13 9:00:00','YYYY-MM-DD HH24:MI:SS')";
switch datafile all;
release channel ch00;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
release channel ch09;
release channel ch10;
release channel ch11;
release channel ch12;
release channel ch13;
}
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
恢复成功,可见,控制文件,在nbu恢复中,不是最重要的
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7569309/viewspace-2133443/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7569309/viewspace-2133443/