久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

數(shù)據(jù)庫(kù)中alter system switch logfile和alter system archive log current的區(qū)別有哪些

共計(jì) 2845 個(gè)字符,預(yù)計(jì)需要花費(fèi) 8 分鐘才能閱讀完成。

行業(yè)資訊    
數(shù)據(jù)庫(kù)    
關(guān)系型數(shù)據(jù)庫(kù)    
數(shù)據(jù)庫(kù)中 alter system switch logfile 和 alter system archive log current 的區(qū)別有哪些

丸趣 TV 小編給大家分享一下數(shù)據(jù)庫(kù)中 alter system switch logfile 和 alter system archive log current 的區(qū)別有哪些,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

alter system switch logfile 是強(qiáng)制日志切換,不一定就歸檔當(dāng)前的重做日志文件(若自動(dòng)歸檔打開(kāi),就歸檔前的重做日志,若自動(dòng)歸檔沒(méi)有打開(kāi),就不歸檔當(dāng)前重做日志。)
alter system archive log current 是歸檔當(dāng)前的重做日志文件,不管自動(dòng)歸檔有沒(méi)有打都?xì)w檔。
主要的區(qū)別在于:
ALTER SYSTEM SWITCH LOGFILE 對(duì)單實(shí)例數(shù)據(jù)庫(kù)或 RAC 中的當(dāng)前實(shí)例執(zhí)行日志切換;
而 ALTER SYSTEM ARCHIVE LOG CURRENT 會(huì)對(duì)數(shù)據(jù)庫(kù)中的所有實(shí)例執(zhí)行日志切換。
所以在 RAC 環(huán)境上大多時(shí)間一般使用后者

為什么執(zhí)行熱備后要執(zhí)行 alter system archive log current 這個(gè)語(yǔ)句,看到很多腳本都是這樣寫(xiě)的。
是不是必須的?

一般的 RMAN 腳本都是這樣寫(xiě)的,因?yàn)?RMAN 是可以備份歸檔日志的。alter system archive log current 這樣后就可以將所有的歸檔都備份出來(lái)了。這樣做是為了保證數(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 只是強(qiáng)制切換日志組,歸檔功能是否打開(kāi)與之沒(méi)多大關(guān)系:

      歸檔如果打開(kāi),切換日志組附帶著必然要?dú)w檔,在開(kāi)歸檔的情況下,日志切換必然會(huì)歸檔的

      歸檔如果關(guān)閉,肯定不能歸檔了,但該功能同樣能切換日志組,因?yàn)樗墓δ芫褪菑?qiáng)制切換日志組

而 archive log 則是歸檔的意思,常用的兩個(gè)參數(shù):

     alter system archive log current:歸檔當(dāng)前的日志組,僅在歸檔模式下使用,因?yàn)槭钱?dāng)前日志組,歸檔之前必先切換日志組,所以該命令伴隨著切換日志組

     alter system archive log all:  歸檔除當(dāng)前日志組以外,尚未歸檔的日志組,僅在歸檔模式下使用,該命令不會(huì)切換日志組

非歸檔模式下使用則會(huì)報(bào)以下錯(cuò)誤:

補(bǔ)充說(shuō)明:非歸檔模式下就不能使用  ARCHIVE LOG 了嗎?上面的 ORA-00258 提示說(shuō)指定日志,相關(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
  }

  非歸檔模式下可以使用該方式指定到具體的日志組進(jìn)行歸檔,但 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)境下(單機(jī) /RAC/ 是否開(kāi)歸檔功能),由于功能設(shè)計(jì)的出發(fā)點(diǎn)不同,各自附帶的效果也有所不同。

以上是“數(shù)據(jù)庫(kù)中 alter system switch logfile 和 alter system archive log current 的區(qū)別有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道!

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-07-17發(fā)表,共計(jì)2845字。
轉(zhuǎn)載說(shuō)明:除特殊說(shuō)明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請(qǐng)注明出處。
評(píng)論(沒(méi)有評(píng)論)
主站蜘蛛池模板: 昌乐县| 文成县| 大新县| 鲁甸县| 江城| 德阳市| 高碑店市| 盈江县| 元氏县| 皋兰县| 理塘县| 万源市| 合山市| 遂川县| 杨浦区| 鸡泽县| 达尔| 台东县| 永川市| 察隅县| 翁源县| 三门县| 惠水县| 怀远县| 珠海市| 马边| 漳浦县| 洛隆县| 滦平县| 株洲市| 镇远县| 凤翔县| 集安市| 三门县| 涡阳县| 双辽市| 阿勒泰市| 彭泽县| 安平县| 河津市| 五峰|