1、显示特定用户的表
05:54:03 SQL> select table_name ,num_rows,pct_free,blocks,chain_cnt
05:54:36 2 from dba_tables where owner='SCOTT';
TABLE_NAME NUM_ROWS PCT_FREE BLOCKS CHAIN_CNT
------------------------------ ---------- ---------- ---------- ----------
DEPT 5 10 5 0
EMP 14 10 5 0
BONUS 0 10 0 0
SALGRADE 5 10 5 0
LOGTABLE 1 10 5 0
DEPARTMENT 0 40 0 0
SYS_IOT_OVER_54170 10
SALES_INFO_NEW 10
QUEST_SL_TEMP_EXPLAIN1 10
SALES_INFO 0
10 rows selected.
2、显示表列信息
05:56:37 SQL> select column_name ,data_type ,data_length,nullable
05:56:54 2 from dba_tab_columns
05:57:03 3 where owner='SCOTT' AND table_name='EMP';
COLUMN_NAM DATA_TYPE DATA_LENGTH N
---------- ---------- ----------- -
EMPNO NUMBER 22 N
ENAME VARCHAR2 10 Y
JOB VARCHAR2 9 Y
HIREDATE DATE 7 Y
SAL NUMBER 22 Y
COMM NUMBER 22 Y
DEPTNO NUMBER 22 Y
7 rows selected.
3、显示表的注释信息
06:04:32 SQL> COMMENT ON TABLE SCOTT.EMP IS 'store data';
Comment created.
06:04:43 SQL> select comments from dba_tab_comments
06:05:01 2 where owner='SCOTT' AND TABLE_NAME='EMP';
COMMENTS
--------------
store data
4、显示列的注释信息
06:04:32 SQL> COMMENT ON TABLE SCOTT.EMP IS 'store data';
Comment created.
06:18:41 SQL> select comments from dBA_col_comments
06:18:47 2 where owner='SCOTT' and table_name='EMP' AND column_name='ENAME';
COMMENTS
------------
name
5、显示UNUSED 列信息
06:22:04 SQL> select count from dba_unused_col_tabs
06:22:05 2 where owner='SYSTEM' AND table_name='EMP';
no rows selected
6、显示外部表的信息
06:26:06 SQL> select default_directory_name ,access_type
06:26:08 2 from dba_external_tables
06:26:20 3 where owner='SCOTT' AND table_name='EXT_EMP';
no rows selected
7、显示外部表的位置
06:29:07 SQL> select location from dba_external_locations
06:29:13 2 whERE owner='SCOTT' AND table_name='EXT_EMP';
no rows selected
8、显示表段信息
06:31:21 SQL> col segment_type format a12
06:31:35 SQL> col tablespace_name for a15
06:31:46 SQL> select segment_type,tablespace_name,extents,bytes
06:32:09 2 from dba_segments
06:32:17 3 where owner='SCOTT' AND segment_name='EMP';
SEGMENT_TYPE TABLESPACE_NAME EXTENTS BYTES
------------ --------------- ---------- ----------
TABLE USERS 1 65536
06:32:43 SQL>
9、显示行所在实际位置
06:42:05 SQL> select deptno ,dname,dbms_rowid.rowid_relative_fno(rowid) file#,dbms_rowid.rowid_block_number(rowid) block#,dbms_rowid.rowid_row_number(rowid) row# from scott.dept;
DEPTNO DNAME FILE# BLOCK# ROW#
---------- -------------- ---------- ---------- ----------
50 Account 4 14 0
10 ACCOUNTING 4 16 0
20 RESEARCH 4 16 1
30 SALES 4 16 2
40 OPERATIONS 4 16 3
CUUG
更多oracle视频教程请点击:http://crm2.qq.com/page/portalpage/wpa.php?uin=800060152&f=1&ty=1&aty=0&a=&from=6