Oracle 视图 V$SQL_WORKAREA_ACTIVE 官方解释,作用,如何使用详细说明

本站中文解释

查看当前活动的SQL工作区
Oracle视图是要查看数据库里当前活动的SQL工作区,该视图能提供当前活动的SQL工作区的详细信息,包括SQL_ID、HASH_VALUE、SEGMENT_NAME、SEGMENT_TYPE和SESSION_ADDR等。

使用视图V$SQL_WORKAREA_ACTIVE的步骤如下:

1. 打开Oracle客户端,连接到数据库。

2. 使用SQL语句select * FROM v$sql_workarea_active;更具V$SQL_WORKAREA_ACTIVE视图查看当前活动的SQL工作区:

3. 执行SQL查询,显示当前活动的SQL工作区的相关信息。

4. 根据需要,可以对SQL查询的结果进行进一步的分析,确定SQL查询的具体原因和原因。

官方英文解释

V$SQL_WORKAREA_ACTIVE contains an instantaneous view of the work areas currently allocated by the system. You can join this view against V$SQL_WORKAREA on WORKAREA_ADDRESS to access the definition of that work area. If a work area spills to disk, then this view contains information for the temporary segment created on behalf of this work area.

The last three columns are included to enable joining V$SQL_WORKAREA_ACTIVE with V$TEMPSEG_USAGE to retrieve more information on this temporary segment.

You can use this view to answer the following:

  • What are the top 10 largest work areas currently allocated in the system?

  • What percentage of memory is over-allocated (EXPECTED_SIZE < ACTUAL_MEM_USED) and under-allocated (EXPECTED_SIZE > ACTUAL_MEM_USED)?

  • What are the active work areas using more memory than what is expected by the memory manager?

  • What are the active work areas that have spilled to disk?

Column Datatype Description

SQL_HASH_VALUE

NUMBER

Hash value of the SQL statement that is currently being executed

SQL_ID

VARCHAR2(13)

SQL identifier of the SQL statement that is currently being executed

SQL_EXEC_START

DATE

Time when the execution of the SQL currently executed by this session started

SQL_EXEC_ID

NUMBER

SQL execution identifier (see V$SQL_MONITOR)

WORKAREA_ADDRESS

RAW(4 | 8)

Address of the work area handle. This is the primary key for the view.

OPERATION_TYPE

VARCHAR2(160)

Type of operation using the work area. Can include values such as SORT, HASH JOIN, GROUP BY, BUFFER, BITMAP MERGE, and BITMAP CONSTRUCTION.

OPERATION_ID

NUMBER

A unique number used to identify the operation in the execution plan. This identifier can be joined to V$SQL_PLAN to locate the operation that uses this work area.

POLICY

VARCHAR2(24)

Sizing policy for this work area (MANUAL or AUTO)

SID

NUMBER

Session identifier

QCINST_ID

NUMBER

Query coordinator instance identifier. Along with QCSID, enables you to uniquely identify the query coordinator.

QCSID

NUMBER

Query coordinator session identifier. This is the same as the SID if the work area is allocated by a serial cursor.

ACTIVE_TIME

NUMBER

Average time this work area is active (in microseconds)

WORK_AREA_SIZE

NUMBER

Maximum size (in bytes) of the work area as it is currently used by the operation

EXPECTED_SIZE

NUMBER

Expected size (in bytes) for this work area. EXPECTED_SIZE is set on behalf of the operation by the memory manager. Memory can be over-allocated when WORK_AREA_SIZE has a higher value than EXPECTED_SIZE. This can occur when the operation using this work area takes a long time to resize it.

ACTUAL_MEM_USED

NUMBER

Amount of PGA memory (in bytes) currently allocated on behalf of this work area. This value should range between 0 and WORK_AREA_SIZE.

MAX_MEM_USED

NUMBER

Maximum memory amount (in bytes) used by this work area

NUMBER_PASSES

NUMBER

Number of passes corresponding to this work area (0 if running in OPTIMAL mode)

TEMPSEG_SIZE

NUMBER

Size (in bytes) of the temporary segment used on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

TABLESPACE

VARCHAR2(128)

Tablespace name for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

SEGRFNO#

NUMBER

Relative file number within the tablespace for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

SEGBLK#

NUMBER

Block number for the temporary segment created on behalf of this work area. This column is NULL if this work area has not (yet) spilled to disk.

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data

See Also:

  • “V$SQL_WORKAREA”

  • Oracle Database
    Concepts
    for more information about SQL work areas


数据运维技术 » Oracle 视图 V$SQL_WORKAREA_ACTIVE 官方解释,作用,如何使用详细说明