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

查看Oracle当前用户下的信息(用户,表视图,索引,表空间,同义词,存储过程函数,约束条件)

  SQL>select username,default_tablespace from user_users;

  查看当前用户的角色

  SQL>select * from user_role_privs;

  查看当前用户的系统权限和表级权限

  SQL>select * from user_sys_privs;

  SQL>select * from user_tab_privs;

  查看用户下所有的表

  SQL>select * from user_tables;

  1、用户

  查看当前用户的缺省表空间

  SQL>select username,default_tablespace from user_users;

  查看当前用户的角色

  SQL>select * from user_role_privs;

  查看当前用户的系统权限和表级权限

  SQL>select * from user_sys_privs;

  SQL>select * from user_tab_privs;

  显示当前会话所具有的权限

  SQL>select * from session_privs;

  显示指定用户所具有的系统权限

  SQL>select * from dba_sys_privs where grantee='GAME';

  2、表

  查看用户下所有的表

  SQL>select * from user_tables;

SELECT * FROM ALL_TABLES;

  查看名称包含log字符的表

  SQL>select object_name,object_id from user_objects

  where instr(object_name,'LOG')>0;

  查看某表的创建时间

  SQL>select object_name,created from user_objects where object_name=upper('&table_name');

  查看某表的大小

  SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments

  where segment_name=upper('&table_name');

  查看放在ORACLE的内存区里的表

  SQL>select table_name,cache from user_tables where instr(cache,'Y')>0;

  3、索引