12C的PDB使用RMAN不完全恢复drop user场景


模拟故障

SQL> alter session set container=pdb4;
Session altered.

SQL> select systimestamp from dual;
SYSTIMESTAMP
---------------------------------------------------------------------------
11-JUN-17 10.32.42.670589 PM +08:00

SQL> drop user test cascade;
User dropped.

恢复

RMAN> run
2> {
3> set until time "to_date('2017-06-11 22:32:42','YYYY-MM-DD HH24:MI:SS')";
4> restore pluggable database pdb4;
5> recover pluggable database pdb4;
6> }

executing command: SET until clause

Starting restore at 11-JUN-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 device type=DISK

creating datafile file number=41 name=/u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/11/2017 22:39:06
ORA-01182: cannot create database file 41 - file is in use or recovery
ORA-01110: data file 41: '/u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf'

需要关闭PDB

SQL> conn / as sysdba
Connected.
SQL> alter pluggable database pdb4 close;
Pluggable database altered.

SQL> show pdbs;
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 SEED_PDB                       MOUNTED
         4 NONCDB_PDP                     MOUNTED
         5 CLON_PDB                       MOUNTED
         6 TEST_PDB                       READ WRITE NO
         7 PDB4                           MOUNTED

再次恢复

RMAN> run
2> {
3> set until time "to_date('2017-06-11 22:32:42','YYYY-MM-DD HH24:MI:SS')";
4> restore pluggable database pdb4;
5> recover pluggable database pdb4;
6> }

executing command: SET until clause

Starting restore at 11-JUN-17
using channel ORA_DISK_1

creating datafile file number=41 name=/u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf
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 00038 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf
channel ORA_DISK_1: restoring datafile 00039 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00040 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/12.2.0/db_1/dbs/06s6i7hv_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/12.2.0/db_1/dbs/06s6i7hv_1_1 tag=TAG20170611T202849
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 11-JUN-17

Starting recover at 11-JUN-17
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/11/2017 22:41:19
RMAN-05107: AUXILIARY DESTINATION option is not specified

需要指定AUXILIARY DESTINATION

RMAN> run
2> {
3> set until time "to_date('2017-06-11 22:30:42','YYYY-MM-DD HH24:MI:SS')";
4> restore pluggable database pdb4;
5> recover pluggable database pdb4  AUXILIARY DESTINATION '/tmp';
6> }

executing command: SET until clause

Starting restore at 11-JUN-17
using channel ORA_DISK_1

creating datafile file number=41 name=/u01/app/oracle/oradata/zylong/pdb4/pdb4/users01.dbf
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 00038 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/system01.dbf
channel ORA_DISK_1: restoring datafile 00039 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00040 to /u01/app/oracle/oradata/zylong/pdb4/pdb4/undotbs01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/12.2.0/db_1/dbs/06s6i7hv_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/12.2.0/db_1/dbs/06s6i7hv_1_1 tag=TAG20170611T202849
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 11-JUN-17

Starting recover at 11-JUN-17
using channel ORA_DISK_1


starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 11-JUN-17

启动PDB测试

RMAN> Alter pluggable database pdb4 open resetlogs;
Statement processed
测试
SQL> conn test/oracle@192.168.16.81:1521/pdb4
Connected.
SQL> select count(*) from test;
  COUNT(*)
----------
       396

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值