一. 官网说明

1.1 v$session_longops

V$SESSION_LONGOPS displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution, and more operations are added for every Oracle release.

To monitor query execution progress, you must be using the cost-based optimizer and you must:

(1)Set the TIMED_STATISTICS or 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 the DBMS_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. Guarantees that 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.2  SQL_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 can have a severe performance impact. Enable the facility for specific sessions using the ALTER SESSION statement. If you must enable the facility on an entire production 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.3  TIMED_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 are collected 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

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

sql_trace                            boolean     FALSE

SYS@anqing2(rac2)> show parameter TIMED_STATISTICS

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

timed_statistics                     boolean     TRUE

该视图通常配合V$SESSION视图,来分析SQL运行缓慢的原因。

查询未完成操作的信息

单实例

/* Formatted on 2011/6/22 21:20:53 (QP5 v5.163.1008.3004) */

SELECT sid,

MESSAGE,

start_time,

last_update_time,

time_remaining,

elapsed_seconds

FROM V$SESSION_LONGOPS

WHERE time_remaining > 0;

RAC

/* Formatted on 2011/6/22 21:21:27 (QP5 v5.163.1008.3004) */

SELECT inst_id,

sid,

MESSAGE,

start_time,

last_update_time,

time_remaining,

elapsed_seconds

FROM GV$SESSION_LONGOPS

WHERE time_remaining > 0;

-------------------------------------------------------------------------------------------------------

Blog: http://blog.csdn.net/tianlesoftware

Email: dvd.dba@gmail.com

DBA1 群:62697716(满);   DBA2 群:62697977(满)   DBA3 群:62697850(满)

DBA 超级群:63306533(满);  DBA4 群: 83829929  DBA5群: 142216823

DBA6 群:158654907  聊天 群:40132017   聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

转载于:https://www.cnblogs.com/zlja/archive/2011/06/22/2449627.html

Oracle v$session_longops 视图说明相关推荐

  1. oracle常用的视图和操作

    分享一些oracle常用的视图和操作 官方网址 https://docs.oracle.com/database/121/REFRN/toc.htm 查询数据库逻辑大小 select sum(byte ...

  2. Oracle之物化视图

    近期根据项目业务需要对oracle的物化视图有所接触,在网上搜寻关于这方面的资料,便于提高,整理内容如下: 物化视图是一种特殊的物理表,"物化"(Materialized)视图是相 ...

  3. oracle v$system_event,45.Oracle杂记——Oracle常用动态视图v$system_event

    45.Oracle杂记--Oracle常用动态视图v$system_event 视图v$system_event 显示一个事件的总共等待. 如果不支持计时机制,那么TIME_WAITED和AVERAG ...

  4. oracle中的视图详解

    1.视图的概述 视图其实就是一条查询sql语句,用于显示一个或多个表或其他视图中的相关数据.视图将一个查询的结果作为一个表来使用,因此视图可以被看作是存储的查询或一个虚拟表.视图来源于表,所有对视图数 ...

  5. 创建数据库_详解Oracle数据库物化视图及创建物化视图索引

    概述 物化视图是一种特殊的物理表,"物化"(Materialized)视图是相对普通视图而言的.普通视图是虚拟表,应用的局限性大,任何对视图的查询,Oracle都实际上转换为视图S ...

  6. oracle12c视图刷新,Oracle可更新视图

    在本教程中,您将学习Oracle可更新视图以及如何通过视图在基表中插入或更新数据. 视图就像一个表,因为可以像表一样从中查询数据.但是,不能总是通过视图来操作数据.如果针对视图的语句可以被转换成针对基 ...

  7. oracle v$context,30.Oracle杂记——Oracle常用动态视图v$session

    30.Oracle杂记--Oracle常用动态视图v$session 视图v$session:有关会话的信息 这个视图包含了超级多的列,说明其包含巨大的信息,小伙伴千万要记得使用,不然浪费掉了ORAC ...

  8. Oracle数据库的视图、物化视图、序列、同义词、索引

    Oracle数据库对象 视图 物化视图 序列 同义词 索引 注:以下数据库对象中, 物化视图.序列.同义词为Oracle数据库特有 视图 含义:视图是一种数据库对象,是从一个或者多个数据表或视图中导出 ...

  9. mbk文件导入到oracle,Oracle基于物化视图的远程数据复制

    物化视图简介: 远程表复制功能:可以借助数据库链接(dblink),在远程数据库中建立一个本地表的副本,用该方式实现表的定时同步.物化视图存储基于远程表的数据,也可以称为快照. 加速查询功能:物化视图 ...

最新文章

  1. centos7 系统下搭建 lnmp 环境
  2. 刚看完 Kafka 源码,各位随便问!
  3. scrapy下载中间件设置代理和useraget大全
  4. mysql 移植 azure_初码-Azure系列-记一次MySQL数据库向Azure的迁移
  5. Java多线程的同步机制:synchronized
  6. 无向图:计算亏格(环的孔洞)
  7. TypeError at / __init__() takes exactly 1 argument (2 given)
  8. apache derby_Apache Derby数据库用户和权限
  9. 转usb驱动cmw500 ni_支持USB Type-C接口的外置蓝光驱动器IO Data BRP-UT6 / MC2本月发售...
  10. 8万级自动挡智能SUV,舒适好开是亮点,众泰T600Coupe要逆天?
  11. 程序安装出现错误代码为2869
  12. python颜色表_Python:数据可视化,必须注意的30个小技巧
  13. java实现cas单点登录_CAS单点登录实现步骤
  14. python视频换脸下载_FaceSwap下载|Faceswap(AI视频换脸软件) v1.0官方版(附使用教程)...
  15. 【5G核心网】5GC核心网之网元AUSF
  16. cocoscreator的Bundle加载问题
  17. 车联网中密码技术的探究
  18. python中的连乘_python连乘
  19. 【分布式监控系统】第3章——监控客户端开发
  20. day11 - 每日总结及作业

热门文章

  1. 计算机专业说课,计算机专业课程说课.ppt
  2. python%20是什么类型的语言
  3. 头条搜索已经全面上线,会不会成为下一个流量风口
  4. 我是一名服装公司的老板娘,年收入千万上下
  5. 买二手房已经过户等待银行放款,应该没有变数了吧?
  6. 自驾日产轩逸由沈阳去西藏拉萨,车辆和现在的路况到底行不行?
  7. 历史上的甲子年灾难有哪些?
  8. 两大思维,就可以让你轻松完成任意一个目标
  9. 互‮网联‬上什么人可以‮大赚‬钱?
  10. 做实体行业现在难吗?