oracle 备份恢复实验

Oracle备份恢复实验
    Oracle备份恢复实验,演示几种情况下恢复,并附带实验步骤


1.数据文件丢失

环境:ip:172.17.122.53
           数据文件为 /u01/oradata/WILLSON/test.dmp

           对应表空间test

           对应表 wilson.table_test1

1.查询表当前信息
SQL> select * from wilson.table_test1;


        ID NAME
---------- --------------------
         1 zhuwei
         2 wangwei


2.rman做库全备
backup database format '/temp/rman1359.rc';

3.添加数据
insert into wilson.table_test1 values(3,'tianyuan');
commit;
insert into wilson.table_test1 values(4,'yichao');

4.删除表对应数据文件模拟灾难
[oracle@localhost WILLSON]$ ls /u01/oradata/WILLSON/ | grep test
test.dmp
[oracle@localhost WILLSON]$ rm -f test.dmp

5.做检查点checkpoint(要不内存中还会预留),查询数据发生错误
alter system checkpoint;

SQL> select * from table_test1;
select * from table_test1
              *
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01110: data file 5: '/u01/oradata/WILLSON/test.dmp'

6.将表空间对应数据文件offline
alter database datafile 5 offline;

7.restore & recover datafile
restore datafile 5;
recover datafile 5;

8.online datafile;
alter database datafile 5 online;

SQL> select * from table_test1;


        ID NAME
---------- --------------------
         1 zhuwei
         2 wangwei
         3 tianyuan
         4 yichao

2.控制文件丢失
单个数据文件丢失,只需将其他复制一份就行
下面模拟全部控制文件丢失

1.备份全库
backup database format '/temp/rman1359.rc';

2.删除所有controlfile模拟灾难
rm -f control*

3.rman 登录出现问题
[oracle@localhost WILLSON]$ rman target /


Recovery Manager: Release 10.2.0.1.0 - Production on Wed Nov 7 01:52:36 2012


Copyright (c) 1982, 2005, Oracle.  All rights reserved.


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-06003: ORACLE error from target database: 
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oradata/WILLSON/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

4.关闭数据库,启动到nomount状态
shutdown abort
startup nomount

5.rman恢复
 restore controlfile from 'E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\MOOD\BACKUPSET\2011_02_18\O1_MF_NCNNF_TAG20110218T095458_6OVNCM4W_.BKP';

6.开启数据库,启动到mount状态
alter database mount;

7.介质恢复

recover database using backup controlfile;


8.开打数据库

alter database open resetlogs;


3.online redologfile 丢失
这里可以参考兜兜一篇文章将的很详细
传送门:http://blog.csdn.net/lovehewenyu/article/details/7759314

你可能感兴趣的:(oracle 备份恢复实验)