Oracle 數(shù)據(jù)庫SCN概念淺析
以下的文章主要是對Oracle 數(shù)據(jù)庫SCN概念的介紹,為了更好的了解Oracle 數(shù)據(jù)庫SCN概念,我們首先在這里介紹的是4個關(guān)于SCN的概念。以下就是具體內(nèi)容的描述,希望在你今后的學(xué)習(xí)中會有所幫助。
1,系統(tǒng)檢查點scn
當(dāng)一個檢查點動作完成后,Oracle 就把系統(tǒng)檢查點的SCN存儲到控制文件中。
- select checkpoint_change# from v$database;
2,數(shù)據(jù)文件檢查點scn
當(dāng)一個檢查點動作完成后,Oracle 就把每個數(shù)據(jù)文件的scn單獨(dú)存放在控制文件中。
- select name,checkpoint_change# from v$datafile;
3,啟動scn
Oracle 把這個檢查點的scn存儲在每個數(shù)據(jù)文件的文件頭中,這個值稱為啟動scn,因為它用于在數(shù)據(jù)庫實例啟動時,
檢查是否需要執(zhí)行Oracle數(shù)據(jù)庫恢復(fù)。
- select name,checkpoint_change# from v$datafile_header
4,終止scn
每個數(shù)據(jù)文件的終止scn都存儲在控制文件中。
- select name,last_change# from v$datafile
以下條件需要使用using backup controlfile
1)、使用備份控制文件
2)、重建resetlogs控制文件,如果重建立noresetlogs不必要使用using backup controlfile
2、alter database open resetlog
指定RESETLOGS將重設(shè)當(dāng)前LOG sequence number為1,拋棄所有日志信息。
以下條件需要使用resetlog
1)在不完全恢復(fù)(介質(zhì)恢復(fù))
2)使用備份控制文件
使用resetlogs打開數(shù)據(jù)庫后無必完整地備份一次Oracle數(shù)據(jù)庫。
3、
- create controlfile resetlogs/noresetlogs
1).用Noresetlogs重建控制文件時,控制文件中 datafile Checkpoint來自O(shè)nline logs中的Current log頭
2).用Resetlogs重建控制文件時,控制文件中datafile Checkpoint來自各數(shù)據(jù)文件頭。
當(dāng)system scn,datafile scn,start scn 不全相等,需要介質(zhì)恢復(fù),如果stopscn null需要實例恢復(fù)resetlogs拋棄所有在上一次恢復(fù)沒有用到的日志信息,確保不被重新用與恢復(fù)。
1、系統(tǒng)正常關(guān)閉:
- system scn=datafile scn=start scn=stop scn
1)system scn=datafile scn=start scn,不需要介質(zhì)恢復(fù)
2)stopscn not null,不需要實例恢復(fù)
2、系統(tǒng)異常關(guān)閉:
- system scn=datafile scn=start scn,stop scn null
1)system scn=datafile scn=start scn,不需要介質(zhì)恢復(fù)
2)stopscn null,需要實例恢復(fù)
3、舊數(shù)據(jù)文件
- system scn=datafile scn>start scn,stop scn null/notnull
1)system scn=datafile scn>start scn,需要介質(zhì)恢復(fù)成system scn=datafile scn=start scn
2)stopscn null,需要實例恢復(fù),not null 不需要實例恢復(fù)
4、備份控制文件
- system scn=datafile scn<=start scn(當(dāng)數(shù)據(jù)文件為舊的相等)
stop scn notnull/null
1)system scn=datafile scn<=start scn,需要使用using backup controlfile介質(zhì)恢復(fù)成system scn=datafile scn=start scn=current log
scn(當(dāng)前日志最大SCN)
2)為保證上一次恢復(fù)沒有用到log日志不被使用,必須resetlogs
5、重建noresetlogs控制文件
控制文件中 datafile Checkpoint來自O(shè)nline logs中的Current log頭
- current log scn=system scn=datafile scn>=
start scn,stop scn not null/null
1)current log scn=system scn=datafile scn>=start scn,需要介質(zhì)恢復(fù)成system scn=datafile scn=start scn=redolog scn(當(dāng)前日志最大SCN),stop scn not null
2)stopscn not null 不需要實例恢復(fù)
6、重建resetlogs控制文件
控制文件中datafile Checkpoint來自各數(shù)據(jù)文件頭。
- system scn>=datafile scn=start scn,stop scn not null/null
1)system scn>=datafile scn=start scn,需要使用using backup controlfile介質(zhì)恢復(fù)成system scn=datafile scn=start scn(當(dāng)前日志最大SCN),stop scn not null
2)stop notnull,因為SCN已經(jīng)為redolog scn,log已經(jīng)不能使用,必須resetlogs
上述的相關(guān)內(nèi)容就是對Oracle 數(shù)據(jù)庫SCN概念的描述,希望會給你帶來一些幫助在此方面。
【編輯推薦】