[20150402]关于SQL Monitoring.txt

本文涉及的产品
全球加速 GA,每月750个小时 15CU
简介: [20150402]关于SQL Monitoring.txt --今天学习sql monitor,oracle从11g开始,能够记录运行事件较长的sql语句,我自己在工作中很少使用这个功能,前几天看别人在优化时使用, -- 自己也学习学习,这个是学习笔记.

[20150402]关于SQL Monitoring.txt

--今天学习sql monitor,oracle从11g开始,能够记录运行事件较长的sql语句,我自己在工作中很少使用这个功能,前几天看别人在优化时使用,
-- 自己也学习学习,这个是学习笔记.

1.相关参数:
SCOTT@test> @ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.3.0     Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production


SCOTT@test> @hide _sqlmon
NAME                       DESCRIPTION                                                        DEFAULT_VALUE  SESSION_VALUE          SYSTEM_VALUE
-------------------------- ------------------------------------------------------------------ -------------- ---------------------- ----------------------
_sqlmon_binds_xml_format   format of column binds_xml in [G]V$SQL_MONITOR                     TRUE           default                default
_sqlmon_max_plan           Maximum number of plans entry that can be monitored. Defaults to 2 TRUE           80                     80
                           0 per CPU

_sqlmon_max_planlines      Number of plan lines beyond which a plan cannot be monitored       TRUE           300                    300
_sqlmon_recycle_time       Minimum time (in s) to wait before a plan entry can be recycled    TRUE           60                     60
_sqlmon_threshold          CPU/IO time threshold before a statement is monitored. 0 is disabl TRUE           5                      5
                           ed

-- 参数_sqlmon_threshold=5s 控制运行时间超过5s以上的才记录.其它

2.相关视图:
v$sql_monitor

3.也可以通过提示monitor将监测语句加入.
select /*+ monitor */ * from emp ;

4.我写的一些脚本:

$ cat sm.sql

SELECT DBMS_SQLTUNE.REPORT_SQL_MONITOR (sql_id => '&&1', report_level => 'ALL',type=>'TEXT')
          AS report
  FROM DUAL;

$ cat smh.sql
spool aa.html
SELECT DBMS_SQLTUNE.REPORT_SQL_MONITOR (sql_id => '&&1', report_level => 'ALL',type=>'HTML')
          AS report
                    FROM DUAL;
spool off
--host "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" aa.html
host links aa.html

目录
打赏
0
0
0
0
36
分享
相关文章
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
5-10Can't connect to MySQL server on 'sh-cynosl-grp-fcs50xoa.sql.tencentcdb.com' (110)")
|
6月前
|
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client
610 0
|
7月前
|
SQL
解锁 SQL Server 2022的时间序列数据功能
【7月更文挑战第14天】要解锁SQL Server 2022的时间序列数据功能,可使用`generate_series`函数生成整数序列,例如:`SELECT value FROM generate_series(1, 10)。此外,`date_bucket`函数能按指定间隔(如周)对日期时间值分组,这些工具结合窗口函数和其他时间日期函数,能高效处理和分析时间序列数据。更多信息请参考官方文档和技术资料。
111 9
|
7月前
|
SQL Server的并行实施如何优化?
【7月更文挑战第23天】SQL Server的并行实施如何优化?
185 13
SQL Server 查询超时问题排查
【7月更文挑战第8天】排查 SQL Server 查询超时涉及五个主要方面:检查复杂查询、评估服务器性能、审视配置参数、更新统计信息和分析执行计划。关注点包括查询的结构(如连接、子查询和索引),服务器资源(CPU、内存、网络延迟),连接和内存设置,以及统计信息的时效性。通过这些步骤可定位并解决性能瓶颈。
195 0
对比 SQL Server中的VARCHAR(max) 与VARCHAR(n) 数据类型
【7月更文挑战7天】SQL Server 中的 VARCHAR(max) vs VARCHAR(n): - VARCHAR(n) 存储最多 n 个字符(1-8000),适合短文本。 - VARCHAR(max) 可存储约 21 亿个字符,适合大量文本。 - VARCHAR(n) 在处理小数据时性能更好,空间固定。 - VARCHAR(max) 对于大文本更合适,但可能影响性能。 - 选择取决于数据长度预期和业务需求。
594 1