Oracle程式:SMON的功能與作用 ZT

asword發表於2009-03-17
作者: |
【轉載時請以超連結形式標明文章和作者資訊及】
連結:[@more@]


SMON是Oracle資料庫至關重要的一個後臺程式,SMON 是System Monitor 的縮寫,意即:系統監控。

在資料庫啟動過程中,SMON排在CKPT程式之後,在Oracle9i中排在第六號的位置:

PMON started with pid=2
DBW0 started with pid=3
LGWR started with pid=4
CKPT started with pid=5
SMON started with pid=6
RECO started with pid=7

SMON負責系統監視已經一些系統清理及恢復工作,這些工作主要包括:
1.清理臨時空間以及臨時段
SMON負責在資料庫啟動時清理臨時表空間中的臨時段,或者一些異常操作過程遺留下來的臨時段,例如,當建立索引過程中,建立期間分配給索引的Segment被標誌為TEMPORARY,如果Create Index (或rebuild Index等)會話因某些原因異常中斷,SMON負責清理這些臨時段。
2.接合空閒空間
在DMT(字典管理表空間)中,SMON負責把那些在表空間中空閒的並且互相是鄰近的Extent接合成一個較大的空閒擴充套件區,這需要表空間的pctincrease設定為非零值。
3.執行例項恢復(Instance recovery)
在例項恢復過程中,SMON的工作包括三個環節:應用Redo執行前滾、開啟資料庫提供訪問、回滾未提交資料

Tue Apr 22 21:31:10 2008
SMON: enabling cache recovery
Tue Apr 22 21:31:10 2008
ARC0: Completed archiving log 1 thread 1 sequence 238
Tue Apr 22 21:31:11 2008
Undo Segment 1 Onlined
Undo Segment 2 Onlined
Undo Segment 3 Onlined
Undo Segment 4 Onlined
Undo Segment 5 Onlined
Undo Segment 6 Onlined
Undo Segment 7 Onlined
Undo Segment 8 Onlined
Undo Segment 9 Onlined
Undo Segment 10 Onlined
Successfully onlined Undo Tablespace 1.
Tue Apr 22 21:31:11 2008
SMON: enabling tx recovery
Tue Apr 22 21:31:11 2008
Database Characterset is ZHS16GBK
replication_dependency_tracking turned off (no async multimaster replication found)
Completed: ALTER DATABASE OPEN

4.離線(Offline)回滾段
在自動回滾段管理(AUM)中負責Offline不再需要的回滾段,日誌中會記錄類似如下資訊:

Fri May 2 15:43:21 2008
SMON offlining US=11
SMON offlining US=12
SMON offlining US=13
SMON offlining US=14
SMON offlining US=15
SMON offlining US=16
SMON offlining US=17
SMON offlining US=18
SMON offlining US=19
SMON offlining US=20
SMON offlining US=21
SMON offlining US=22
SMON offlining US=23

5.執行並行恢復
以下資訊來自9i日誌:

Fri May 11 21:30:45 2007
SMON: Parallel transaction recovery tried


Also Record some English Note About SMON:

The SMON background process performs all system monitoring functions on the Oracle database. The SMON process performs a "warm start" each time that Oracle is re-started, ensuring that any in-flight transaction at the time of the last shutdown are recovered. For example, if Oracle crashed hard with a power failure, the SMON process is attached at startup time, and detects any uncompleted work, using the rollback segments to recover the transactions. In addition, SMON performs periodic cleanup of temporary segments that are no longer needed, and also perform tablespace operations, coalescing contiguous free extents into larger extents.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/82387/viewspace-1018889/,如需轉載,請註明出處,否則將追究法律責任。

相關文章