Oracle 11g SPM Usage Guide

本文介绍了Oracle11g中的SQL计划管理(SPM)功能,包括如何自动捕获执行计划、使用SQL调优集(STS)稳定执行计划及跨系统迁移STS的方法。通过这些步骤,可以确保从Oracle10g到11g升级过程中执行计划的一致性和稳定性。

DBA Notes: 2011/11/01

Cheng Li

 

Oracle 11g SPM Usage Guide

 

Capturing Plans Automatically

Automatic plan capture can be switched on by setting the init.ora parameter optimizer_capture_sql_plan_baselines to true. When automatic plan capture is on the SPM repository will be automatically populated for any repeatable SQL statement. To identify repeatable SQL statements the optimizer will log the identity of each SQL statement into a statement log, the first time it is compiled. After a SQL statement’s identity has been logged, if it is processed again (i.e. executed or compiled) the presence of its identity in the statement log will signify it to be a repeatable statement. A SQL plan history will be created and the current or cost-base plan will be added as the first plan baseline. Perform. the following steps

Capture Plan using a SQL Tuning Set or SQL ID

 

1 Using a SQL Tuning Set (STS)

You can use a SQL Tuning set to Capture plan details for a (critical) set of SQL Statements. This is one way to ensure there will be no unwanted plan changes when upgrading from 10g to 11g. Perform. the following steps:

1)       Create a SQL Tuning Set and load the plan

SQL>exec dbms_sqltune.create_sqlset(sqlset_name => ‘spm_sts’, sqlset_owner => ‘ORACLE’);

2)       Populate the SQL Tuning set with the Critical SQL

Use dbms_sqltune.select_cursor_cache and dbms_sqltune.load_sqlset

 

2 Load from cursor

You can load plans straight from the cursor cache using dbms_spm.load_plans_from_cursor_cache. It is possible to load plans for all of the statements in the cursor cache or you can apply a filter on the module name or schema name, etc. The next time these statements are executed their baseline plans will be used.

 

Managing Plans

Each time a SQL Statement is compiled, the optimizer first uses the traditional cost-based search method to build a best-cost plan. If the initialization parameter OPTIMIZER_USE_SQL_PLAN_BASELINES is set to TRUE (default value) it will then try to find a patching plan in the SQL plan baseline. If a match is found then it proceeds as usual. Otherwise, it first adds the new plan to the plan history, and then it costs each of the accepted plans in the SQL plan baseline and picks the one with the lowest cost.

Maintain Execution plan stability after migration

But with this new 11g feature, if we have tried and trusted 10g execution plans in place, we can ensure that the same plans will be used by the optimizer even after the migration unless new 11g plans are found to offer better performance. This can be achieved by capturing 10g plans in SQL tuning sets (STS) and exporting those to the 11g database.

The Oracle documentation describes the components of a SQL Tuning set as the following:

§         A set of SQL statements.

§         Associated execution context, such as user schema, application module name and action, list of bind values, and the cursor compilation environment.

§         Associated basic execution statistics, such as elapsed time, CPU time, buffer gets, disk reads, rows processed, cursor fetches, the number of executions, the number of complete executions, optimizer cost, and the command type.

All together, an STS encapsulates a set of SQL statements and generates SQL profiles that allow implementation of any recommended changes to the SQL execution plan. The following section shows how to create a SQL tuning set.

This section covers the following topics:

·         Creating a SQL Tuning Set

·         Loading a SQL Tuning Set

·         Displaying the Contents of a SQL Tuning Set

·         Modifying a SQL Tuning Set

·         Transporting a SQL Tuning Set

·         Dropping a SQL Tuning Set

·         Additional Operations on SQL Tuning Sets

 

Reference:

http://blog.itpub.net/post/11835/474845

http://st-curriculum.oracle.com/obe/db/11g/r1/prod/manage/spm/spm.htm

http://gavinsoorma.com/2009/07/11g-optimizer-plan-stabilty-using-sql-plan-baselines/

http://www.dba-oracle.com/oracle10g_tuning/t_sql_tuning_sets.htm

http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_tune.htm#CHDBIGDF

 

12.3.5 Transporting a SQL Tuning Set

SQL Tuning Sets can be transported to another system by first exporting the STS from one system to a staging table, then importing the STS from the staging table into another system.

To transport a SQL Tuning Set:

1.    Use the CREATE_STGTAB_SQLSET procedure to create a staging table where the SQL Tuning Sets will be exported.

The following example shows how to create a staging table named staging_table.

BEGIN
  DBMS_SQLTUNE.CREATE_STGTAB_SQLSET( table_name => 'staging_table' );
END;
/

2.    Use the PACK_STGTAB_SQLSET procedure to export SQL Tuning Sets into the staging table.

The following example shows how to export a SQL Tuning Set named my_sts to the staging table.

BEGIN
  DBMS_SQLTUNE.PACK_STGTAB_SQLSET(
      sqlset_name  => 'my_sts',
      staging_table_name => 'staging_table');
END;
/

3.    Move the staging table to the system where the SQL Tuning Sets will be imported using the mechanism of choice (such as datapump or database link).

4.    On the system where the SQL Tuning Sets will be imported, use the UNPACK_STGTAB_SQLSET procedure to import SQL Tuning Sets from the staging table.

The following example shows how to import SQL Tuning Sets contained in the staging table.

BEGIN
  DBMS_SQLTUNE.UNPACK_STGTAB_SQLSET(
      sqlset_name  => '%',
      replace  => TRUE,
      staging_table_name => 'staging_table');
END;
/

 

fj.png干露露.jpg

fj.png干露露3.jpg

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26136400/viewspace-710026/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26136400/viewspace-710026/

物联网通信协议测试是保障各类设备间实现可靠数据交互的核心环节。在众多适用于物联网的通信协议中,MQTT(消息队列遥测传输)以其设计简洁与低能耗的优势,获得了广泛应用。为确保MQTT客户端与服务端的实现严格遵循既定标准,并具备良好的互操作性,实施系统化的测试验证至关重要。 为此,采用TTCN-3(树表结合表示法第3版)这一国际标准化测试语言构建的自动化测试框架被引入。该语言擅长表达复杂的测试逻辑与数据结构,同时保持了代码的清晰度与可维护性。基于此框架开发的MQTT协议一致性验证套件,旨在自动化地检验MQTT实现是否完全符合协议规范,并验证其与Eclipse基金会及欧洲电信标准化协会(ETSI)所发布的相关标准的兼容性。这两个组织在物联网通信领域具有广泛影响力,其标准常被视为行业重要参考。 MQTT协议本身存在多个迭代版本,例如3.1、3.1.1以及功能更为丰富的5.0版。一套完备的测试工具必须能够覆盖对这些不同版本的验证,以确保基于各版本开发的设备与应用均能满足一致的质量与可靠性要求,这对于物联网生态的长期稳定运行具有基础性意义。 本资源包内包含核心测试框架文件、一份概述性介绍文档以及一份附加资源文档。这些材料共同提供了关于测试套件功能、应用方法及可能包含的扩展工具或示例的详细信息,旨在协助用户快速理解并部署该测试解决方案。 综上所述,一个基于TTCN-3的高效自动化测试框架,为执行全面、标准的MQTT协议一致性验证提供了理想的技术路径。通过此类专业测试套件,开发人员能够有效确保其MQTT实现的规范符合性与系统兼容性,从而为构建稳定、安全的物联网通信环境奠定坚实基础。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值