alter system switch logfile 和 alter system archive log current 的區別
主要區別:
ALTER SYSTEM SWITCH LOGFILE 對單例項資料庫或RAC中的當前例項執行日誌切換。
ALTER SYSTEM ARCHIVE LOG CURRENT 會對資料庫中的所有例項執行日誌切換。
詳細解釋:
-------------------------
我們都知道在自動歸檔的資料庫中,這兩個命令幾乎產生的結果是一樣的。來看看oracle的解釋:
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.
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, forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled threads, including logs previous to current logs. You can specify CURRENT only when the database is open.
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread, forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled threads, 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.
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
我們首先要明白兩個事實:
一個就是在logfile switch的時候會觸發arch程式,即通知歸檔程式說那個日誌可以歸檔了。
另一個是logfile switch的時候會觸發ckpt程式。而ckpt程式又會觸發dbwr程式。dbwr程式會把上一個redo中保護的儲藏在buffer cache中的dirty buffer全部寫回磁碟。然後,ckpt程式紀錄scn到controlfile中,這時會把redo log的狀態由active 變成inactive。
由此我們可以看出處於inactive狀態的redo log對於instance recovery是沒有用處了。但是它可能對於meda recovery還有用處,因為處於inactive狀態的redo log可能已經歸檔,也可能沒有歸檔。
出現 checkpoint not complete,unable to allocate new redo log file的錯誤,是因為lgwr要覆蓋一個其上檢查點過程沒有結束的日誌檔案,lgwr會等待dbwr完成,同時出現此錯誤。出現這個錯誤的原因,大概有幾點,一個是dbwr寫出速度太慢,一個是buffer cache中的髒資料太多。即事務太頻繁,另一個也可能是日誌太小,或日誌組太少導致的。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-1000489/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- alter system set event和set events的區別
- ALTER SYSTEM FLUSH BUFFER_POOL
- 2.7.6.2.1 ALTER SYSTEM SET語句中的SCOPE子句
- mysql alter modify 和 change的區別MySql
- [20231023]備庫與alter system flush buffer_cache.txt
- alter system set ... scope=... 中的scope的含義是什麼?
- ORA-279 signalled during: alter database recover logfileDatabase
- system.exit(0)和system.exit(1)的區別
- ORACLE之手動註冊監聽listener。alter system set local_listener="XXX"Oracle
- SQL__ALTERSQL
- MySQL ALTER命令MySql
- mysql的ALTER TABLE命令MySql
- Oracle設定日誌引數-ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;OracleDatabase
- mysql加快alter操作MySql
- [LeetCode] 635. Design Log Storage SystemLeetCode
- mysql表操作(alter)/mysql欄位型別MySql型別
- alter database disable thread 2Databasethread
- alter table set unused column
- alter table move與shrink space
- alter table nologging /*+APPEND PARALLEL(n)*/APPParallel
- alter table drop unused columns checkpoint
- ALTER TABLE修改列的不同方法
- mysql關於ib_logfile事務日誌和binary log二進位制日誌的區別MySql
- 如何獲取 alter 裡面的字串?字串
- 開心檔之MySQL ALTER命令MySql
- System
- MySQL-ALTER TABLE命令學習[20180503]MySql
- alter tablespace ts_name autoextend_clause
- MySQL 資料庫 ALTER命令講解MySql資料庫
- MySQL alter 新增列對dml影響MySql
- log、Timber、Lumber和Wood的區別
- System,Runtime,Math,StringBuffer和StringBuilderUI
- System類
- 轉載:System:System.arraycopy方法詳解
- [20191129]ALTER TABLE MINIMIZE RECORDS_PER_BLOCK.txtBloC
- console.log()和alert()區別
- Git log 和 Git reflog 區別Git
- SAP Hybris的Master Tenant和Netweaver的System ClientASTNaNclient
- 什麼叫archive log expired?Hive