oracle實驗記錄 (恢復-關於控制檔案(2))
接1 實驗create controlfile
SQL> create tablespace test datafile 'd:\test.dbf' reuse;
表空間已建立。
SQL> select tablespace_name,file_name from dba_data_files;
TABLESPACE_NAME FILE_NAME
------------------------------ ------------------------------
TEST D:\TEST.DBF
EXAMPLE E:\ORACLE\PRODUCT\10.2.0\ORADA
TA\ORCL\EXAMPLE01.DBF
USERS E:\ORACLE\PRODUCT\10.2.0\ORADA
TA\ORCL\USERS01.DBF
SYSAUX E:\ORACLE\PRODUCT\10.2.0\ORADA
TA\ORCL\SYSAUX01.DBF
UNDOTBS1 E:\ORACLE\PRODUCT\10.2.0\ORADA
TABLESPACE_NAME FILE_NAME
------------------------------ ------------------------------
TA\ORCL\UNDOTBS01.DBF
SYSTEM E:\ORACLE\PRODUCT\10.2.0\ORADA
TA\ORCL\SYSTEM01.DBF
已選擇6行。
SQL> alter database backup controlfile to trace;
資料庫已更改。
SQL> col name format a40
SQL> select thread#,sequence#,name,first_change# from v$archived_log;
THREAD# SEQUENCE# NAME FIRST_CHANGE#
---------- ---------- ---------------------------------------- -------------
1 1 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 581428
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
1_5946V0DN_.ARC
1 1 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 534907
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
1_5942NJ1D_.ARC
1 2 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 567754
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
2_5942NCVR_.ARC
THREAD# SEQUENCE# NAME FIRST_CHANGE#
---------- ---------- ---------------------------------------- -------------
1 3 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 573647
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
3_5942NGV9_.ARC
1 2 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 583431
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
2_5949GZST_.ARC
1 1 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 581428
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
THREAD# SEQUENCE# NAME FIRST_CHANGE#
---------- ---------- ---------------------------------------- -------------
1_5949H0JK_.ARC
1 1 E:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_ 586170
AREA\ORCL\ARCHIVELOG\2009_08_24\O1_MF_1_
1_594BYJL0_.ARC
已選擇7行。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- ----------------
1 1 1 1 CURRENT
1 2 0 2 UNUSED
1 3 0 3 UNUSED
shudown immediate
SQL> startup nomount;
ORACLE 例程已經啟動。
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 209718148 bytes
Database Buffers 394264576 bytes
Redo Buffers 7135232 bytes
SQL>
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',
14 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',
15 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',
16 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',
17 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF',
18 'D:\TEST.DBF'
19 CHARACTER SET ZHS16GBK;
控制檔案已建立。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- --------------------------------
1 1 1 1 CURRENT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~資訊來自online redo log
1 3 0 3 UNUSED
1 2 0 2 UNUSED
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
590900
590900
590900
590900
590900
590900
已選擇6行。
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
590900
590900~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~controlfile scn,datafile scn一樣可以直接open
590900
590900
590900
590900
已選擇6行。
SQL>
SQL> alter database open;
資料庫已更改。
~~~~~~~~~~~~~~~
SQL> shutdown immediate;
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup nomount
ORACLE 例程已經啟動。
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 213912452 bytes
Database Buffers 390070272 bytes
Redo Buffers 7135232 bytes
SQL> alter session set events '10046 trace name context forever ,level 12' ;
會話已更改。
SQL> CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS ARCHIVELOG~~~~~~~~~~~~~~指定resetlogs
2 MAXLOGFILES 16
3 MAXLOGMEMBERS 3
4 MAXDATAFILES 100
5 MAXINSTANCES 8
6 MAXLOGHISTORY 292
7 LOGFILE
8 GROUP 1 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
9 GROUP 2 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
10 GROUP 3 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
11 -- STANDBY LOGFILE
12 DATAFILE
13 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',
14 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',
15 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',
16 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',
17 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF',
18 'D:\TEST.DBF'
19 CHARACTER SET ZHS16GBK
20 ;
控制檔案已建立。
SQL> alter database open;
alter database open
*
第 1 行出現錯誤:
ORA-01589: ??????????? RESETLOGS ? NORESETLOGS ??
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
591328
591328
591328
591328
591328
591328
已選擇6行。
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
591328
591328
591328
591328
591328
591328
已選擇6行。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- ----------------
1 1 0 1 UNUSED~~~~~~~~~~~~~~~~~~~~~~~~~~~~SEQUENCE 都為0 需要resetlogs OPEN 這樣實際的 redolog sequence才為0
1 3 0 3 CURRENT
1 2 0 2 UNUSED
SQL> select thread#,sequence#,name,first_change# from v$archived_log;
未選定行
SQL> alter system dump logfile 'E:\oracle\product\10.2.0\oradata\orcl\redo01.log';
系統已更改。
DUMP OF REDO FROM FILE 'E:\oracle\product\10.2.0\oradata\orcl\redo01.log'
Opcodes *.*
RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff
SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff
Times: creation thru eternity
FILE HEADER:
Compatibility Vsn = 169869568=0xa200100
Db ID=1223510333=0x48ed493d, Db Name='ORCL'
Activation ID=1223549532=0x48ede25c
Control Seq=626=0x272, File size=102400=0x19000~~~~~~~~~~~~~~~~~~~Control Seq=626=0x272(Control file sequence number)
File Number=1, Blksiz=512, File Type=2 LOG
descrip:"Thread 0001, Seq# 0000000001, SCN 0x00000008faf3-0x000000090435" SEQ為1
SQL> alter session set events 'immediate trace name controlf level 8';
會話已更改。
Control Seq=646=0x286,~~~~~~~~~~~~~~~~~~~~~~~
***************************************************************************
LOG FILE RECORDS
***************************************************************************
(size = 72, compat size = 72, section max = 16, section in-use = 3,
last-recid= 0, old-recno = 0, last-recno = 0)
(extent = 1, blkno = 10, numrecs = 16)
LOG FILE #1:
(name #3) E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG
Thread 1 redo log links: forward: 2 backward: 0
siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x0 flg: 0x1 dup: 1~~~~~~~~~~~~~~~~~~~~~~SEQ為0
Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
Low scn: 0x0000.00000000 01/01/1988 00:00:00
Next scn: 0x0000.00000000 01/01/1988 00:00:00
LOG FILE #2:
(name #2) E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
Thread 1 redo log links: forward: 3 backward: 1
siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x0 flg: 0x1 dup: 1
Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
Low scn: 0x0000.00000000 01/01/1988 00:00:00
Next scn: 0x0000.00000000 01/01/1988 00:00:00
LOG FILE #3:
(name #1) E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
Thread 1 redo log links: forward: 0 backward: 2
siz: 0x19000 seq: 0x00000000 hws: 0x0 bsz: 512 nab: 0x2 flg: 0xb dup: 1
Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
Low scn: 0x0000.00000000 01/01/1988 00:00:00
Next scn: 0x0000.00000000 01/01/1988 00:00:00
通過dump可以發現 redo 與control中記錄的 seq: 不一樣
SQL> alter database open resetlogs;
資料庫已更改。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- ----------------
1 1 0 1 UNUSED
1 2 1 2 CURRENT
1 3 0 3 UNUSED
SQL> alter system dump logfile 'E:\oracle\product\10.2.0\oradata\orcl\redo01.log';~~~~~~~~~~~~~~~還處於unused狀態
alter system dump logfile 'E:\oracle\product\10.2.0\oradata\orcl\redo01.log'
*
第 1 行出現錯誤:
ORA-00339: 歸檔日誌未包含任何重做
ORA-00334: 歸檔日誌: 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG'
SQL> alter system dump logfile 'E:\oracle\product\10.2.0\oradata\orcl\redo02.log';
系統已更改。
SQL> alter session set events 'immediate trace name controlf level 8';
會話已更改。
DUMP OF REDO FROM FILE 'E:\oracle\product\10.2.0\oradata\orcl\redo02.log'
Opcodes *.*
RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff
SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff
Times: creation thru eternity
FILE HEADER:
Compatibility Vsn = 169869568=0xa200100
Db ID=1223510333=0x48ed493d, Db Name='ORCL'
Activation ID=1223572562=0x48ee3c52
Control Seq=658=0x292, File size=102400=0x19000~~~~~~~~~~~~~~Control Seq=658=0x292(Control file sequence number)
File Number=2, Blksiz=512, File Type=2 LOG
descrip:"Thread 0001, Seq# 0000000001, SCN 0x0000000905e1-0xffffffffffff"
thread: 1 nab: 0xffffffff seq: 0x00000001 hws: 0x3 eot: 1 dis: 0~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~seq 1
resetlogs count: 0x297844e7 scn: 0x0000.000905e1 (591329)
resetlogs terminal rcv count: 0x0 scn: 0x0000.00000000
trace dump controflile
Compatibility Vsn = 169869568=0xa200100
Db ID=1223510333=0x48ed493d, Db Name='ORCL'
Activation ID=0=0x0
Control Seq=673=0x2a1, File size=450=0x1c2
File Number=0, Blksiz=16384, File Type=1 CONTROL
~~~~~~~~~~~~~~~~~Control Seq=658=0x292(Control file sequence number)
LOG FILE #2:
(name #2) E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
Thread 1 redo log links: forward: 3 backward: 1
siz: 0x19000 seq: 0x00000001 hws: 0x3 bsz: 512 nab: 0xffffffff flg: 0x8 dup: 1~~~~~~~~~~~~~~~~~~seq 1
Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00000000
Low scn: 0x0000.000905e1 08/24/2009 15:16:55
Next scn: 0xffff.ffffffff 08/24/2009 15:16:55
LOG FILE #3:
SQL> alter system switch logfile
2 ;
系統已更改。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- ----------------
1 1 2 1 CURRENT
1 2 1 2 ACTIVE
1 3 0 3 UNUSED
SQL> alter system checkpoint;
系統已更改。
SQL> select thread#,group#,sequence#,group#,status from v$log;
THREAD# GROUP# SEQUENCE# GROUP# STATUS
---------- ---------- ---------- ---------- ----------------
1 1 2 1 CURRENT
1 2 1 2 INACTIVE
1 3 0 3 UNUSED
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12020513/viewspace-613087/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle實驗記錄 (恢復-關於控制檔案(1))Oracle
- oracle實驗記錄 (恢復-關於控制檔案(3))Oracle
- oracle實驗記錄 (恢復-關於控制檔案(4))Oracle
- oracle實驗記錄 (恢復-rman基於控制檔案的恢復)Oracle
- oracle實驗記錄 (恢復-關於熱備份)Oracle
- oracle實驗記錄 (恢復-恢復未備份的資料檔案)Oracle
- oracle實驗記錄 (恢復-完全恢復)Oracle
- oracle實驗記錄 (恢復-rman恢復)Oracle
- oracle實驗記錄 (恢復-rman維護(2))Oracle
- oracle實驗記錄 (恢復-redo)Oracle
- oracle實驗記錄 (恢復read only tablespace(2))Oracle
- oracle實驗記錄 (恢復-不完全恢復)Oracle
- oracle實驗記錄(恢復-checkpoint cnt)Oracle
- oracle實驗記錄 (可恢復session)OracleSession
- oracle實驗記錄 (恢復,備份-含壞塊資料檔案)Oracle
- oracle實驗記錄(恢復-丟失未備份資料檔案)Oracle
- 與控制檔案有關的恢復2
- oracle實驗記錄 (恢復-表空間基於時間點恢復(rman))Oracle
- oracle實驗記錄 (恢復-rman catalog)Oracle
- oracle實驗記錄 (恢復-rman保留策略)Oracle
- oracle實驗記錄 (恢復-表空間基於時間點恢復(手動))Oracle
- oracle實驗記錄 (恢復-rman維護(1))Oracle
- oracle實驗記錄 (恢復-rman增量備份)Oracle
- Oracle檔案改名實驗記錄Oracle
- 【備份恢復】利用 備份控制檔案到指定目錄下的控制檔案 恢復控制檔案
- oracle實驗記錄 (恢復-使用resetlogs open前備份恢復)Oracle
- oracle實驗記錄 (恢復-rman reset incatnation(1))Oracle
- oracle實驗記錄 (恢復read only tablespace(1))Oracle
- oracle實驗記錄 (恢復-rman操作delete(all) input )Oracledelete
- 與控制檔案有關的恢復
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- oracle 關於--控制檔案Oracle
- 備份恢復實驗(1)丟失部分控制檔案
- 控制檔案恢復—從trace檔案中恢復
- oracle實驗記錄 (關於表實際大小)Oracle
- oracle實驗記錄 (恢復-rman操作(設定&備份))Oracle
- 測試恢復5==使用2進位制形式檔案恢復控制檔案
- Oracle備份與恢復【丟失控制檔案的恢復】Oracle