Home | 简体中文 | 繁体中文 | 杂文 | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | Github | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 73 章 Privilege

目录

73.1. Account
73.1.1. show user
73.1.2. DEFAULT_TABLESPACE
73.1.3. unlock/lock
73.2. User
73.2.1. Create user
73.2.2. Drop user
73.2.3. Alter user
73.2.4. 修改密码
73.2.5. Reset Password 忘记密码重置密码
73.3. grant
73.3.1. 列出权限
73.3.2. 查看用户权限
73.3.3. 吊销权限
73.3.4. System Privileges 系统权限
73.3.4.1. EM 权限
73.3.4.2. Granting and Revoking SYSDBA and SYSOPER Privileges
73.3.5. Object Privileges 对象权限
73.4. Opening the Encrypted Wallet

73.1. Account

select username,account_status from dba_users; 

select username,account_status from dba_users where account_status='OPEN';

select username,account_status from dba_users t where t.default_tablespace = 'USERS' and t.account_status = 'OPEN';
		

73.1.1. show user

			
SQL> show user;
USER is "SYS"

SQL> select user from dual;

USER
------------------------------
SYS
			
			

73.1.2. DEFAULT_TABLESPACE

用户默认表空间

			
SQL> SELECT DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME='WCUSER';

DEFAULT_TABLESPACE
------------------------------
WCSDB

SQL> SELECT DEFAULT_TABLESPACE FROM DBA_USERS WHERE USERNAME=(select user from dual);

DEFAULT_TABLESPACE
------------------------------
SYSTEM


SQL> select username,account_status from dba_users t where t.default_tablespace = 'USERS' and t.account_status = 'OPEN';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
FINANCE                        OPEN
NEWS                           OPEN
			
			

73.1.3. unlock/lock

帐号加锁与解锁

alter user scott account unlock /lock;
			
SQL> alter user scott account unlock;

User altered.
SQL> select username,account_status from dba_users where username='SCOTT';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
SCOTT                          EXPIRED

SQL> alter user scott account lock;

User altered.

SQL> select username,account_status from dba_users where username='SCOTT';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
SCOTT                          EXPIRED & LOCKED

SQL>