ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN cases

RMAN cases

原创 Linux操作系统 作者:mambo_shen 时间:2009-07-27 12:02:48 0 删除 编辑

RMAN> backup database plus archivelog;

$ scp * hzdevdb2:/home/oracle/OraBase/flash_recovery_area/CFGDB/backupset/2009_07_24

 

$ export ORACLE_SID=cfgdb

$ rman target /

RMAN> set dbid 359504372

RMAN> startup nomount;

RMAN> restore spfile from '/home/oracle/OraBase/flash_recovery_area/CFGDB/backupset/2009_07_24/o1_mf_ncsnf_TAG20090724T113914_56m7cmcc_.bkp';

RMAN> startup force nomount;

RMAN>restore controlfile from '/home/oracle/OraBase/flash_recovery_area/CFGDB/backupset/2009_07_24/o1_mf_ncsnf_TAG20090724T113914_56m7cmcc_.bkp';

RMAN> alter database mount;

RMAN>  restore database;

RMAN>  recover database;

RMAN>  alter database open resetlogs;

 

$ export ORACLE_SID=cfgdb

SQL> startup nomount;

SQL> alter system reset control_files scope=spfile sid='*';
SQL> startup force nomount;

$ rman target sys/sys@devcfgdb  auxiliary /

RMAN> DUPLICATE TARGET DATABASE TO CFGDB;

 

删除表空间恢复

 

1:数据库在归档模式下运行,没有任何备份能恢复吗?
答:你有该表空间创建以来的所有归档日志,重新新建一个,否则没有办法。


2:在非归档模式下运行,能恢复吗?

SQL>create table wt_tb tablespace wt as select * from dba_objects;
SQL>alter database backup controlfile to trace;

RMAN> backup database;

SQL>alter database backup controlfile to trace;
SQL>drop tablespace wt including contents;

SQL>shutdown immediate;
SQL>startup;

 

要恢复被删除的表空间,一定要满足如下条件:
1:控制文件里有这些信息,我们上面已经做了;
2:数据字典里也要有相关信息,那么我们必须恢复system表空间,到未删除之前的状态;

 

#rm system01.dbf

SQL>startup mount;

RMAN> connect target
RMAN> restore datafile 1;

SQL>shutdown immediate;
SQL>startup nomount;
SQL>CREATE CONTROLFILE REUSE DATABASE "WTDB" RESETLOGS ARCHIVELOG

          ....................................;

SQL>select name,checkpoint_time from v$datafile;
NAME
-------------------------------------------------------------------------------------------------------
-----------------------------------------------
CHECKPOINT_TIME
-------------------
/disk2/oradata/wtdb/system01.dbf
2008-09-02 09:11:57
/disk2/oradata/wtdb/undotbs01.dbf
2008-09-02 09:13:10
/disk2/oradata/wtdb/donny.dbf
2008-09-02 09:13:10
/disk2/oradata/wtdb/wtdb01.dbf
2008-09-02 09:12:57

 

SQL>alter database open resetlogs;

 

SQL>select name,checkpoint_time from v$datafile;
NAME
-------------------------------------------------------------------------------------------------------
-----------------------------------------------
CHECKPOINT_TIME
-------------------
/disk2/oradata/wtdb/system01.dbf
2008-09-02 09:25:16
/disk2/oradata/wtdb/undotbs01.dbf
2008-09-02 09:25:16/disk2/oradata/wtdb/donny.dbf
2008-09-02 09:25:16
/disk2/oradata/wtdb/wtdb01.dbf
2008-09-02 09:25:16

 

SQL>select count(*) from wt_tb;
COUNT(*)
----------
6164

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

上一篇: RMAN recover
下一篇: PDG
请登录后发表评论 登录
全部评论

注册时间:2008-10-09

  • 博文量
    86
  • 访问量
    74071