Oracle Management Data Dictionary (ii) application of Oracle data dictionary

Source: Internet
Author: User
Tags dname

1. Object definition

When the Create command is executed to create an object, Oracle stores the object definition in the data dictionary.

03:31:40 sql> Select Dbms_metadata.get_ddl (' TABLE ', ' DEPT ') DDL from DUAL;

Ddl

--------------------------------------------------------------------------------

CREATE TABLE "SCOTT". " DEPT "

("DEPTNO" number (2,0),

"Dname" VARCHAR2 (14

2, viewing the space occupied by the object

03:36:48 sql> Conn Scott/tiger

Connected.

03:37:38 sql> Select bytes from user_segments where segment_name= ' EMP ';

BYTES

----------

65536

To view the storage of a segment:

03:40:41 sql> Analyze table emp Compute statistics;

Table analyzed.

03:40:50 sql> Select Empty_blocks,blocks from User_tables;

Empty_blocks BLOCKS

------------ ----------

0 5

3 5

0 0

0 5

0 5

6 rows selected.

03:41:08 sql> Select Empty_blocks,blocks from User_tables

03:41:20 2 where table_name= ' EMP ';

Empty_blocks BLOCKS

------------ ----------

3 5

3. View column Information

03:45:14 sql> Col column_name format A15

03:45:17 sql> Col data_type for A15

03:45:26 sql> Col data_default for A15

03:46:05 sql> Select Column_name,data_type,data_default

03:46:14 2 from User_tab_columns

03:46:23 3 where table_name= ' DEPT ';

column_name data_type Data_default

--------------- --------------- ---------------

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

DEPTNO number

Dname VARCHAR2

LOC VARCHAR2

4. View constraint information

03:52:29 sql> Select A.constraint_name,a.constraint_type,b.column_name,b.position

2 from User_constraints A, user_cons_columns b

3* where A.constraint_name=b.constraint_name and B.table_name= ' EMP '

Constraint_name Constraint_type column_name POSITION

------------------------------ --------------- --------------- ----------

Fk_deptno R DEPTNO 1

Pk_emp P EMPNO 1

5. View user name, permissions, role

4:20:02 sql> Select Username,granted_role from User_role_privs;

USERNAME Granted_role

------------------------------ ------------------------------

Public Plustrace

SCOTT CONNECT

SCOTT RESOURCE

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.