oracle基於scn的不完全恢復
下面做一個實驗,使用scn進行不完全恢復(做之前要確保資料庫有有效備份):
首先在hh使用者下建立一張表h2,在表中插入資料:
SQL> create table h2(id int);
Table created.
SQL> insert into h2 values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> insert into h2 values(2);
1 row created.
SQL> select * from h2;
ID
----------
1
2
然後記錄下此時的scn:
SQL> conn /as sysdba
Connected.
SQL> select dbms_flashback.get_system_change_number scn from dual;
SCN
----------
850798
接著刪除表h2:
SQL> conn hh/hh
Connected.
SQL> drop table h2;
Table dropped.
現在使用rman將資料庫恢復到h2被刪除之前:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
首先在hh使用者下建立一張表h2,在表中插入資料:
SQL> create table h2(id int);
Table created.
SQL> insert into h2 values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> insert into h2 values(2);
1 row created.
SQL> select * from h2;
ID
----------
1
2
然後記錄下此時的scn:
SQL> conn /as sysdba
Connected.
SCN
----------
850798
SQL> conn hh/hh
Connected.
SQL> drop table h2;
Table dropped.
現在使用rman將資料庫恢復到h2被刪除之前:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@localhost ~]$ rman target / nocatalog
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Aug 22 23:49:41 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 553651792 bytes
Database Buffers 289406976 bytes
Redo Buffers 5132288 bytes
RMAN> restore database until scn 850798
2> ;
Starting restore at 22-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
skipping datafile 6; already restored to file /u01/app/datafile/test01.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0lpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0lpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/orcl/hh01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0kpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0kpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0jpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0jpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 22-AUG-14
RMAN> recover database until scn 850798
2> ;
Starting recover at 22-AUG-14
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 11 is already on disk as file /u01/app/archivelog/dest1/1_11_856205535.dbf
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/archivelog/dest1/1_1_856304357.dbf
archived log for thread 1 with sequence 2 is already on disk as file /u01/app/archivelog/dest1/1_2_856304357.dbf
archived log file name=/u01/app/archivelog/dest1/1_11_856205535.dbf thread=1 sequence=11
media recovery complete, elapsed time: 00:00:03
Finished recover at 22-AUG-14
使用resetlogs開啟資料庫:
SQL> alter database open resetlogs;
Database altered.
SQL> select * from hh.h2;
ID
----------
1
2
表h2已經回來了。
Recovery Manager: Release 11.2.0.1.0 - Production on Fri Aug 22 23:49:41 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 553651792 bytes
Database Buffers 289406976 bytes
Redo Buffers 5132288 bytes
2> ;
Starting restore at 22-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
skipping datafile 6; already restored to file /u01/app/datafile/test01.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0lpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0lpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/orcl/hh01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0kpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0kpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/fulldb_0jpgkfcr_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/fulldb_0jpgkfcr_1_1 tag=FULLDB
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 22-AUG-14
RMAN> recover database until scn 850798
2> ;
Starting recover at 22-AUG-14
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 11 is already on disk as file /u01/app/archivelog/dest1/1_11_856205535.dbf
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/archivelog/dest1/1_1_856304357.dbf
archived log for thread 1 with sequence 2 is already on disk as file /u01/app/archivelog/dest1/1_2_856304357.dbf
archived log file name=/u01/app/archivelog/dest1/1_11_856205535.dbf thread=1 sequence=11
media recovery complete, elapsed time: 00:00:03
Finished recover at 22-AUG-14
使用resetlogs開啟資料庫:
SQL> alter database open resetlogs;
Database altered.
SQL> select * from hh.h2;
ID
----------
1
2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29800581/viewspace-1256476/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle基於SCN增量恢復Oracle
- 小記基於控制檔案的scn不完全恢復
- Oracle 11g 主動選擇的不完全恢復,基於SCN的,DML操作Oracle
- 使用RMAN的不完全恢復-基於時間/SCN/日誌序列
- oracle基於時間點的不完全恢復Oracle
- oracle 基於使用者管理的不完全恢復Oracle
- Oracle 基於 RMAN 的不完全恢復(incomplete recovery by RMAN)Oracle
- ORACLE資料庫基於時間點的不完全恢復Oracle資料庫
- 12C針對cdb全備與 PDB執行不完全恢復(基於SCN)
- Oracle 不完全恢復Oracle
- ORACLE 恢復中SCN的應用Oracle
- dataguard 歸檔丟失,備庫基於SCN恢復
- 備份與恢復:用user模式基於日誌序列的不完全恢復模式
- 備份與恢復:用rman方式基於日誌序列的不完全恢復
- Oracle 12c PDB基於時間點的不完全恢復記錄Oracle
- 恢復到特定點(時間點、scn、日誌序列號),rman不完全恢復
- oracle實驗記錄 (恢復-不完全恢復)Oracle
- BBED 修改oracle 資料檔案的 SCN 號來做資料庫不完全恢復。Oracle資料庫
- 在oracle10g 10.2.0.1上測試不完全恢復_recover database until scnOracleDatabase
- Oracle基於時間點的恢復Oracle
- Oracle 11g 主動選擇的不完全恢復,基於時間,DDL操作Oracle
- oracle資料庫不完全恢復Oracle資料庫
- 基於時間執行資料庫不完全恢復資料庫
- Oracle Rman 資料庫的不完全恢復Oracle資料庫
- oracle 閃回基於時間的恢復Oracle
- Oracle 11g 手工不完全恢復Oracle
- oracle scn與備份恢復backup recovery(一)Oracle
- 關於不完全恢復的一些思考
- Oracle 11g 手工不完全恢復 場景1:被動的不完全恢復(日誌缺失)Oracle
- 記錄一次ORACLE的不完全恢復Oracle
- [裝載]oracle 無歸檔的不完全恢復Oracle
- 【Mysql】完全恢復與不完全恢復MySql
- SCN號與oracle資料庫恢復的關係Oracle資料庫
- oracle實驗記錄 (恢復-rman基於控制檔案的恢復)Oracle
- 【備份與恢復】控制檔案的恢復(不完全恢復)
- oracle基於歸檔的增量異地恢復Oracle
- Oracle SCN機制———在備份與恢復中Oracle
- SCN、Checkpoint、例項恢復介質恢復理解