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 of the index |
|
|
|
Name of the index |
|
|
|
Name of the index partition or subpartition |
|
|
|
Dictionary object ID of the index |
|
|
|
Name of the base table of the index |
|
|
|
Name of the base table partition or subpartition |
|
|
|
Dictionary object ID of the base table |
|
|
|
Physical rowid of the corrupt data row |
|
|
|
Key values for the index entry |
|
|
|
Timestamp when the entry was made into the orphan key table |