V$LOGMNR_CONTENTS各字段的意思

本文详细介绍了Oracle数据库中V$LOGMNR_CONTENTS视图的结构与用途,该视图提供了日志历史记录信息,包括系统变更号、事务提交时间戳、线程数等关键字段,以及如何通过查询此视图来获取数据库更改详情。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

V$LOGMNR_CONTENTS视图包含日志历史记录信息。

查询此视图的用户,必须有select any transaction权限。查询此视图将按顺序读取归档的redo log文件。

数据类型描述
SCNNUMBER

System change number,oracle为了避免操作系统时间不同步等问题自己定义的在某个时间点定义数据库已提交版本的时间戳标记。

oracle为每个已提交的事务分配唯一的scn

CSCNNUMBER提交事务时的系统更改号scn;仅当DBMS_LOGMNR.START_LOGMNR()中启用COMMITTED_DATA_ONLY选项才有意义
TIMESTAMPDATE更改数据库时的时间戳
COMMIT_TIMESTAMPDATE事务提交时的时间戳。仅当DBMS_LOGMNR.START_LOGMNR()中启用COMMITTED_DATA_ONLY选项才有意义
THREAD#NUMBER对数据库进行更改的线程数
LOG_IDNUMBER此列已过期
XIDUSNNUMBERTransaction ID undo segment number of the transaction that generated the change
XIDSLTNUMBERTransaction ID slot number of the transaction that generated the change
XIDSQNNUMBER

Transaction ID sequence number of the transaction that generated the change

PXIDUSNNUMBERParent transaction ID undo segment number of a parallel transaction
PXIDSLTNUMBERParent transaction ID slot number of a parallel transaction
PXIDSQNNUMBERParent transaction ID sequence number of a parallel transaction
RBASQNNUMBERSequence# associated with the Redo Block Address (RBA) of the redo record associated with the change
RBABLKNUMBERRBA block number within the log file
RBABYTENUMBERRBA byte offset within the block
UBAFILNUMBERUndo Block Address (UBA) file number identifying the file containing the undo block
UBABLKNUMBERUBA block number for the undo block
UBARECNUMBERUBA record index within the undo block
UBASQNNUMBERUBA undo block sequence number
ABS_FILE#NUMBERData block absolute file number of the block changed by the transaction
REL_FILE#NUMBERData block relative file number. The file number is relative to the tablespace of the object
DATA_BLK#NUMBERData block number within the file
DATA_OBJ#NUMBERData block object number identifying the object
DATA_OBJD#NUMBERData block data object number identifying the object within the tablespace
SEG_OWNERVARCHAR2(32)被修改段的owner,对应库表操作的模式名
SEG_NAMEVARCHAR2(256)被修改数据段的名称,对应表名
TABLE_NAMEVARCHAR2(32)被修改的表名
SEG_TYPENUMBER修改数据段的类型. 值如下:
  • 0 = UNKNOWN

  • 1 = INDEX

  • 2 = TABLE

  • 19 = TABLE 分区

  • 20 = INDEX 分区

  • 34 = TABLE 子分区

  • 其他= UNSUPPORTED

SEG_TYPE_NAMEVARCHAR2(32)
  • UNKNOWN

  • INDEX

  • TABLE

  • TABLE PARTITION

  • UNSUPPORTED

  • TABLE_SPACE

TABLE_SPACEVARCHAR2(32)表空间。对于OPERATION列为ddl的行,不会填充此列。因为DDL语句可能操作多个表空间
ROW_IDVARCHAR2(18)所修改行的rowid。只有redo record与DML语句有关时才有值,否则为null
SESSION#NUMBERSession number of the session that made the change
SERIAL#NUMBERSerial number of the session that made the change
USERNAMEVARCHAR2(30)哪个用户执行的此事务。值可能是unkown
SESSION_INFOVARCHAR2(4000)

值可能是unkown

Information about the database session that executed the transaction. Contains process information, machine name from which the user logged in etc. A possible SESSION_INFO column may contain the following:

  • login_username = HR

  • client_info =

  • OS_username = jkundu

  • Machine_name = nirvan

  • OS_terminal = pts/31

  • OS_program_name = sqlplus@nirvan (TNS V1-V3)

TX_NAMEVARCHAR2(256)事务名,仅在此事务是一个named事务时有效
ROLLBACKNUMBER

1 表示存在关联事务的部分或者全部回滚的redo 记录

0 表示不存在

