日期:2014-05-16 浏览次数:20567 次
oracle 常用管理命令
?
--user -- 查看当前用户的缺省表空间 select username,default_tablespace from user_users; -- 查看当前用户的角色 select * from user_role_privs; -- 查看当前用户的系统权限和表级权限 select * from user_sys_privs; select * from user_tab_privs; -- 显示当前会话所具有的权限 select * from session_privs; -- 显示指定用户所具有的系统权限 需要权限 select * from dba_sys_privs where grantee='DM' -- table -- 查看用户下所有的表 select * from user_tables where instr(lower(table_name),'user') >0 -- like '%user%' select * from all_tables where lower(table_name) like 'user%' -- 查看名称包含log字符的表 select object_name,object_id from user_objects where instr(object_name,'LOG') >0; -- 查看某表的创建时间 select object_name,created from user_objects where object_name = upper('&table_name'); -- 查看某表的大小 select sum(bytes)/(1024*1024) as "size(M)" from user_segments where segment_name = upper('&table_name') -- 查看放在ORACLE的内存区里的表 select table_name,cache from user_tables where instr(cache,'Y') > 0; --index -- 查看索引个数和类别 --select count(*) from ( select index_name,index_type,table_name from user_indexes order by table_name--); -- 查看索引被索引的字段 select * from user_ind_columns where index_name = upper('&index_name'); -- sequence --查看序列号 select * from user_sequences create sequence t_ff delete from user_sequences t where t.sequence_name in ('T_FF') -- need privilage of delete sequence -- view -- 查看视图的名称 select * from user_views -- 查看创建视图的select语句 select text from user_views where view_name = upper('&view_name'); -- synonym -- 查看同义词的名称 select * from user_synonyms; select * from all_synonyms; -- function & procedure -- 查看方法和过程 select object_name,status from user_objects where lower(object_type)='function'; select object_name,status from user_objects where lower(object_type)='procedure'; -- 查看源码 select text from all_source where owner = user and name=upper('&plsql_name')?