ALTER SYSTEM SWITCH LOGFILE ALTER SYSTEM ARCHIVELOG CURRENT 區別
轉載地址:
http://www.dba-oracle.com/t_alter_system_switch_logfile_vs_alter_system_archivelog_current.htmQuestion: I understand that there are times that you need to force a log switch for backups, but I have noted that Oracle has two ways to force a logfile switch, ALTER SYSTEM SWITCH LOGFILE and ALTER SYSTEM ARCHIVELOG CURRENT.
What is the difference between ALTER SYSTEM SWITCH LOGFILE and ALTER SYSTEM ARCHIVELOG CURRENT, and when do I use each?
Answer: Yes, both ALTER SYSTEM SWITCH LOGFILE and ALTER SYSTEM ARCHIVELOG CURRENT will force a log switch, but they do it in different ways!
Both the SWITCH LOGFILE and ARCHIVELOG CURRENT write a quiesce checkpoint, a firm place whereby that last redo log is a part of the hot backup, but ARCHIVELOG CURRENT waits for the writing to complete. This can take several minutes for multi-gigabyte redo logs.
Conversely, the ALTER SYSTEM SWITCH LOGFILE command is very fast and returns control to the caller in less than a second while ALTER SYSTEM ARCHIVELOG CURRENT pauses.
As we see below, the ALTER SYSTEM SWITCH LOGFILE is fast because it does not wait for the archiver process (ARCH) to complete writing the online redo log to the archivelog log filesystem:
- It issues database checkpoint
- It immediately starts writing to the next redo log
- In the background, the “switch logfile” command tells the ARCH background process to copy the “old” redo log file to the redo log filesystem.
Here are the important differences between ALTER SYSTEM SWITCH LOGFILE and ALTER SYSTEM ARCHIVELOG CURRENT:
- RAC: If you are running RAC, the ALTER SYSTEM ARCHIVELOG CURRENTwill switch the logs on all RAC nodes (instances), whereas ALTER SYSTEM SWITCH LOGFILE will only switch he logfile on the instance where you issue the switch command. Hence, ALTER SYSTEM ARCHIVELOG CURRENT is a best practice for RAC systems.
- ALTER SYSTEM SWITCH LOGFILE is asynchronous: This command is fast to return to the invoking program because the writing of the redo log to the OS filesystem is done in the background. There is a very small risk in cases where the ARCH process cannot complete writing the redo log, such as cases where the OS archivelog file directory is out of space. It is also risky because the calling script. may move on to a subsequent step, assuming that the redo has been written. Some scripts will place a SLEEP 60 command in their backup script. to allow time for the redo to complete writing, but this is not a best practice.
- ALTER SYSTEM ARCHIVELOG CURRENT is synchronous: This is faster to return because this command waits until the online redo log has completed the writing of the redo log file to the filesystem. This command is safer because it waits for the OS to acknowledge (ACK) that the redo log has been successfully written. Hence, ALTER SYSTEM ARCHIVELOG CURRENT is the best practice for production backup scripts with RMAN.
- Argument required: The ALTER SYSTEM ARCHIVELOG CURRENTallows you to specify the thread to archive while the ALTER SYSTEM SWITCH LOGFILE archives only the current thread. If you do not pass the thread parameter, Oracle will archive all full online redo logs.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-758179/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- alter system switch logfile和alter system archive log current的區別Hive
- alter system switch logfile 和 alter system archive log current 的區別Hive
- [轉]alter system switch logfile和alter system archive log current的區別Hive
- zt:alter system switch logfile與ALTER SYSTEM ARCHIVE LOG CURRENT的區別Hive
- alter system archive log current和alter system switch logfileHive
- alter system archive log current / all / switch logfileHive
- alter system switch log file 與 archive log current/all 區別Hive
- [alter system dump學習1]alter system dump logfile
- alter system events與alter system event的區別
- alter system switch logfile hang住的一種可能
- alter system archive log current noswitch!!Hive
- alter database和alter system和alter session的區別DatabaseSession
- alter system switch logfile的執行時間是多久。
- alter system switch logfile手工日誌切換小記
- 忍不住問下alter system 和alter database的區別Database
- oracle switch logfile日誌切換及alter system checkpoint作了什麼Oracle
- Alter system in OracleOracle
- alter system set event和set events的區別
- ALTER SYSTEM 中 SCOPE=SPFILE/MEMORY/BOTH 的區別:
- alter system kill sessionSession
- alter system check datafiles 命令
- alter session|system set eventsSession
- 在oracle10g執行alter system switch logfile並未開啟自動歸檔Oracle
- alter system dump datafile headerHeader
- ALTER SYSTEM DISCONNECT SESSION ClauseSession
- alter system kill session 不成功Session
- alter database archivelog manual__導致oracle10g switch logfile不自動歸檔DatabaseHiveOracle
- alter system set events 相關知識
- alter system set events 知識 [final]
- oracle中Alter system 命令的總結Oracle
- alter system set events相關知識:
- alter system set events相關知識
- 在使用alter system switch log的時候無時間限制的等待
- 【Oracle】alter system set events 相關知識Oracle
- ALTER SYSTEM KILL SESSION這麼沒力?(轉)Session
- 通過 alter system dump logfile語句dump REDO及歸檔日誌資訊示例
- 停庫前執行alter system checkpoint 很重要!
- Alter system suspend/resume 導致的bug和特性