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

本站中文解释

Oracle视图DBA_HIST_SQLBIND是Oracle数据库中的历史化系统视图,它可以把应用程序执行的SQL语句及绑定变量信息记录在表中,供问题分析查询。

DBA_HIST_SQLBIND视图提供历史信息,可以查询SQL语句的绑定变量信息。主要信息有:SQL_ID,需要绑定的变量数量,绑定变量的数据类型,值的字节和字符串数,值的大小,命名参数标识等。

使用Oracle视图DBA_HIST_SQLBIND可以实现如下查询功能:
1. 查询已执行的SQL语句及绑定变量的相关信息:可以使用SELECT SQL_ID,绑定变量名称,绑定变量值等内容查询已执行的SQL语句及其执行过程中绑定变量的相关信息。
2. 解决数据库问题:使用DBA_HIST_SQLBIND视图查询应用程序执行的SQL语句及绑定变量的值,从而可以对具体问题进行排查,从而解决应用程序运行中出现的数据库问题。

官方英文解释

DBA_HIST_SQLBIND displays historical information on bind variables used by SQL cursors.

This view contains snapshots of V$SQL_BIND_CAPTURE.

Column Datatype NULL Description

SNAP_ID

NUMBER

NOT NULL

Unique snapshot ID

DBID

NUMBER

NOT NULL

Database ID for the snapshot

INSTANCE_NUMBER

NUMBER

NOT NULL

Instance number for the snapshot

SQL_ID

VARCHAR2(13)

NOT NULL

SQL identifier of the parent cursor in the library cache

NAME

VARCHAR2(128)

Name of the bind variable

POSITION

NUMBER

NOT NULL

Position of the bind variable in the SQL statement

DUP_POSITION

NUMBER

If the binding is performed by name and the bind variable is duplicated, then this column gives the position of the primary bind variable.

DATATYPE

NUMBER

Internal identifier for the bind data type. Beginning in Oracle Database 12c, a number representing a PL/SQL data type can appear in this column.

DATATYPE_STRING

VARCHAR2(15)

Textual representation of the bind data type. Beginning in Oracle Database 12c, a text representation of a PL/SQL-only data type can appear in this column. If the actual data type is a PL/SQL sub type, the name of the data type, not the sub type will be displayed.

CHARACTER_SID

NUMBER

National character set identifier

PRECISION

NUMBER

Precision (for numeric binds)

SCALE

NUMBER

Scale (for numeric binds)

MAX_LENGTH

NUMBER

Maximum bind length

WAS_CAPTURED

VARCHAR2(3)

Indicates whether the bind value was captured (YES) or not (NO)

LAST_CAPTURED

DATE

Date when the bind value was captured. Bind values are captured when SQL statements are executed. To limit the overhead, binds are captured at most every 15 minutes for a given cursor.

VALUE_STRING

VARCHAR2(4000)

Value of the bind represented as a string

VALUE_ANYDATA

ANYDATA

Value of the bind represented using the self-descriptive Sys.AnyData data type. This representation is useful to programmatically decode the value of the bind variable. This column is NULL if a PL/SQL-only data type appears in the DATATYPE column.

CON_DBID

NUMBER

The database ID of the PDB for the sampled session

CON_ID

NUMBER

The ID of the container that CON_DBID identifies. 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_BIND_CAPTURE”


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