Oracle 用户管理
- 查看当前用户下有哪些对象
SELECT OBJECT_NAME,OBJECT_TYPE FROM USER_OBJECTS;
- 用户解锁
View Code
(1)conn sys/sys as sysdba; //以DBA的身份登录 (2)alter user scott account unlock;// 然后解锁 (3)conn scott/tiger //修改一下密码就可以了
- 查看登陆到oracle server中的用户信息
View Code
SQL> select sid,serial#,username,status from v$session; SID SERIAL# USERNAME STATUS ---------- ---------- ------------------------------ -------- 1 1 ACTIVE 2 1 ACTIVE 3 1 ACTIVE 4 1 ACTIVE 5 3 ACTIVE 6 1 ACTIVE 11 7 ACTIVE 63 5 ACTIVE 64 1 ACTIVE 65 1 ACTIVE 66 1 ACTIVE SID SERIAL# USERNAME STATUS ---------- ---------- ------------------------------ -------- 68 9 ACTIVE 70 178 HR INACTIVE 125 1 ACTIVE 126 1 ACTIVE 127 1 ACTIVE 128 1 ACTIVE 129 1 ACTIVE 131 7 ACTIVE 133 71 SYS ACTIVE 187 1 ACTIVE 188 1 ACTIVE SID SERIAL# USERNAME STATUS ---------- ---------- ------------------------------ -------- 189 1 ACTIVE 190 1 ACTIVE 191 37 ACTIVE 192 7 ACTIVE 194 1 ACTIVE 27 rows selected.
- 杀掉当前登陆的某个用户信息
View Code
alter system kill session '11,8';
View Code
SQL> SELECT * FROM DEPARTMENTS; SELECT * FROM DEPARTMENTS * 第 1 行出现错误: ORA-00028: 您的会话己被终止
- 查看数据库中用户信息
SQL> select username,user_id,account_status from dba_users where account_status = 'OPEN' order by 1; USERNAME USER_ID ACCOUNT_STATUS ------------------------------ ---------- -------------------------------- A1 96 OPEN A2 94 OPEN A3 95 OPEN ARCER 91 OPEN HR 85 OPEN SYS 0 OPEN SYSTEM 5 OPEN U1 92 OPEN U2 93 OPEN 9 rows selected.
- 查看当前数据库有哪些用户登陆进来
SQL> select username from v$session where username is not null order by 1; USERNAME ------------------------------ ARCER SYS SYS