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