Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
07 To find the user's terminal info, ask the user to run the command
from another session.
select sys_context('userenv','host') from dual;
select sys_context('userenv','terminal') from dual;
08 To find the user login name to the db, the user can query using
show user
select username from user_users;
select user from dual;
09 To find a user's sid, the user can run any of these queries.
SELECT sys_context('USERENV', 'SID') FROM dual;
select distinct sid from v$mystat;
The above queries only display the user's currently logged in session's sid.
10 Ask the user for details like login username, terminal name, the sql query
the the user is executing.
In any event, isolate the user's session, using as many pridicates as required.
If necessary, check with the user and take the user's confirmation
before killing the user's session.
After all is said and done, pls be very careful in identifying the user's sessio
n.
If you kill a wrong session, you invite trouble.
------------------PART-V--
This is a useful sql query, to identifying the offending oracle sessions and kil
l.
This query displays, the sessions details like sid, serial#, username,osuser,spi
d,
process and the executing sql.
Select 'alter system kill session '''||sid||','|| s.serial#||''';'||
chr(10)||s.username||' '||Status||' '||osuser||' '|| process||' '||
s.program||' '||s.machine||' '||s.terminal||' '||p.spid||' '||chr(10)||sa.sql_te
xt
From v$process p, v$session s,v$sqlarea sa
Where s.paddr=p.addr
and s.sql_address = sa.address(+)
and s.sql_hash_value = sa.hash_value(+)
--and upper(sa.sql_text) like '%SUPPY THE SQL IN UPPER CASE ONLY%'
--and s.username='SUPPLY THE USERNAME'
--and s.sid in (SUPPY USER'S SID)
--and s.machine = 'SUPPY THE SERVER / MACHINE NAME'
--and s.terminal = 'SUPPY THE TERMINAL NAME'
--and process = 'SUPPY UNIX PROCESS ID FROM REMOTE SERVER/OR PARENT ID OF YOUR
SPID'
--and spid in (SUPPY UNIX ID FROM LOCAL UNIX SERVER);
The commented lines are optional in the sql query.
Modify the sql query, as per your requirement and use as many predicates as poss
ible,
from the commented "--" lines to isolate and identify the user's session.
------------------PART-VI-
Sometimes, I may need to kill my session and before the job is completed.
At the start of my session, I run this sql and save the output, for use, if requ
ired.
Reference:
http://www.scribd.com/doc/19275101/mts
http://www.dba-oracle.com/concepts/shared_pool_mts.htm
http://www.dba-oracle.com/t_mts_multithreaded_servers_shared.htm
http://www.praetoriate.com/t_%20tuning_dedicated_connections.htm
http://toolkit.rdbms-insight.com/jobs.php
http://ss64.com/ora/syntax-redo.html
http://www.oracle-base.com/articles/misc/KillingOracleSessions.php
http://www.scribd.com/doc/2675003/Oracle-Redo-and-Rollback
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:497457390608
7
http://books.google.com/books?id=TmPoYfpeJAUC&pg=PA292&lpg=PA292&dq=What+oracle+
does+in+a+commit&source=bl&ots=RzVa8t3xZC&sig=B7B8TjlW3MXpKJezyZPN6oyyKbo&hl=en&
ei=7A5iS_mYFZHQM7fwxMUC&sa=X&oi=book_result&ct=result&resnum=8&ved=0CBwQ6AEwBzgy
#v=onepage&q=What%20oracle%20does%20in%20a%20commit&f=false