Developers demand can kill kill other obstructive own session, the test found that there are risks need to alter system privileges


Analog developer needs to kill other obstructive own session
authority 1. have confirmed the query blocking session
SQL> Grant the SELECT ON V_ $ Testa to the session;
SQL> Grant the SELECT ON V_ $ SQL to Testa;
SQL> the SELECT sid, serial #, username, sql_id, status , event, BLOCKING_INSTANCE, BLOCKING_SESSION from v $ session where username = 'TESTA';

SID SERIAL# USERNAME SQL_ID STATUS EVENT BLOCKING_INSTANCE BLOCKING_SESSION
---------- ---------- ---------- -------------- ---------- ------------------------------ ----------------- ----------------
8 13 TESTA a49v0mry3c0rk ACTIVE SQL*Net message to client
191 5 TESTA INACTIVE SQL*Net message from client
197 5 TESTA 96vz122hk9mtq ACTIVE enq: TX - row lock contention 1 191

查询确认自己被阻塞
SQL> select sql_fulltext from v$sql where sql_id='96vz122hk9mtq';
SQL_FULLTEXT
--------------------------------------------------------------------------------
delete a


2. Kill session System permissions the ALTER
SQL> Grant the ALTER System to Testa;
SQL> System the kill the session the ALTER '191,5' load immediate;
permissions too unreasonable.

Observe whether permission can kill background processes
$ PS -ef | grep PMON
? The Oracle 5185 1 0 20:36 00:00:00 ora_pmon_tt11204

SQL> the SELECT SPID, pid, username, Program, background, addr from v $ Process the WHERE SPID = 5185 ;
SPID PID USERNAME the PROGRAM BA ADDR
---------- ---------- -------------------- --- ----------------- - ----------------
5185 2 @ enmo the Oracle the Oracle (PMON) 1 00000000F550BE60

SQL>select sid,serial#,username,event,program from v$session where paddr='00000000F550BE60';
SID SERIAL# USERNAME EVENT PROGRAM
---------- ---------- ---------- ------------------------------ --------------------
125 1 pmon timer oracle@enmo (PMON)

SQL> alter system kill session '125,1' immediate;
alter system kill session '125,1' immediate
*
ERROR at line 1:
ORA-00029: session is not a user session

Session can not kill non-users, but the big SYS privileged user sessions can also kill
SQL> Show the User
the USER IS "TESTA"
SQL> the SELECT sid, Serial #, username from v $ the session the WHERE username = 'SYS';
SID SERIAL # USERNAME
- --------- ---------- ----------
198 43 SYS
SQL> System the kill the session the ALTER '198,43' load immediate;
. the Altered System

daemon We need to kill by os level

Will not kill background process instance level caused the collapse, but may affect other users normal execution, uncontrollable. Test environment can authorize the production environment is not recommended.

Guess you like

Origin www.cnblogs.com/lvcha001/p/11297195.html