OPERATIONVARCHAR2(32) Possible values are:
  • INSERT = change was caused by an insert statement

  • UPDATE = change was caused by an update statement

  • DELETE = change was caused by a delete statement

  • DDL = change was caused by a DDL statement

  • START = change was caused by the start of a transaction

  • COMMIT = change was caused by the commit of a transaction

  • ROLLBACK = change was caused by a full rollback of a transaction

  • LOB_WRITE = change was caused by an invocation of DBMS_LOB.WRITE

  • LOB_TRIM = change was caused by an invocation of DBMS_LOB.TRIM

  • LOB_ERASE = change was caused by an invocation of DBMS_LOB.ERASE

  • SELECT_FOR_UPDATE = operation was a SELECT FOR UPDATE statement

  • SEL_LOB_LOCATOR = operation was a SELECT statement that returns a LOB locator

  • MISSING_SCN = LogMiner encountered a gap in the redo records. This is most likely because not all redo logs were registered with LogMiner.

  • INTERNAL = change was caused by internal operations initiated by the database

  • UNSUPPORTED = change was caused by operations not currently supported by LogMiner (for example, changes made to tables with ADT columns)

OPERATION_CODENUMBERNumber of the operation code. Possible values are:
  • 0 = INTERNAL

  • 1 = INSERT

  • 2 = DELETE

  • 3 = UPDATE

  • 5 = DDL

  • 6 = START

  • 7 = COMMIT

  • 9 = SELECT_LOB_LOCATOR

  • 10 = LOB_WRITE

  • 11 = LOB_TRIM

  • 25 = SELECT_FOR_UPDATE

  • 28 = LOB_ERASE

  • 34 = MISSING_SCN

  • 36 = ROLLBACK

  • 255 = UNSUPPORTED

SQL_REDOVARCHAR2(4000)Reconstructed SQL statement that is equivalent to the original SQL statement that made the change. Please refer to Oracle Database Utilities before executing SQL_REDO to your database.

LogMiner does not generate SQL redo for temporary tables. In such a case, this column will contain the string "/* No SQL_REDO for temporary tables */".

SQL_UNDOVARCHAR2(4000)Reconstructed SQL statement that can be used to undo the effect of the original statement that made the change. DDL statements have no corresponding SQL_UNDO. Please refer to Oracle Database Utilities before executing SQL_UNDO to your database.

LogMiner does not generate SQL undo for temporary tables. In such a case, this column will contain the string "/* No SQL_UNDO for temporary tables */".

RS_IDVARCHAR2(32)Record set ID. The tuple (RS_ID, SSN) together uniquely identifies a row in V$LOGMNR_CONTENTS. RS_ID uniquely identifies the redo record that generated the row.
SEQUENCE#NUMBER包含于数据库更改相对应的redo record的redo log的序列号
SSNNUMBERSQL sequence number. Used in conjunction with RS_ID, this uniquely identifies a row in the V$LOGMNR_CONTENTS view.
CSFNUMBERContinuation SQL flag. Possible values are:
  • 0 表示sql_redo, sql_undo在同一行

  • 1 表示sql_redo或者sql_undo的大小大于4000个字节,并在视图的下一行中返回

INFOVARCHAR2(32)Informational message about the row. For instance, the string "USER DDL" in INFO column indicates that the DDL statement returned in SQL_REDO column was the top-level DDL executed by the user and the string "INTERNAL DDL" in INFO column indicates that DDL statement returned in SQL_REDO column was executed internally by the RDBMS.
STATUSNUMBER

0表示sql_redo,sql_undo中的sql语句是可以执行的

否则,sql语句无法执行。可能是因为没有将数据字典提供给logminer或者提供的数字字典没有需要的对象

REDO_VALUENUMBER用作DBMS_LOGMNR.MINE_VALUE(), DBMS_LOGMNR.COLUMN_PRESENT() 的输入参数
UNDO_VALUENUMBER同上
SQL_COLUMN_TYPEVARCHAR2(30)This column is deprecated.
SQL_COLUMN_NAMEVARCHAR2(30)This column is deprecated.
REDO_LENGTHNUMBERThis column is deprecated.
REDO_OFFSETNUMBERThis column is deprecated.
UNDO_LENGTHNUMBERThis column is deprecated.
UNDO_OFFSETNUMBERThis column is deprecated.
DATA_OBJV#NUMBERVersion number of the table being modified
SAFE_RESUME_SCNNUMBER保留字段
XIDRAW(8)原始二进制类型的事务标识符
PXIDRAW(8)原始二进制类型的父事务标识符
AUDIT_SESSIONIDNUMBERAudit session ID associated with the user session making the change

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值