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

[经验分享] Oracle v$session_longops 视图说明

[复制链接]

尚未签到

发表于 2016-7-26 09:25:21 | 显示全部楼层 |阅读模式
  一.官网说明
  1.1 v$session_longops
  V$SESSION_LONGOPS displays the status ofvarious operations that run for longer than 6 seconds (in absolute time).These operations currentlyinclude many backup and recovery functions, statistics gathering, and query execution, and more operationsare added for every Oracle release.
  
  To monitor query execution progress, you must be using the cost-based optimizer and you must:
  (1)Set theTIMED_STATISTICSor SQL_TRACE parameters to true
  (2)Gather statistics for your objects with the ANALYZE statement or the DBMS_STATS package
  
  --使用条件
  
  You can add information to this view about application-specific long-running operations by using theDBMS_APPLICATION_INFO.SET_SESSION_LONGOPS procedure.
  
  Column
  Datatype
  Description
  SID
  NUMBER
  Identifier of the session processing the long-running operation. If multiple sessions are cooperating in the long-running operation, then SID corresponds to the main or master session.
  SERIAL#
  NUMBER
  Serial number of the session processing the long-running operation. If multiple sessions are cooperating in the long-running operation, then SERIAL# corresponds to the main or master session. SERIAL# is used to uniquely identify a session's objects. Guaranteesthat session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID.
  OPNAME
  VARCHAR2(64)
  Brief description of the operation
  TARGET
  VARCHAR2(64)
  Object on which the operation is carried out
  TARGET_DESC
  VARCHAR2(32)
  Description of the target
  SOFAR
  NUMBER
  Units of work done so far
  TOTALWORK
  NUMBER
  Total units of work
  UNITS
  VARCHAR2(32)
  Units of measurement
  START_TIME
  DATE
  Starting time of the operation
  LAST_UPDATE_TIME
  DATE
  Time when statistics were last updated for the operation
  TIMESTAMP
  DATE
  Timestamp specific to the operation
  TIME_REMAINING
  NUMBER
  Estimate (in seconds) of time remaining for the operation to complete
  ELAPSED_SECONDS
  NUMBER
  Number of elapsed seconds from the start of the operations
  CONTEXT
  NUMBER
  Context
  MESSAGE
  VARCHAR2(512)
  Statistics summary message
  USERNAME
  VARCHAR2(30)
  User ID of the user performing the operation
  SQL_ADDRESS
  RAW(4 | 8)
  Used with the value of the SQL_HASH_VALUE column to identify the SQL statement associated with the operation
  SQL_HASH_VALUE
  NUMBER
  Used with the value of the SQL_ADDRESS column to identify the SQL statement associated with the operation
  SQL_ID
  VARCHAR2(13)
  SQL identifier of the SQL statement associated with the long operation, if any
  SQL_PLAN_HASH_VALUE
  NUMBER
  SQL plan hash value; NULL if SQL_ID is NULL
  SQL_EXEC_START
  DATE
  Time when the execution of the SQL started; NULL if SQL_ID is NULL
  SQL_EXEC_ID
  NUMBER
  SQL execution identifier (see V$SQL_MONITOR)
  SQL_PLAN_LINE_ID
  NUMBER
  SQL plan line ID corresponding to the long operation; NULL if the long operation is not associated with a line of the execution plan
  SQL_PLAN_OPERATION
  VARCHAR2(30)
  Plan operation name; NULL if SQL_PLAN_LINE_ID is NULL
  SQL_PLAN_OPTIONS
  VARCHAR2(30)
  Plan operation options; NULL if SQL_PLAN_LINE_ID is NULL
  QCSID
  NUMBER
  Session identifier of the parallel coordinator
  
  1.2SQL_TRACE
  Property
  Description
  Parameter type
  Boolean
  Default value
  false
  Modifiable
  ALTER SESSION, ALTER SYSTEM
  Range of values
  true | false
  
  SQL_TRACE enables or disables the SQL trace facility. Setting this parameter to true provides information on tuning that you can use to improve performance.
  
  Caution:
  Using this initialization parameter to enable the SQL trace facility for the entire instance canhave a severe performance impact.Enable the facility for specific sessions using the ALTER SESSION statement. If you must enable the facility on an entireproduction environment, then you can minimize performance impact by:
  (1).Maintaining at least 25% idle CPU capacity
  (2).Maintaining adequate disk space for the USER_DUMP_DEST location
  (3).Striping disk space over sufficient disks
  
  Note:
  The SQL_TRACE parameter is deprecated.Oracle recommends that you use the DBMS_MONITOR and DBMS_SESSION packages instead. SQL_TRACE is retained for backward compatibility only.
  SQL_TRACE已经被弃用了.
  
  1.3TIMED_STATISTICS
  Property
  Description
  Parameter type
  Boolean
  Default value
  If STATISTICS_LEVEL is set to TYPICAL or ALL, then true
  If STATISTICS_LEVEL is set to BASIC, then false
  Modifiable
  ALTER SESSION, ALTER SYSTEM
  Range of values
  true | false
  
  TIMED_STATISTICS specifies whether or not statistics related to time are collected.
  
  Values:
  true:The statistics arecollected and stored in trace files or displayed in the V$SESSTATS and V$SYSSTATS dynamic performance views.
  
  false:The value of all time-related statistics is set to zero. This setting lets Oracle avoid the overhead of requesting the time from the operating system.
  
  Starting with release 11.1.0.7.0, the value of the TIMED_STATISTICS parameter cannot be set to false if the value of STATISTICS_LEVEL is set to TYPICAL or ALL.
  
  On some systems with very fast timer access, Oracle might enable timing even if this parameter is set to false. On these systems, setting the parameter to true can sometimes produce more accurate statistics for long-running operations.
  
  二.相关测试
  
  SYS@anqing2(rac2)> show parameter sql_trace
  NAMETYPEVALUE
  ------------------------------------ ----------- ------------------------------
  sql_tracebooleanFALSE
  
  
  SYS@anqing2(rac2)> show parameter TIMED_STATISTICS
  
  NAMETYPEVALUE
  ------------------------------------ ----------- ------------------------------
  timed_statisticsbooleanTRUE
  
  该视图通常配合V$SESSION视图,来分析SQL运行缓慢的原因。
  
  查询未完成操作的信息
  单实例
  /* Formatted on 2011/6/22 21:20:53 (QP5 v5.163.1008.3004) */
  SELECTsid,
  MESSAGE,
  start_time,
  last_update_time,
  time_remaining,
  elapsed_seconds
  FROMV$SESSION_LONGOPS
  WHEREtime_remaining>0;
  
  RAC
  /* Formatted on 2011/6/22 21:21:27 (QP5 v5.163.1008.3004) */
  SELECTinst_id,
  sid,
  MESSAGE,
  start_time,
  last_update_time,
  time_remaining,
  elapsed_seconds
  FROMGV$SESSION_LONGOPS
  WHEREtime_remaining>0;
  
  -------------------------------------------------------------------------------------------------------

运维网声明 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-249460-1-1.html 上篇帖子: oracle释放temp表空间的方法 下篇帖子: oracle备份与恢复:恢复结构
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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