Oracle 用户管理

  •  查看当前用户下有哪些对象 
SELECT OBJECT_NAME,OBJECT_TYPE FROM USER_OBJECTS;
View Code
  •  用户解锁 
View Code
1)conn sys/sys as sysdba; //以DBA的身份登录  
(2alter 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.
View Code
  • 查看当前数据库有哪些用户登陆进来
SQL> select username from v$session where username is not null order by 1;

USERNAME
------------------------------
ARCER
SYS
SYS
View Code

 

posted @ 2013-03-10 16:27  ArcerZhang  阅读(172)  评论(0编辑  收藏  举报