直接透過備份恢復資料庫

zhangsharp20發表於2015-01-28

1、首先熱備份資料庫

alter tablespace SYSTEM begin backup;

! cp /u01/app/oracle/oradata/SAFE/system01.dbf /u02/backup/SAFE

alter tablespace SYSTEM end backup;

alter tablespace UNDOTBS1 begin backup;

! cp /u01/app/oracle/oradata/SAFE/undotbs01.dbf /u02/backup/SAFE

alter tablespace UNDOTBS1 end backup;

alter tablespace SYSAUX begin backup;

! cp /u01/app/oracle/oradata/SAFE/sysaux01.dbf /u02/backup/SAFE

alter tablespace SYSAUX end backup;

alter tablespace USERS begin backup;

! cp /u01/app/oracle/oradata/SAFE/users01.dbf /u02/backup/SAFE

alter tablespace USERS end backup;

alter database backup controlfile to '/u02/backup/SAFE/control01.dbf';

[oracle@zhang SAFE]$ ls

control01.ctl  sysaux01.dbf  system01.dbf  undotbs01.dbf  users01.dbf

2、模擬災難

[root@zhang\:/u01/app/oracle/oradata/SAFE]#rm *.dbf

3、轉儲檔案

 

alter database rename file '/u01/app/oracle/oradata/SAFE/system01.dbf' to '/u02/backup/SAFE/system01.dbf';

 

alter database rename file '/u01/app/oracle/oradata/SAFE/undotbs01.dbf' to '/u02/backup/SAFE/undotbs01.dbf';

 

alter database rename file '/u01/app/oracle/oradata/SAFE/sysaux01.dbf' to '/u02/backup/SAFE/sysaux01.dbf';

 

alter database rename file '/u01/app/oracle/oradata/SAFE/users01.dbf' to '/u02/backup/SAFE/users01.dbf';

4、恢復資料庫

SQL> recover database;

Media recovery complete.

5、開庫

SQL> alter database open;

 

Database altered.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29802484/viewspace-1418150/,如需轉載,請註明出處,否則將追究法律責任。

相關文章