热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

11g以后的spacepreallocation特性和SMCO/W00N

11g以后oracle引入了智能空间预分配spacepreallocation的新特性,该新特性涉及3个领域:表空间的预分配和扩展数据段segment的预分配和扩展LOBchunk的预分配和扩展以下是一个tablespace预分配和扩展的例子,可以看到某个表空间对应的FILE#3的数据文件

11g以后oracle引入了智能空间预分配space preallocation的新特性,该新特性涉及3个领域: 表空间的预分配和扩展 数据段segment的预分配和扩展 LOB chunk的预分配和扩展 以下是一个tablespace 预分配和扩展的例子,可以看到某个表空间对应的FILE#=3的数据文件

11g以后oracle引入了智能空间预分配space preallocation的新特性,该新特性涉及3个领域:

  • 表空间的预分配和扩展
  • 数据段segment的预分配和扩展
  • LOB chunk的预分配和扩展

以下是一个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分钟分析一次,基于以下的数据分析:

  • Database id – Database identifier
  • Tablespace id – Tablespace identifier number
  • Creation SCN (wrap, base) [NEW] – SCN when the tablespace is created. This is for tablespace sanity check in case that the tablespace is?dropped or recreated after the statistics is collected.
  • Allocated space – Space allocated to the tablespace
  • Used space – Space currently used in the tablespace. For permanent tablespace, it is represented by the used extents. For temporary?tablespace, this should be the space used by active sorts, hash joins and other transient objects.
  • Max size – Maximum size of the tablespace
  • Flag – Tablespace flag (e.g. perm/temp/undo)
  • Stat-collection Timestamp [NEW] – The time when the statistics is collected

对于数据段segment预分配,数据段的统计信息会每半个小时flush到AWR中(WRH$_SEG_STAT),Segment growth trend数据段的增长趋势也会每半个小时完成一次, 基于以下的数据分析:

  • Tablespace id
  • Tablespace creation SCN (wrap, base) [NEW]
  • Segment obj#
  • Segment dataobj#
  • Number of allocated blocks
  • Number of used blocks
  • Stat-collect Timestamp [NEW] – The time when the statistics is collected
  • Last-analysis timestamp [NEW] – The time when the segment is analyzed the last time
  • Number of forecasted used blocks [NEW]

LOB chunk的使用情况 会每10分钟记录在内存中,也会定期flush到AWR中,基于以下的数据分析:

  • Instance id
  • Tablespace id
  • Tablespace creation SCN (wrap, base)
  • Segment obj#
  • Segment dataobj#
  • Number of estimated optimal allocation for each chunk size (Ne) – One occurrence of an allocation for a chunk size refers to a planned
  • allocation of the optimal chunk size that is calculated by the space layer when receiving a chunk allocation request from the data layer.
  • Number of allocations for each chunk size (Na)
  • Number of deallocation for each chunk size (Nd)
  • Number of under-allocation for each chunk size (Nu)
  • Number of split for each chunk size (Ns)
  • Number of projected allocations for each chunk size (Np)
  • Timestamp – The time when the statistics is collected

这些预分配和扩展任务主要由SMCO(Space Management Coordinator Process)和其小工进程W00n(slave )一起完成。 SMCO和W00n是基于任务task驱动的后台任务Framework。这个后台任务体系是基于实例的,而非基于数据库的。每一个实例instance有其自己的后台任务服务体系,运行和处理在本实例发起的任务。RAC的不同实例之间不会交互来负责此种任务的负载。

Task coordinator ( SMCO ) ,SMCO充当调度进程以便管理任务队列和slave进程池。其主要任务是在几个task queue之间移动任务,清理过期任务,基于任务需要来动态分配新的slave(W00n)进程,并监控slave进程。 一个实例只有一个SMCO进程,且SMCO进程不是fatal进程,kill了一般也没事。

部分12c新特性?Policy Driven Data Movement and ILM(Information Lifecycle Management) Project 数据生命周期管理也依赖于SMCO后台进程。

SMON,SMON是老牌后台进程 已经负责了一系列任务。其现在也负载动态启动SMCO进程。SMON现在会定期检查SMCO是否启动着,SMON也会当有任务提交时启动SMCO。

W00n等一组Slave Process,Slave进程总是实际干活的人。Salve process由SMCO这个调度器动态分配。一旦启动后,slave 进程将自主工作,其自动从ready-task队列中找寻任务并执行。如果空闲了过长时间,那么W00n也会自行终止。

其大致的工作流程如下:

  • The foreground system/user session submits a task through ktsjCreateTask.
  • The task is created. If the task is planned to start right away, it is inserted into one of the ready-task queue directly, otherwise, it isinserted into the not-ready-task queue.
  • If SMCO does not exist, post SMON to start SMCO .
  • If SMCO is available, post SMCO that a new task is available.
  • SMCO knows that there is a task that needs to be run in the near future. It starts a slave process.
  • SMCO moves the task from the not-ready queue to the ready queue and posts any waiting slave.
  • The slave process picks up the task from the ready queue and invokes the task’s callback function.
  • The task is done. The slave process executes the completion call back of the task.
  • The slave process post SMCO that a task is finished. askmaclean.com
  • SMCO updates task execution statistics and may choose to free the task if there is no enough memory for task cache.
  • The slave process periodically checks if there is any task in the ready-task queue.

