11g以后oracle引入了智能空間預分配space preallocation的新特性,該新特性涉及3個領域: 表空間的預分配和擴展 數據段segment的預分配和擴展 LOB chunk的預分配和擴展 以下是一個tablespace 預分配和擴展的例子,可以看到某個表空間對應的FILE#=3的數據文件
11g以后oracle引入了智能空間預分配space preallocation的新特性,該新特性涉及3個領域:
以下是一個tablespace 預分配和擴展的例子,可以看到某個表空間對應的FILE#=3的數據文件,由于在一段時間內的空間使用情況預估,所以在幾個小時內擴展了不少的空間:
Sat Oct 04 06:07:46 2014 Resize operation completed for file# 3, old size 706560K, new size 716800K Sat Oct 04 08:00:03 2014 www.askmaclean.com Thread 1 advanced to log sequence 60 (LGWR switch) Current log# 2 seq# 60 mem# 0: /s01/oradata/PDPROD/onlinelog/o1_mf_2_b2wgc3rf_.log Current log# 2 seq# 60 mem# 1: /s01/fast_recovery_area/PDPROD/onlinelog/o1_mf_2_b2wgc4mf_.log Sat Oct 04 08:00:05 2014 TT00: Standby redo logfile selected for thread 1 sequence 60 for destination LOG_ARCHIVE_DEST_2 Sat Oct 04 08:00:06 2014 Archived Log entry 79 added for thread 1 sequence 59 ID 0xe5f08f5 dest 1: Sat Oct 04 08:08:00 2014 www.askmaclean.com Resize operation completed for file# 3, old size 716800K, new size 727040K Sat Oct 04 10:08:37 2014 Thread 1 advanced to log sequence 61 (LGWR switch) Current log# 3 seq# 61 mem# 0: /s01/oradata/PDPROD/onlinelog/o1_mf_3_b2wgc6ol_.log Current log# 3 seq# 61 mem# 1: /s01/fast_recovery_area/PDPROD/onlinelog/o1_mf_3_b2wgc70g_.log Sat Oct 04 10:08:37 2014 TT00: Standby redo logfile selected for thread 1 sequence 61 for destination LOG_ARCHIVE_DEST_2 Sat Oct 04 10:08:40 2014 Archived Log entry 81 added for thread 1 sequence 60 ID 0xe5f08f5 dest 1: Sat Oct 04 13:08:34 2014 Resize operation completed for file# 3, old size 727040K, new size 737280K Sat Oct 04 14:04:39 2014 Resize operation completed for file# 3, old size 747520K, new size 757760K
以上這種擴展受到Oracle內部預定義的參數TBS_EXTENSION_MAX_STEP_SIZE(64MB)的限制,即最大一次擴展是64MB,可以從上述日志看到大多數擴展在這里是一次10MB。
對于表空間預分配,?space preallocation特性會基于過去6個小時內的表空間使用情況,每隔10分鐘分析一次,基于以下的數據分析:
對于數據段segment預分配,數據段的統計信息會每半個小時flush到AWR中(WRH$_SEG_STAT),Segment growth trend數據段的增長趨勢也會每半個小時完成一次, 基于以下的數據分析:
LOB chunk的使用情況 會每10分鐘記錄在內存中,也會定期flush到AWR中,基于以下的數據分析:
這些預分配和擴展任務主要由SMCO(Space Management Coordinator Process)和其小工進程W00n(slave )一起完成。 SMCO和W00n是基于任務task驅動的后臺任務Framework。這個后臺任務體系是基于實例的,而非基于數據庫的。每一個實例instance有其自己的后臺任務服務體系,運行和處理在本實例發(fā)起的任務。RAC的不同實例之間不會交互來負責此種任務的負載。
Task coordinator ( SMCO ) ,SMCO充當調度進程以便管理任務隊列和slave進程池。其主要任務是在幾個task queue之間移動任務,清理過期任務,基于任務需要來動態(tài)分配新的slave(W00n)進程,并監(jiān)控slave進程。 一個實例只有一個SMCO進程,且SMCO進程不是fatal進程,kill了一般也沒事。
部分12c新特性?Policy Driven Data Movement and ILM(Information Lifecycle Management) Project 數據生命周期管理也依賴于SMCO后臺進程。
SMON,SMON是老牌后臺進程 已經負責了一系列任務。其現在也負載動態(tài)啟動SMCO進程。SMON現在會定期檢查SMCO是否啟動著,SMON也會當有任務提交時啟動SMCO。
W00n等一組Slave Process,Slave進程總是實際干活的人。Salve process由SMCO這個調度器動態(tài)分配。一旦啟動后,slave 進程將自主工作,其自動從ready-task隊列中找尋任務并執(zhí)行。如果空閑了過長時間,那么W00n也會自行終止。
其大致的工作流程如下:
與該11g以后的space preallocation特性相關的參數如下:
_enable_space_background_task/_enable_spacebg – This parameter specifies whether the background task support is enabled.
_max_ smco _slaves – This parameter specifies the maximum number of active slave process that can be spawned at a time. Ideally, the number
of slave processes should be decided by the system workload and the availability of system resources.
_max_ smco _tasks – This parameter specifies the maximum number of tasks that can be stored in memory. Ideally, the number of tasks should be
decided by the availability of SGA memory and the efficiency of task maintenance. Too many cached tasks will simply increase the burden of
task maintenance.
_enable_space_background_task
Parameter Name: _enable_space_background_task
Parameter Type: boolean
Allowable Values: TRUE to enable the feature, and FALSE to disable the feature
Default Value: TRUE. The space management background task support will be enabled by default.
Description: This parameter allows the user to choose whether to enable the space management background task support feature.
Dynamic: The parameter is dynamic and the scope is ALTER SYSTEM.
Example: alter system set “_enable_space_background_task ” = TRUE
_enable_space_preallocation
Parameter Name: _enable_space_preallocation
Parameter Type: integer
Allowable Values:
0x00: disable all levels of space preallocation
0x01: enable tablespace extension ahead of time
0x02: enable segment growth ahead of time
0x04: enable chunk allocation ahead of time
Combination of any of the above 3 levels of space preallocation?Default Value: 0x07. The space preallocation at all levels will be enabled by default. However, whether the space preallocation will be done and how much?space will be allocated relies on the system monitor analysis result.
Description: This parameter allows the user to enable different levels of space preallocation.
Dynamic: The parameter is dynamic and the scope is ALTER SYSTEM.
Example: alter system set “_enable_space_prealloaction ” = 1
_max_spacebg_slaves
the parameter that allows user to set maximum number of space BG slaves
_minmax_spacebg_slaves
the parameter that allows user to set min-max number of space BG slaves
_min_spacebg_slaves
the parameter that allows user to set minimum number of space BG slaves
_max_spacebg_tasks
the parameter that specifies the maximum number of space BG tasks
_max_spacebg_msgs_percentage
the parameter that specifies percentage of _messages (ksaxxm) before KTSJ
throttling occurs. Default level is 50%. When throttle level is reached,
interrupt messages are not sent (thus avoiding _messages queue).
_enable_space_preallocation 3 enable space pre-allocation
_enable_spacebg TRUE enable space management background task
_max_spacebg_slaves 1024 maximum space management background slaves
_minmax_spacebg_slaves 8 min-max space management background slaves
_min_spacebg_slaves 2 minimum space management background slaves
_max_spacebg_tasks 8192 maximum space management background tasks
_max_spacebg_msgs_percentage 50 maximum space management interrupt message throttling
對于由于SMCO 或W00n在完成space preallocation過程中遇到的問題時,可以考慮禁用該特性,具體方法為:
SQL> alter system set "_enable_spacebg"=false; System altered. SQL> alter system set "_enable_space_preallocation"=0; System altered.
SMCO/Wnnn
Short Description: The space management coordinator (SMCO) process coordinates the execution of
various space management related tasks, such as proactive space allocation and space reclamation. It
dynamically spawns slave processes (Wnnn) to implement the task.
Detailed Description: The space management coordinator (SMCO) and slave (Wnnn) processes work
cooperatively on various background space management tasks in a database instance. The coordinator
is responsible for maintaining the tasks and dispatching tasks. It dynamically spawns new slaves based
on task needs. The slave process performs the actual space management task, including space preallocation
and space reclamation. Once started, the slave process acts as an autonomous agent. After
it finishes execution of the task, it automatically pick up another one from the task queue. It terminates
itself after being idle for a long time. SMCO and Wnnn are optional non-fatal background processes.
There is at most one SMCO process per instance. There can be several Wnnn processes at a time. The
failure of these processes does not cause instance to fail.
Properties: Optional, non-fatal, database instance only
Related posts:
原文地址:11g以后的space preallocation特性和SMCO/W00N, 感謝原作者分享。
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com