Oracle 11g RMAN恢复-只读表空间的恢复(备份是在表空间只读状态下做的)

场景描述:
只读表空间的恢复(备份是在表空间只读状态下做的,而当前表空间为read/write,损坏)

--0.1 当前的备份是在mynewts表空间只读时做的,现在将表空间改为read/write

sys@TESTDB11>alter tablespace mynewts read write;

 

Tablespace altered.

 

--0.2 试验表空间已经可读写

scott@TESTDB11>delete from tab_mynewts where deptno = 40;

 

1 row deleted.

 

scott@TESTDB11>update tab_mynewts set dname = 'DNameC' where deptno = 30;

 

1 row updated.

 

scott@TESTDB11>commit;

 

Commit complete.

 

--0.3 表空间数据文件丢失

[oracle@S1011:/export/home/oracle]$ rm /oradata/mynewts01.dbf

[oracle@S1011:/export/home/oracle]$ ls /oradata/mynewts01.dbf

/oradata/mynewts01.dbf: No such file or directory

--0.4 发现数据文件丢失

sys@TESTDB11>alter system flush buffer_cache;

 

System altered.

scott@TESTDB11>select * from tab_mynewts;

select * from tab_mynewts

*

ERROR at line 1:

ORA-01116: error in opening database file 9

ORA-01110: data file 9: '/oradata/mynewts01.dbf'

ORA-27041: unable to open file

Solaris-AMD64 Error: 2: No such file or directory

Additional information: 3

--1. rman解决

RMAN> run {

2> sql 'alter database datafile 9 offline';    --1.1 使表空间脱机

3> restore datafile 9;                             --1.2 还原表空间

4> recover datafile 9;                             --1.3 恢复表空间(比场景5,多这一步)

5> sql 'alter database datafile 9 online';     --1.4 开库

6> }

 

sql statement: alter database datafile 9 offline

 

Starting restore at 15-AUG-13

using channel ORA_DISK_1

using channel ORA_DISK_2

 

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 00009 to /oradata/mynewts01.dbf

channel ORA_DISK_1: reading from backup piece /pooldisk02/backup03/4cohbbvc_1_1

channel ORA_DISK_1: piece handle=/pooldisk02/backup03/4cohbbvc_1_1 tag=TAG20130815T072116

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Finished restore at 15-AUG-13

 

Starting recover at 15-AUG-13

using channel ORA_DISK_1

using channel ORA_DISK_2

 

starting media recovery

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

 

Finished recover at 15-AUG-13

 

sql statement: alter database datafile 9 online

--2. 数据验证

scott@TESTDB11>select * from tab_mynewts;

 

    DEPTNO DNAME          LOC

---------- -------------- -------------

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 DNameC         CHICAGO

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17013648/viewspace-1155524/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/17013648/viewspace-1155524/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值