日期:2014-05-16  浏览次数:20423 次

oracle涓煡璇㈣〃鐨勪俊鎭紝鍖呮嫭琛ㄥ悕锛屽瓧娈靛悕锛屽瓧娈电被鍨嬶紝涓婚敭锛屽閿敮涓€鎬х害鏉熶俊鎭紝绱㈠紩淇℃伅鐨勬煡璇QL鎬荤粨
1銆佹煡璇㈠嚭鎵€鏈夌殑鐢ㄦ埛琛?
select * from user_tables 鍙互鏌ヨ鍑烘墍鏈夌殑鐢ㄦ埛琛?
select owner,table_name from all_tables; 鏌ヨ鎵€鏈夎〃锛屽寘鎷叾浠栫敤鎴疯〃

閫氳繃琛ㄥ悕杩囨护闇€瑕佸皢瀛楁瘝浣滃涓嬪鐞?
select * from user_tables where table_name = upper('琛ㄥ悕')

鍥犱负鏃犺浣犲缓绔嬭〃鐨勬椂鍊欒〃鍚嶅悕瀛楁槸澶у啓杩樻槸灏忓啓鐨勶紝create璇彞鎵ц閫氳繃涔嬪悗锛屽搴旂殑user_tables琛ㄤ腑鐨則able_name瀛楁閮戒細鑷姩鍙樹负澶у啓瀛楁瘝锛屾墍浠ュ繀椤婚€氳繃鍐呯疆鍑芥暟upper灏嗗瓧绗︿覆杞寲涓哄ぇ鍐欏瓧姣嶈繘琛屾煡璇紝鍚﹀垯锛屽嵆浣垮缓琛ㄨ鍙ユ墽琛岄€氳繃涔嬪悗锛岄€氳繃涓婇潰鐨勬煡璇㈣鍙ヤ粛鐒舵煡璇笉鍒板搴旂殑璁板綍銆?

2銆佹煡璇㈠嚭鐢ㄦ埛鎵€鏈夎〃鐨勭储寮?
select * from user_indexes

3銆佹煡璇㈢敤鎴疯〃鐨勭储寮?闈炶仛闆嗙储寮?:
select * from user_indexes where uniqueness='NONUNIQUE'

4銆佹煡璇㈢敤鎴疯〃鐨勪富閿?鑱氶泦绱㈠紩):
select * from user_indexes where uniqueness='UNIQUE'

5銆佹煡璇㈣〃鐨勭储寮?
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name='NODE'

6銆佹煡璇㈣〃鐨勪富閿?
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' AND cu.table_name = 'NODE'

7銆佹煡鎵捐〃鐨勫敮涓€鎬х害鏉燂紙鍖呮嫭鍚嶇О锛屾瀯鎴愬垪锛夛細
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name=au.constraint_name and cu.table_name='NODE'

8銆佹煡鎵捐〃鐨勫閿?
select * from user_constraints c where c.constraint_type = 'R' and c.table_name='STAFFPOSITION'

鏌ヨ澶栭敭绾︽潫鐨勫垪鍚嶏細
select * from user_cons_columns cl where cl.constraint_name = 澶栭敭鍚嶇О

鏌ヨ寮曠敤琛ㄧ殑閿殑鍒楀悕锛?
select * from user_cons_columns cl where cl.constraint_name = 澶栭敭寮曠敤琛ㄧ殑閿悕

9銆佹煡璇㈣〃鐨勬墍鏈夊垪鍙婂叾灞炴€?
鏂规硶涓€锛?
select * from user_tab_columns where table_name=upper('琛ㄥ悕');
鏂规硶浜岋細
select cname,coltype,width from col where tname=upper('琛ㄥ悕');;

10.鏌ヨ涓€涓敤鎴蜂腑瀛樺湪鐨勮繃绋嬪拰鍑芥暟
select object_name,created,status from user_objectswhere lower(object_type) in ('procedure','function');

11.鏌ヨ鍏跺畠瑙掕壊琛ㄧ殑鏉冮檺
select * from role_tab_privs ;