select name from V$DATABASE; select SYS_CONTEXT('USERENV','INSTANCE_NAME') from dual;
select username,default_tablespace from user_users;
看当前用户的缺省表空间。
select * from user_role_privs; select * from user_sys_privs;
查看当前用户的权限
select username,default_tablespace from user_users;
查看当前用户的角色。
select * from session_privs;
显示当前会话所具有的权限。
select * from user_tab_privs; select * from user_tables;
查看用户下所有的表。
select object_name,object_id from user_objects where instr(object_name,'XXX')>0;
看名称包含XXX字符的表。
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');
查看某表的大小。
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');
查看索引被索引的字段。
>select sum(bytes)/(1024*1024) as "size(M)" from user_segments where segment_name=upper('&index_name');
查看索引的大小。
select view_name from user_views;
查看视图的名称。
select constraint_name, constraint_type,search_condition, r_constraint_name from user_constraints where table_name = upper('&table_name');
查看某表的约束条件。
select object_name,status from user_objects where object_type='FUNCTION';
查看函数和过程的状态。
select object_name,status from user_objects where object_type='PROCEDURE';
查看函数和过程的源代码。
desc &table_name;