Oracle_071_lesson_p12

數據字典Data Dictionary

管理業務數據 、表、視圖、索引
數據字典:
1、基表 base tables 2、用戶視圖 user accessible views

類型分類:(視圖前綴 view prefix)
1、USER 2、ALL 3、DBA 4、V$ 動態視圖

desc dictionary

含有字段 table_name, comments 註釋
select * from dictionary
where table_name='USER_OBJECTS';

column 列名 format a30 ; 修改顯示的格式

select * from dictionary
where table_name like '%COL%' and table_name like '%TAB%';

select * from dictionary where table_name like '%MEM%';

desc user_objects 用戶對象

select object_name,object_type,status,created
from user_objects
order by object_type;

案例:對象ID 達到10億出現過崩潰的情況;

ALL_OBJECTS

desc user_tables

select table_name,tablespace_name from user_tables;

'%PART%' 分區
PCT_FREE :塊的剩餘
PCT_USED:塊的使用率
DEGREE :並行是否開啓

desc user_tab_columns 表字段

select table_name,column_name
from user_table_columns
where column_name='DEPARTMENT_ID';
查DEPARTMENT_ID在哪些表裏有

desc user_constraints 用戶約束

select constraint_name,constraint_type,search_condition,r_constraint_name,delete_rule,status
from user_constraints
where table_name='EMPLOYEES';

desc user_cons_columns

select constraint_name,column_name
from user_cons_columns
where table_name='EMPLOYEES';

comment 對錶加註釋

表加註釋: comment on table emp is 'emp information';
列加註釋:comment on column emp.employee_id is ' emp........';

註釋: 4個表裏查
ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMNENTS
USER_TAB_COMMENTS

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章