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

數據庫中alter system switch logfile和alter system archive log current的區別有哪些

140次閱讀
沒有評論

共計 2845 個字符,預計需要花費 8 分鐘才能閱讀完成。

行業資訊    
數據庫    
關系型數據庫    
數據庫中 alter system switch logfile 和 alter system archive log current 的區別有哪些

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

alter system switch logfile 是強制日志切換,不一定就歸檔當前的重做日志文件(若自動歸檔打開,就歸檔前的重做日志,若自動歸檔沒有打開,就不歸檔當前重做日志。)
alter system archive log current 是歸檔當前的重做日志文件,不管自動歸檔有沒有打都歸檔。
主要的區別在于:
ALTER SYSTEM SWITCH LOGFILE 對單實例數據庫或 RAC 中的當前實例執行日志切換;
而 ALTER SYSTEM ARCHIVE LOG CURRENT 會對數據庫中的所有實例執行日志切換。
所以在 RAC 環境上大多時間一般使用后者

為什么執行熱備后要執行 alter system archive log current 這個語句,看到很多腳本都是這樣寫的。
是不是必須的?

一般的 RMAN 腳本都是這樣寫的,因為 RMAN 是可以備份歸檔日志的。alter system archive log current 這樣后就可以將所有的歸檔都備份出來了。這樣做是為了保證數據的完整和一致。

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 只是強制切換日志組,歸檔功能是否打開與之沒多大關系:

      歸檔如果打開,切換日志組附帶著必然要歸檔,在開歸檔的情況下,日志切換必然會歸檔的

      歸檔如果關閉,肯定不能歸檔了,但該功能同樣能切換日志組,因為它的功能就是強制切換日志組

而 archive log 則是歸檔的意思,常用的兩個參數:

     alter system archive log current:歸檔當前的日志組,僅在歸檔模式下使用,因為是當前日志組,歸檔之前必先切換日志組,所以該命令伴隨著切換日志組

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

非歸檔模式下使用則會報以下錯誤:

補充說明:非歸檔模式下就不能使用  ARCHIVE LOG 了嗎?上面的 ORA-00258 提示說指定日志,相關參數如下:

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 不能是當前日志組

SQL alter system archive log group 2 to /tmp

總結:

ALTER SYSTEM SWITCH LOGFILE:就是切換日志,SWITCH(切換),LOGFILE(日志),就是字面的意思

ALTER SYSTEM ARCHIVE LOG CURRENT:就是歸檔當前日志,歸檔(ARCHIVE )日志(LOG)當前的(CURRENT),也是字面意思,

然后就是在不同的環境下(單機 /RAC/ 是否開歸檔功能),由于功能設計的出發點不同,各自附帶的效果也有所不同。

以上是“數據庫中 alter system switch logfile 和 alter system archive log current 的區別有哪些”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-18發表,共計2845字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 博罗县| 酉阳| 右玉县| 武平县| 阿尔山市| 封开县| 淮滨县| 鹿邑县| 陵水| 崇州市| 北辰区| 南安市| 龙井市| 定远县| 庄河市| 阳城县| 北流市| 岑溪市| 新建县| 平谷区| 普安县| 塔河县| 庄浪县| 海盐县| 天气| 寻乌县| 类乌齐县| 泸定县| 金坛市| 扶绥县| 三河市| 太康县| 保靖县| 阿克| 安泽县| 临朐县| 望江县| 拜泉县| 新闻| 寿阳县| 阜康市|