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

Oracle 常用数据字典

?

--Oracle 数据字典
--Oracle 数据字典很多,通常我记不住所有的名字,我们可以用以下SQL去查数据字典的名字
如:select distinct object_name from dba_objects where object_name like 'user_%';
--本用户字典?
SQL> select distinct object_name from dba_objects where object_name like 'USER_%';
--系统用户字典
SQL> select distinct object_name from dba_objects where object_name like 'DBA_%';
--动态字典
SQL> select distinct object_name from dba_objects where object_name like 'V$_%';
--表
SQL> select * from cat;
SQL> select * from tabs;
SQL> select * from user_tables;
--视图
SQL> select * from user_views;
SQL> select?? text?? from?? user_views?? where?? view_name=upper('&view_name');
--索引
SQL>?select * from user_indexes;?
SQL> select index_name,table_owner,table_name,tablespace_name,status from user_indexes order by?? table_name;
--快照?select * from user_snapshots;
SQL> select owner,name,master,table_name,last_refresh,next from user_snapshots order by owner,next;
--触发器
SQL> select * from user_triggers;
SQL> select trigger_name,trigger_type,table_owner,table_name,status from user_triggers;
--同义词

SQL> select * from syn;
--序列

SQL> select * from seq;
SQL> select * from user_sequences;

--数据库链路

SQL> select * from user_db_links;
--约束限制

SQL> select * from user_constraints;
SQL> select TABLE_NAME,CONSTRAINT_NAME,SEARCH_CONDITION,STATUS from user_constraints;

--本用户读取其它用户对象的权限

SQL> select?? *?? from?? user_tab_privs;

--本用户所拥有的系统权限

SQL> select ? * ? from ? user_sys_privs;

--Oracle系统中的所有用户

SQL> select * from all_users;

SQL> select username from all_users;

SQL> select * from all_users order by user_id;

--表空间剩余自由空间情况?