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 set event和set events的區別
- ALTER SYSTEM FLUSH BUFFER_POOL
- 2.7.6.2.1 ALTER SYSTEM SET語句中的SCOPE子句
- [20231023]備庫與alter system flush buffer_cache.txt
- ORA-279 signalled during: alter database recover logfileDatabase
- alter system set ... scope=... 中的scope的含義是什麼?
- mysql alter modify 和 change的區別MySql
- ORACLE之手動註冊監聽listener。alter system set local_listener="XXX"Oracle
- system.exit(0)和system.exit(1)的區別
- SQL__ALTERSQL
- MySQL ALTER命令MySql
- mysql加快alter操作MySql
- mysql表操作(alter)/mysql欄位型別MySql型別
- alter database disable thread 2Databasethread
- mysql的ALTER TABLE命令MySql
- alter table set unused column
- alter table move與shrink space
- alter table nologging /*+APPEND PARALLEL(n)*/APPParallel
- alter table drop unused columns checkpoint
- 如何獲取 alter 裡面的字串?字串
- 開心檔之MySQL ALTER命令MySql
- System
- ALTER TABLE修改列的不同方法
- MySQL-ALTER TABLE命令學習[20180503]MySql
- alter tablespace ts_name autoextend_clause
- MySQL 資料庫 ALTER命令講解MySql資料庫
- MySQL alter 新增列對dml影響MySql
- System類
- 轉載:System:System.arraycopy方法詳解
- [20191129]ALTER TABLE MINIMIZE RECORDS_PER_BLOCK.txtBloC
- System Design InterviewView
- System design summary
- System.arraycopy
- 1.5.2.3. SYSTEM
- System Error CodesError
- golang system callGolang
- [20190530]ORACLE 18c - ALTER SEQUENCE RESTART.txtOracleREST
- remount of /system failed: Read-only file system原因及解決REMAI
- Understanding System Statistics(zt)