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';
SQL> show user; USER is "SYS" SQL> select user from dual; USER ------------------------------ SYS
用戶預設表空間
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
帳號加鎖與解鎖
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>