管理用户的几个有用的技术:
1、更改概要文件:
alter profile fin_user
limit
failed_login_attempts 5
password_lock_time 1;
 
2、列出用户信息
SQL>select username ,profile, account_status from dba_users
USERNAME                       PROFILE                        ACCOUNT_STATUS
------------------------------ ------------------------------ ------------------
IX                             DEFAULT                        EXPIRED & LOCKED
SH                             DEFAULT                        EXPIRED & LOCKED
DIP                            DEFAULT                        EXPIRED & LOCKED
OE                             DEFAULT                        EXPIRED & LOCKED
HR                             DEFAULT                        EXPIRED & LOCKED
 
3、确定用户当前正在执行的SQL语句:
这个需要连接v$session 和v$sqltext2个动态性能视图完成:
SQL> select a.sid,a.username,s.sql_text from v$session a ,v$sqltext s
  2  where a.sql_address=s.address
  3  and a.sql_hash_value=s.hash_value
  4  and a.username like 'HR%';
未选定行
 
 
4、用不同用户登录:
假设在不知道hr的密码的前提下,想修改hr的密码登录操作,操作完后又将其密码改会原来的密码:
SQL> select 'alter user hr identified by values '||password||';' from dba_users
  2  where username='HR';
'ALTERUSERHRIDENTIFIEDBYVALUES'||PASSWORD||';'
------------------------------------------------------------------
alter user hr identified by values 759E43D4AE1EFBD2;
 
SQL> alter user hr identified by 123456
 
SQL>conn hr/123456
 
SQL>conn / as sysdba
 
SQL> alter user hr identified by values '759E43D4AE1EFBD2'
 
5、杀死用户会话:
先查找出用户的sid和序列号serial#
SQL> run
  1  select sid , serial# from v$session
  2* where username='HR'
       SID    SERIAL#
---------- ----------
       139        145
然后杀死这个用户的会话进程:
SQL> alter system kill session '139,145';
系统已更改。