锁定与解锁

1
2
3
4
5
6
select username,account_status from dba_users;
alter user username account lock;
alter user username account unlock;
alter user username identified by new_password;
alter user username identified by new_password account unlock;

角色权限

1
2
3
4
5
6
7
8
9

# 查看某个用户有哪些角色
select * from dba_role_privs where grantee='HR';

# 查看某个角色被赋予了哪些用户
select * from dba_role_privs where granted_role='DBA';

# 对象权限
select * from dba_tab_privs;

授予权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 查看role
select * from dba_roles;

# 授予HR用户某些角色
GRANT connect,resource TO 'HR';

# 授予HR用户dba角色时,要重新连接才能生效
GRANT dba to 'HR';
REVOKE dba to 'HR';

# 直接授予HR用户某些权限
GRANT CREATE VIEW TO 'HR';

# 查看某个系统用户是否有SYSDBA或者SYSOPER权限
select * from v$pwfile_users;