设为首页 收藏本站
查看: 958|回复: 0

[经验分享] Oracle 11g SQL Test Case Builder(原创)

[复制链接]

尚未签到

发表于 2016-7-21 11:51:24 | 显示全部楼层 |阅读模式
  Building SQL Test Cases
For many SQL-related problems, obtaining a reproducible test case makes it easier to resolve the problem. Starting with the 11g Release 2 (11.2), Oracle Database contains the SQL Test Case Builder, which automates the somewhat difficult and time-consuming process of gathering and reproducing as much information as possible about a problem and the environment in which it occurred.
SQL Test Case Builder captures information pertaining to a SQL-related problem, along with the exact environment under which the problem occurred, so that you can reproduce and test the problem on a separate database. After the test case is ready, you can upload the problem to Oracle Support to enable support personnel to reproduce and troubleshoot the problem.
The information gathered by SQL Test Case Builder includes the query being executed, table and index definitions (but not the actual data), PL/SQL functions, procedures, and packages, optimizer statistics, and initialization parameter settings.
Creating a Test Case
You can access the SQL Test Case Builder from Enterprise Manager or manually using the DBMS_SQLDIAG package.
Accessing SQL Test Case Builder from Enterprise Manager
From Enterprise Manager, the SQL Test Case Builder is accessible only when a SQL incident occurs. A SQL-related problem is referred to as a SQL incident, and each SQL incident is identified by an incident number. You can access the SQL Test Case Builder from the Support Workbench page in Enterprise Manager.
You can access the Support Workbench page in either of the following ways:

  • In the Database Home page of Enterprise Manager, under Diagnostic Summary, click the link to Active Incidents (indicating the number of active incidents). This opens the Support Workbench page, with the incidents listed in a table.
  • Click Advisor Central under Related Links to open the Advisor Central page. Next, click SQL Advisors and then Click here to go to Support Workbench to open the Support Workbench page.
  From the Support Workbench page, to access the SQL Test Case Builder:

  • Click an incident ID to open the problem details for the particular incident.
  • Next, click Oracle Support in the Investigate and Resolve section.
  • Click Generate Additional Dumps and Test Cases.
  • For a particular incident, click the icon in the Go To Task column to run the SQL Test Case Builder.
  The output of the SQL Test Case Builder is a SQL script that contains the commands required to re-create all the necessary objects and the environment. SQL Test Case Builder stores the file in the following location, where inc_num refers to the incident number and run_num refers to the run number:
$ADR_HOME/incident/incdir_inc_num/SQLTCB_run num
For example, a valid output file name could be as follows:
$ORACLE_HOME/log/diag/rdbms/dbsa/dbsa/incident/incdir_2657/SQLTCB_1
Accessing SQL Test Case Builder Using DBMS_SQLDIAG
You can also invoke the SQL Test Case Builder manually, using the DBMS_SQLDIAG package. This package consists of various subprograms for the SQL Test Case Builder, some of which are listed in Table
SQL Test Case Builder Procedures in DBMS_SQLDIAG
EXPORT_SQL_TESTCASE: Generates a SQL test case
EXPORT_SQL_TESTCASE_DIR_BY_INC: Generates a SQL test case corresponding to the incident ID passed as an argument
EXPORT_SQL_TESTCASE_DIR_BY_TXT: Generates a SQL test case corresponding to the SQL text passed as an argument
  
  参考至:http://docs.oracle.com/cd/E11882_01/server.112/e41573/sql_overview.htm#PFGRF94838
  本文原创,转载请注明出处、作者
  如有错误,欢迎指正
  邮箱:czmcj@163.com

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-247385-1-1.html 上篇帖子: oracle为什么不使用索引 下篇帖子: ORACLE PL/SQL编程--异常错误处理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表