与该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:

  1. enq: HW – contention等待事件
  2. Learning 11g New Background Processes
  3. 【12c新特性】dbms_stats report_gather_auto_stats统计信息报告特性
  4. x$ksusecst 内部视图详解
  5. Oracle Streams流复制性能优化脚本

推荐阅读
  • EPICS Archiver Appliance存储waveform记录的尝试及资源需求分析
    本文介绍了EPICS Archiver Appliance存储waveform记录的尝试过程,并分析了其所需的资源容量。通过解决错误提示和调整内存大小,成功存储了波形数据。然后,讨论了储存环逐束团信号的意义,以及通过记录多圈的束团信号进行参数分析的可能性。波形数据的存储需求巨大,每天需要近250G,一年需要90T。然而,储存环逐束团信号具有重要意义,可以揭示出每个束团的纵向振荡频率和模式。 ... [详细]
  • 本文介绍了如何使用Power Design(PD)和SQL Server进行数据库反向工程的方法。通过创建数据源、选择要反向工程的数据表,PD可以生成物理模型,进而生成所需的概念模型。该方法适用于SQL Server数据库,对于其他数据库是否适用尚不确定。详细步骤和操作说明可参考本文内容。 ... [详细]
  • 本文介绍了如何使用php限制数据库插入的条数并显示每次插入数据库之间的数据数目,以及避免重复提交的方法。同时还介绍了如何限制某一个数据库用户的并发连接数,以及设置数据库的连接数和连接超时时间的方法。最后提供了一些关于浏览器在线用户数和数据库连接数量比例的参考值。 ... [详细]
  • Oracle Database 10g许可授予信息及高级功能详解
    本文介绍了Oracle Database 10g许可授予信息及其中的高级功能,包括数据库优化数据包、SQL访问指导、SQL优化指导、SQL优化集和重组对象。同时提供了详细说明,指导用户在Oracle Database 10g中如何使用这些功能。 ... [详细]
  • 本文介绍了adg架构设置在企业数据治理中的应用。随着信息技术的发展,企业IT系统的快速发展使得数据成为企业业务增长的新动力,但同时也带来了数据冗余、数据难发现、效率低下、资源消耗等问题。本文讨论了企业面临的几类尖锐问题,并提出了解决方案,包括确保库表结构与系统测试版本一致、避免数据冗余、快速定位问题等。此外,本文还探讨了adg架构在大版本升级、上云服务和微服务治理方面的应用。通过本文的介绍,读者可以了解到adg架构设置的重要性及其在企业数据治理中的应用。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文介绍了使用postman进行接口测试的方法,以测试用户管理模块为例。首先需要下载并安装postman,然后创建基本的请求并填写用户名密码进行登录测试。接下来可以进行用户查询和新增的测试。在新增时,可以进行异常测试,包括用户名超长和输入特殊字符的情况。通过测试发现后台没有对参数长度和特殊字符进行检查和过滤。 ... [详细]
  • 本文详细介绍了MysqlDump和mysqldump进行全库备份的相关知识,包括备份命令的使用方法、my.cnf配置文件的设置、binlog日志的位置指定、增量恢复的方式以及适用于innodb引擎和myisam引擎的备份方法。对于需要进行数据库备份的用户来说,本文提供了一些有价值的参考内容。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 本文由编程笔记小编整理,介绍了PHP中的MySQL函数库及其常用函数,包括mysql_connect、mysql_error、mysql_select_db、mysql_query、mysql_affected_row、mysql_close等。希望对读者有一定的参考价值。 ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • Java String与StringBuffer的区别及其应用场景
    本文主要介绍了Java中String和StringBuffer的区别,String是不可变的,而StringBuffer是可变的。StringBuffer在进行字符串处理时不生成新的对象,内存使用上要优于String类。因此,在需要频繁对字符串进行修改的情况下,使用StringBuffer更加适合。同时,文章还介绍了String和StringBuffer的应用场景。 ... [详细]
  • Oracle分析函数first_value()和last_value()的用法及原理
    本文介绍了Oracle分析函数first_value()和last_value()的用法和原理,以及在查询销售记录日期和部门中的应用。通过示例和解释,详细说明了first_value()和last_value()的功能和不同之处。同时,对于last_value()的结果出现不一样的情况进行了解释,并提供了理解last_value()默认统计范围的方法。该文对于使用Oracle分析函数的开发人员和数据库管理员具有参考价值。 ... [详细]
  • MyBatis错题分析解析及注意事项
    本文对MyBatis的错题进行了分析和解析,同时介绍了使用MyBatis时需要注意的一些事项,如resultMap的使用、SqlSession和SqlSessionFactory的获取方式、动态SQL中的else元素和when元素的使用、resource属性和url属性的配置方式、typeAliases的使用方法等。同时还指出了在属性名与查询字段名不一致时需要使用resultMap进行结果映射,而不能使用resultType。 ... [详细]
author-avatar
宋文哲
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有