ITPub博客

首页 > 数据库 > Oracle > 使用RMAN实现灾难恢复测试

使用RMAN实现灾难恢复测试

原创 Oracle 作者:fanhongjie 时间:2007-05-28 09:05:58 0 删除 编辑

[@more@]

假设某天数据库服务器操作系统级故障,导致数据库宕机。

实现恢复步骤如下:在测试的数据库test下创建一张表,并在表中添加几条记录,commit;然后alter system switch logfile;可以多执行几次。

配置RMAN恢复目录:

第一步,在目录数据库中创建恢复目录所用表空间:

SQL> create tablespace rman_ts datafile 'd:oracleoradatarmanrman_ts.dbf' size 20M;

表空间已创建。

第二步,在目录数据库中创建RMAN 用户并授权:

SQL> create user rman identified by rman default tablespace rman_ts temporary tablespace temp quota unlimited on rman_ts;

SQL> grant recovery_catalog_owner to rman ;

授权成功。

SQL> grant connect, resource to rman ;

授权成功。

第三步,在目录数据库中创建恢复目录

C:>rman catalog rman/rman

恢复管理器:版本8.1.6.0.0 - Production

RMAN-06008:连接到恢复目录数据库

RMAN-06428:未安装恢复目录

RMAN>create catalog tablespace rman_ts;

RMAN-06431:恢复目录已创建

第四步,注册目标数据库

c:>rman catalog rman/rman@rman target sys/manager@test

RMAN> register database;

配置controlfile的自动备份

第五步,完全备份目标数据库:

c:>rman catalog rman/rman@rman target sys/manager@test

rman〉backup incremental level 0 maxsetsize 4g database;

rman〉sql 'alter system switch logfile';

删除目标数据库test;

重新创建目标数据库test;

关闭目标数据库 sql〉shutdown immediate;

加载目标数据库sql〉startup nomount;

使用rman恢复目标数据库,不完全恢复,重做日志中的数据丢失。

c:>rman catalog rman/rman@rman target sys/manager@test

rman〉restore spfile to 'c:oracleSPFILETEST.ora' from autobackup; --然后copy到spfile原来的路径下

在目标数据库上重建pwdtest.ora文件


c:>orapwd file=C:oracleora92databasePWDtest.ora password=passwdsa entries=10;

重新启动数据库到mount状态;

在rman数据库上执行

c:>rman catalog rman/rman@rman target sys/manager@test

rman〉restore controlfile to 'C:oracleoradatatestcontrol01.ctl' from autobackup;

rman〉restore controlfile to 'C:oracleoradatatestcontrol02.ctl' from autobackup;

rman〉restore controlfile to 'C:oracleoradatatestcontrol03.ctl' from autobackup;

rman〉restore database;

rman>recover database;

rman>alter database open resetlogs;

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

请登录后发表评论 登录
全部评论

注册时间:2008-05-22

  • 博文量
    111
  • 访问量
    685243