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

本站中文解释

Oracle视图DBA_ORPHAN_KEY_TABLE用于存储没有主键的表的信息,每当Oracle系统检查表结构Build操作时,会在此表中检查是否存在主键定义,若存在则更新此表。主要用途如下:

1.查看没有任何主键的表:可以使用该视图来查找未定义主键的表。可以使用select语句来查看每张表及其信息,语句如下:

select * from DBA_ORPHAN_KEY_TABLE;

2.查看某表结构:可以使用该视图来查看某表的结构,及表是否被定义成主键,方法如下:

select * from DBA_ORPHAN_KEY_TABLE where table_name = ”;

3.为某表创建主键:可以使用ALTER TABLE命令为某表创建主键,语句如下:

ALTER TABLE ADD PRIMARY KEY ();

官方英文解释

DBA_ORPHAN_KEY_TABLE reports key values from indexes where the underlying base table has block corruptions.

To create the view, run the DBMS_REPAIR.ADMIN_TABLES procedure. To populate the orphan key table for an index, run the DBMS_REPAIR.DUMP_ORPHAN_KEYS procedure on the index. For each key in the index that points to a corrupt data block, Oracle inserts a row into the orphan key table.

Column Datatype NULL Description

SCHEMA_NAME

VARCHAR2(128)

NOT NULL

Schema name of the index

INDEX_NAME

VARCHAR2(128)

NOT NULL

Name of the index

IPART_NAME

VARCHAR2(128)

NULL

Name of the index partition or subpartition

INDEX_ID

NUMBER

NOT NULL

Dictionary object ID of the index

TABLE_NAME

VARCHAR2(128)

NOT NULL

Name of the base table of the index

PART_NAME

VARCHAR2(128)

NULL

Name of the base table partition or subpartition

TABLE_ID

NUMBER

NOT NULL

Dictionary object ID of the base table

KEYROWID

ROWID

NOT NULL

Physical rowid of the corrupt data row

KEY

ROWID

NOT NULL

Key values for the index entry

DUMP_TIMESTAMP

DATE

NOT NULL

Timestamp when the entry was made into the orphan key table


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