--查看所有用户
select * from dba_users;
--查看哪些用户是sysdba
select * from V$PWFILE_USERS;
--查看哪些用户是dba
select * from dba_role_privs where granted_role=‘DBA‘;
--查看用户授予的权限
select * from dba_role_privs where grantee=‘用户名大写‘;
--查看用户现有权限
SELECT * FROM DBA_SYS_PRIVS WHERE GRANTEE=‘ANONYMOUS‘;
--新建用户
create user 用户名 identified by 密码;
--新建用户并授权限
create user 用户名 identified by 密码;
--授予用户普通权限
grant connect,resource to XXX;
--授予DBA
grant dba to 用户名;
--删除用户相关权限
revoke connect from XXX;
--删除用户
drop user XXXX cascade;
查询用户自己的权限:
select * from user_sys_privs;
--查看当前用户有哪些表:
select * from user_tab_comments;
--查看所有用户对应的表
select * from all_tables;
--查看指定用户对应的表
select * from all_tables where owner = ‘SCOTT‘;
select t.TABLE_NAME from dba_tables t where t.OWNER=‘SCOTT‘;
--用户解锁
alter user scott account unlock;
--用户改口令
alter user scott identified by "tiger";
--切换用户
conn scott/tiger@orcl;