首页 > 数据库 > 数据库开发技术 > 冷备份 + 归档 基于时间恢复
在看热备利用归档来进行数据库恢复的时候,想到冷备份是否也可以用归档来进行恢复,测试了一下,结果是可以的!
[@more@]-- Date Before Backing up
SYS@HUIYI>select name,log_mode from v$database; NAME LOG_MODE ------------------ ------------------------ HUIYI ARCHIVELOG SYS@HUIYI>create table t 2 ( 3 col date 4 ) 5 tablespace tbs01 6 / Table created. SYS@HUIYI>insert into t values(sysdate); 1 row created. SYS@HUIYI>commit; Commit complete. SYS@HUIYI>select * from t; COL ------------------ 16-Mar-07 10:17:27
-- cold Backup SYS@HUIYI>@cold_backup -- Insert Recover Date
SYS@HUIYI>insert into t values(sysdate); 1 row created. SYS@HUIYI>commit; Commit complete. SYS@HUIYI>select * from t; COL ------------------ 16-Mar-07 10:17:27 16-Mar-07 10:28:26
-- drop Tablespace and Archive LogFile
SYS@HUIYI>drop tablespace tbs01 including contents and datafiles; Tablespace dropped. SYS@HUIYI>alter system switch logfile; System altered. SYS@HUIYI>/ System altered. SYS@HUIYI>/ System altered.
-- alert.log Informat
Fri Mar 16 10:29:11 2007 drop tablespace tbs01 including contents and datafiles Fri Mar 16 10:29:13 2007 Deleted file G:A9IORADATAHUIYITBS01_B.DBF Completed: drop tablespace tbs01 including contents and dataf
-- Restore and Revoery
SYS@HUIYI>shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SYS@HUIYI>host copy g:bbackupcold*.dbf %oracle_home%oradatahuiyi SYS@HUIYI>host copy g:bbackupcold*.ctl %oracle_home%oradatahuiyi SYS@HUIYI>startup ORACLE instance started. Total System Global Area 143727516 bytes Fixed Size 453532 bytes Variable Size 109051904 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted. ORA-00338: log 1 of thread 1 is more recent than controlfile ORA-00312: online log 1 thread 1: 'G:A9IORADATAHUIYIREDO01.LOG' SYS@HUIYI>recover database using backup controlfile until time '2007-03-16 10:29:11'; ORA-00279: change 486741144 generated at 03/16/2007 10:18:10 needed for thread 1 ORA-00289: suggestion : D:ARCHIVELOGHUIYIARC00001.001 ORA-00280: change 486741144 for thread 1 is in sequence #1 Specify log: {=suggested | filename | AUTO | CANCEL} auto Log applied. Media recovery complete. SYS@HUIYI>alter database open resetlogs; Database altered. SYS@HUIYI>select * from t; COL ------------------ 16-Mar-07 10:17:27 16-Mar-07 10:28:26
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8799875/viewspace-905402/ ,如需转载,请注明出处,否则将追究法律责任。