Oracle RMAN完全恢复案例(五)

案例5:

--新建表空间没有备份,datafile 被破坏

1)测试环境

07:52:16 SQL> create tablespace lx

07:52:24   2   datafile '/u01/app/oracle/oradata/prod/lx01.dbf' size 10m;

Tablespace created.

07:52:38 SQL> conn scott/tiger

Connected.

07:52:40 SQL>

07:52:40 SQL> create table lx01 (id int) tablespace lx;

Table created.

07:52:49 SQL> insert into lx01 values (1);

1 row created.

07:52:55 SQL> insert into lx01 values (2);

1 row created.

07:52:57 SQL> insert into lx01 values (3);

1 row created.

07:52:59 SQL> commit;

Commit complete.

07:53:00 SQL> select * from lx01;

ID

----------

1

2

3

07:53:03 SQL>

07:53:03 SQL> conn /as sysdba

Connected.

07:53:16 SQL>

07:53:16 SQL> shutdown abort

ORACLE instance shut down.

07:53:19 SQL>

[oracle@work ~]$ rm /u01/app/oracle/oradata/prod/lx01.dbf


2)启动database

07:53:19 SQL> startup

ORACLE instance started.

Total System Global Area  314572800 bytes

Fixed Size                  1219184 bytes

Variable Size              79693200 bytes

Database Buffers          230686720 bytes

Redo Buffers                2973696 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 10 - see DBWR trace file

ORA-01110: data file 10: '/u01/app/oracle/oradata/prod/lx01.dbf'

07:54:15 SQL> select file#,error from v$recover_file;

FILE# ERROR

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

10 FILE NOT FOUND

07:54:25 SQL>


3)利用rman 恢复

RMAN> run {

2> sql 'alter database datafile 10 offline';

3> alter database open;

4> restore datafile 10;

5> recover datafile 10;

6> sql'alter database datafile 10 online';

7> }

using target database control file instead of recovery catalog

sql statement: alter database datafile 10 offline

database opened

Starting restore at 18-AUG-11

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=154 devtype=DISK

creating datafile fno=10 name=/u01/app/oracle/oradata/prod/lx01.dbf    ;自动建立新的lx01.dbf 文件

restore not done; all files readonly, offline, or already restored

Finished restore at 18-AUG-11

Starting recover at 18-AUG-11

using channel ORA_DISK_1

starting media recovery

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

Finished recover at 18-AUG-11

sql statement: alter database datafile 10 online

RMAN>


oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html


你可能感兴趣的:(oracle,oracle,oracle,oracle,rman,RMAN完全恢复案例,RMAN完全恢复)