小編給大家分享一下數(shù)據(jù)庫中alter system switch logfile和alter system archive log current的區(qū)別有哪些,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
成都創(chuàng)新互聯(lián)網(wǎng)站建設(shè)服務(wù)商,為中小企業(yè)提供成都做網(wǎng)站、成都網(wǎng)站建設(shè)服務(wù),網(wǎng)站設(shè)計,成都網(wǎng)站托管等一站式綜合服務(wù)型公司,專業(yè)打造企業(yè)形象網(wǎng)站,讓您在眾多競爭對手中脫穎而出成都創(chuàng)新互聯(lián)。
專注于為中小企業(yè)提供做網(wǎng)站、成都網(wǎng)站建設(shè)服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)洪江管理區(qū)免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千多家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
alter system switch logfile 是強制日志切換,不一定就歸檔當(dāng)前的重做日志文件(若自動歸檔打開,就歸檔前的重做日志,若自動歸檔沒有打開,就不歸檔當(dāng)前重做日志。)
alter system archive log current 是歸檔當(dāng)前的重做日志文件,不管自動歸檔有沒有打都?xì)w檔。
主要的區(qū)別在于:
ALTER SYSTEM SWITCH LOGFILE對單實例數(shù)據(jù)庫或RAC中的當(dāng)前實例執(zhí)行日志切換;
而ALTER SYSTEM ARCHIVE LOG CURRENT會對數(shù)據(jù)庫中的所有實例執(zhí)行日志切換。
所以在RAC環(huán)境上大多時間一般使用后者
為什么執(zhí)行熱備后要執(zhí)行alter system archive log current 這個語句,看到很多腳本都是這樣寫的。
是不是必須的?
一般的RMAN腳本都是這樣寫的,因為RMAN是可以備份歸檔日志的。alter system archive log current 這樣后就可以將所有的歸檔都備份出來了。這樣做是為了保證數(shù)據(jù)的完整和一致。
ALTER SYSTEM SWITCH LOGFILE ;
SWITCH LOGFILE Clause
The SWITCH LOGFILE clause lets you explicitly force Oracle to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. When you force a log switch, Oracle begins to perform a checkpoint but returns control to you immediately rather than when the checkpoint is complete. To use this clause, your instance must have the database open.
ALTER SYSTEM ARCHIVE LOG CURRENT ;
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread(instance), forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled threads(instances), including logs previous to current logs. You can specify CURRENT only when the database is open.
ALTER SYSTEM ARCHIVE LOG CURRENT NOSWITCH;
NOSWITCH
Specify NOSWITCH if you want to manually archive the current redo log file group without forcing a log switch. This setting is used primarily with standby databases to prevent data divergence when the primary database shuts down. Divergence implies the possibility of data loss in case of primary database failure.
You can use the NOSWITCH clause only when your instance has the database mounted but not open. If the database is open, then this operation closes the database automatically. You must then manually shut down the database before you can reopen it.
另外,SWITCH LOGFILE 只是強制切換日志組,歸檔功能是否打開與之沒多大關(guān)系:
歸檔如果打開,切換日志組附帶著必然要歸檔,在開歸檔的情況下,日志切換必然會歸檔的
歸檔如果關(guān)閉,肯定不能歸檔了,但該功能同樣能切換日志組,因為它的功能就是強制切換日志組
而 archive log 則是歸檔的意思,常用的兩個參數(shù):
alter system archive log current:歸檔當(dāng)前的日志組,僅在歸檔模式下使用,因為是當(dāng)前日志組,歸檔之前必先切換日志組,所以該命令伴隨著切換日志組
alter system archive log all: 歸檔除當(dāng)前日志組以外,尚未歸檔的日志組,僅在歸檔模式下使用,該命令不會切換日志組
非歸檔模式下使用則會報以下錯誤:
補充說明:非歸檔模式下就不能使用 ARCHIVE LOG了嗎?上面的ORA-00258提示說指定日志,相關(guān)參數(shù)如下:
ARCHIVE LOG
[ INSTANCE 'instance_name' ]
{ { SEQUENCE integer
| CHANGE integer
| CURRENT [ NOSWITCH ]
| GROUP integer
| LOGFILE 'filename'
[ USING BACKUP CONTROLFILE ]
| NEXT
| ALL
| START
}
[ TO 'location' ]
| STOP
}
非歸檔模式下可以使用該方式指定到具體的日志組進行歸檔,但group n 不能是當(dāng)前日志組
SQL> alter system archive log group 2 to '/tmp';
總結(jié):
ALTER SYSTEM SWITCH LOGFILE:就是切換日志,SWITCH(切換) ,LOGFILE(日志),就是字面的意思
ALTER SYSTEM ARCHIVE LOG CURRENT:就是歸檔當(dāng)前日志,歸檔(ARCHIVE )日志(LOG)當(dāng)前的(CURRENT),也是字面意思,
然后就是在不同的環(huán)境下(單機/RAC/是否開歸檔功能),由于功能設(shè)計的出發(fā)點不同,各自附帶的效果也有所不同。
以上是“數(shù)據(jù)庫中alter system switch logfile和alter system archive log current的區(qū)別有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章名稱:數(shù)據(jù)庫中altersystemswitchlogfile和altersystemarchivelogcurrent的區(qū)別有哪些
網(wǎng)站鏈接:http://aaarwkj.com/article18/iijpdp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站建設(shè)、網(wǎng)站改版、面包屑導(dǎo)航、服務(wù)器托管、企業(yè)網(wǎng)站制作、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)