oracle sql
package com.citi.db.client; public class Oracle { /** * SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner, cols.constraint_name FROM all_constraints cons, all_cons_columns cols WHERE cols.table_name = 'IGCB_CODE_BANK' AND cons.constraint_type = 'P' AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner ORDER BY cols.table_name, cols.position; 查看列 select * from cols 查看列 select * from user_tab_columns where table_name='' 查看约束 select * from user_constraints 查看表 select * from DBA_TABLES where OWNER='IST1_NACIX1' 1.查看所有用户: select * from dba_user; select * from all_users; select * from user_users; 2.查看用户系统权限: select * from dba_sys_privs; select * from all_sys_privs; select * from user_sys_privs; 3.查看用户对象权限: select * from dba_tab_privs; select * from all_tab_privs; select * from user_tab_privs; 4.查看所有角色: select * from dba_roles; 5.查看用户所拥有的角色: select * from dba_role_privs; select * from user_role_privs; 6.查看当前用户的缺省表空间 select username,default_tablespace from user_users; 7.查看某个角色的具体权限,如grant connect,resource,create session,create view to TEST; 查看RESOURCE具有那些权限,用SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE='RESOURCE'; 8.查看function select * from ALL_OBJECTS where object_name='GRAPPLDATE' select * from USER_OBJECTS where OBJECT_NAME = 'GRAPPLDATE' select OBJECT_NAME from ALL_OBJECTS where OWNER='NACIX1' and OBJECT_TYPE='TABLE'; 9.查看procedual, function details select * from all_source select * from user_source show release; 查看版本 select * from v$database 查看当前数据库 * * * * to_date('20081010', 'yyyymmdd') * TO_CHAR(b, 'YYYY/MM/DD') * length(field) * rtrim(field) * * * * * * * */ }
出处:http://cnblogs.com/daishuguang