Oracle数据字典视图之DICT
【VIEW】Oracle数据字典视图之DICT_COLUMNS / 2010-10-13 22:41:31/ 个人分类:Oracle 查看( 489 ) /评论( 0 ) / 评分( 0 / 0 ) DICT_COLUMNS 视图记录着 数据字典 表字段的信息,是DICT视图的有效补充 。该 视图 是自我学习和提示的有效手段。 1. DICT_COLU
【VIEW】Oracle数据字典视图之DICT_COLUMNS
/ 2010-10-13 22:41:31/ 个人分类:Oracle
查看( 489 ) /评论( 0 ) / 评分( 0 / 0 )
DICT_COLUMNS视图记录着数据字典表字段的信息,是DICT视图的有效补充。该视图是自我学习和提示的有效手段。1.DICT_COLUMNS视图作用
1)通过COMMENTS字段可获得字段的描述信息,有助于字段的深入理解
sys@ora10g> select * from dict_columns where TABLE_NAME='DICT';
TABLE_NAME COLUMN_NAME COMMENTS
----------------- ------------------------------ --------------------
DICT TABLE_NAME Name of the object
DICT COMMENTS Text comment on the object
2)查询都有哪些表包含指定的字段
sys@ora10g> select * from dict_columns where COLUMN_NAME='TABLE_NAME' and rownum
TABLE_NAME COLUMN_NAME COMMENTS
----------------- ------------------------------ ---------------------
USER_CATALOG TABLE_NAME Name of the object
ALL_CATALOG TABLE_NAME Name of the object
DBA_CATALOG TABLE_NAME Name of the object
3)查询哪些表具有超级多的字段
sys@ora10g>SELECT *
FROM (SELECT table_name, COUNT (*)
FROM dict_columns
GROUP BY table_name
ORDER BY 2 DESC)
WHERE ROWNUM
TABLE_NAME COUNT(*)
------------------------------ ----------
GV$SESSION 81
V$SESSION 80
GV$SQL 72
V$SQL 71
GV$SQL_PLAN_STATISTICS_ALL 69
GV$SQLAREA 68
V$SQL_PLAN_STATISTICS_ALL 68
GV$DISPATCHER_RATE 67
V$SQLAREA 67
9 rows selected.
从上面的查询中可以看出GV$SESSION视图包含的字段最多,共包含81列!
利用这个方法也可以对具体项目中数据库设计进行评估,对包含过多列的表进行重点的评审,防止设计缺陷。
2.视图DICT_COLUMNS的出处——catalog.sql
我们可以在catalog.sql脚本中找到DICT_COLUMNS的创建语句,这些内容是理解DICT_COLUMNS的实现非常有帮助。
create or replace view DICT_COLUMNS
(TABLE_NAME, COLUMN_NAME, COMMENTS)
as
select o.name, c.name, co.comment$
from sys.com$ co, sys.col$ c, sys.obj$ o
where o.owner# = 0
and o.type# = 4
and (o.name like 'USER%'
or o.name like 'ALL%'
or (o.name like 'DBA%'
and exists
(select null
from sys.v$enabledprivs
where priv_number = -47 /* SELECT ANY TABLE */)
)
)
and o.obj# = c.obj#
and c.obj# = co.obj#(+)
and c.col# = co.col#(+)
and bitand(c.property, 32) = 0 /* not hidden column */
union all
select o.name, c.name, co.comment$
from sys.com$ co, sys.col$ c, sys.obj$ o
where o.owner# = 0
and o.name in ('AUDIT_ACTIONS','DUAL','DICTIONARY', 'DICT_COLUMNS')
and o.obj# = c.obj#
and c.obj# = co.obj#(+)
and c.col# = co.col#(+)
and bitand(c.property, 32) = 0 /* not hidden column */
union all
select so.name, c.name, co.comment$
from sys.com$ co,sys.col$ c, sys.obj$ ro, sys.syn$ sy, sys.obj$ so
where so.type# = 5
and so.owner# = 1
and so.obj# = sy.obj#
and so.name sy.name
and sy.owner = 'SYS'
and sy.name = ro.name
and ro.owner# = 0
and ro.type# = 4
and ro.obj# = c.obj#
and c.col# = co.col#(+)
and bitand(c.property, 32) = 0 /* not hidden column */
and c.obj# = co.obj#(+)
/
comment on table DICT_COLUMNS is
'Description of columns in data dictionary tables and views'
/
comment on column DICT_COLUMNS.TABLE_NAME is
'Name of the object that contains the column'
/
comment on column DICT_COLUMNS.COLUMN_NAME is
'Name of the column'
/
comment on column DICT_COLUMNS.COMMENTS is
'Text comment on the object'
/
create or replace public synonym DICT_COLUMNS for DICT_COLUMNS
/
grant select on DICT_COLUMNS to PUBLIC with grant option
/
3.oracle官方文档中的描述
参考链接:http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_4195.htm#sthref1972
DICT_COLUMNS
DICT_COLUMNS
contains descriptions of columns in data dictionary tables and views.
Column | Datatype | NULL | Description |
---|---|---|---|
TABLE_NAME |
VARCHAR2(30) |
Name of the object that contains the column | |
COLUMN_NAME |
VARCHAR2(30) |
Name of the column | |
COMMENTS |
VARCHAR2(4000) |
Text comment on the column |
4.与表字段描述相关的其他视图
根据DICT_COLUMNS视图的功能,我们可以在系统中通过DICT视图获得与表字段有关的视图。
sys@ora10g> select table_name from dict where table_name like '%COLUMNS%' order by 1;
TABLE_NAME
------------------------------
ALL_APPLY_CONFLICT_COLUMNS
ALL_APPLY_KEY_COLUMNS
ALL_APPLY_TABLE_COLUMNS
ALL_AUDIT_POLICY_COLUMNS
ALL_CONS_COLUMNS
ALL_CONS_OBJ_COLUMNS
ALL_ENCRYPTED_COLUMNS
ALL_IND_COLUMNS
ALL_JOIN_IND_COLUMNS
ALL_LOG_GROUP_COLUMNS
ALL_PART_KEY_COLUMNS
ALL_PUBLISHED_COLUMNS
ALL_REPFLAVOR_COLUMNS
ALL_REPKEY_COLUMNS
ALL_SUBPART_KEY_COLUMNS
ALL_SUBSCRIBED_COLUMNS
ALL_TAB_COLUMNS
ALL_UPDATABLE_COLUMNS
DBA_APPLY_CONFLICT_COLUMNS
DBA_APPLY_KEY_COLUMNS
DBA_APPLY_TABLE_COLUMNS
DBA_AUDIT_POLICY_COLUMNS
DBA_CLU_COLUMNS
DBA_CONS_COLUMNS
DBA_CONS_OBJ_COLUMNS
DBA_ENCRYPTED_COLUMNS
DBA_IND_COLUMNS
DBA_JOIN_IND_COLUMNS
DBA_LOG_GROUP_COLUMNS
DBA_OLDIMAGE_COLUMNS
DBA_PART_KEY_COLUMNS
DBA_PUBLISHED_COLUMNS
DBA_REPFLAVOR_COLUMNS
DBA_REPKEY_COLUMNS
DBA_SUBPART_KEY_COLUMNS
DBA_SUBSCRIBED_COLUMNS
DBA_TAB_COLUMNS
DBA_UPDATABLE_COLUMNS
DICT_COLUMNS
USER_AUDIT_POLICY_COLUMNS
USER_CLU_COLUMNS
USER_CONS_COLUMNS
USER_CONS_OBJ_COLUMNS
USER_ENCRYPTED_COLUMNS
USER_IND_COLUMNS
USER_JOIN_IND_COLUMNS
USER_LOG_GROUP_COLUMNS
USER_OLDIMAGE_COLUMNS
USER_PART_KEY_COLUMNS
USER_PUBLISHED_COLUMNS
USER_REPFLAVOR_COLUMNS
USER_REPKEY_COLUMNS
USER_SUBPART_KEY_COLUMNS
USER_SUBSCRIBED_COLUMNS
USER_TAB_COLUMNS
USER_UPDATABLE_COLUMNS
56 rows selected.
5.小结
Oracle提供了很多用于自我理解和学习的途径。很多视图本身就是工具。
Good luck.
secooler
10.10.13
-- The End --
来自http://space.itpub.net/519536/viewspace-571453

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.
