ALLOW A USER TO KILL A SESSION WITHOUT ALTER SYSTEM PRIVILEGE.
Hi
I need a user to have permission to kill a session without having the ALTER SYSTEM privilege. I created a procedure on sys schema and granted the EXECUTE privilege to the user but it doesn't work, how can I do, help please.
CREATE OR REPLACE PROCEDURE SYS.PRC_SESSION_KILLER (P_SID IN NUMBER, P_SERIAL IN NUMBER)
AS
BEGIN
EXECUTE IMMEDIATE 'GRANT ALTER SYSTEM TO SYSADMIN';
EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || P_SID || ',' || P_SERIAL || ''' IMMEDIATE';
EXECUTE IMMEDIATE 'REVOKE ALTER SYSTEM FROM SYSADMIN';
END;
Thank you very much.
Hi,
I second everything John said.
Are you sure the arguments are correct?
Below is the procedure I use. You may want to run it, just to see what the error is.
PROCEDURE kill_internal
s_id IN NUMBER,
serial_num IN NUMBER,
stat_out OUT VARCHAR2
IS
alter_handle INTEGER;
ex_val INTEGER; -- Returned by dbms_sql.execute
BEGIN
alter_handle := dbms_sql.open_cursor;
dbms_sql.parse
alter_handle,
'ALTER SYSTEM KILL SESSION ''' ||
TO_CHAR (s_id, '999990') ||
', ' ||
TO_CHAR (serial_num, '999990') ||
dbms_sql.native
ex_val := dbms_sql.execute (alter_handle);
dbms_sql.close_cursor (alter_handle);
stat_out := 'Success: ' ||
TO_CHAR (s_id, '999990') ||
', ' ||
TO_CHAR (serial_num, '999990');
EXCEPTION
WHEN OTHERS
THEN
stat_out := 'Failure:' ||
SQLERRM;
-- dbms_output.put_line (stat_out);
dbms_sql.close_cursor (alter_handle);
END kill_internal
;
Similar Messages
-
Kill session permission without alter system permission?
Syntax to kill session is
ALTER SYSTEM KILL SESSION 'session info';
Is there a way to allow a user to kill his/her own session without granting rights to SYSTEM? I don't want anyone to be able to drop the database, but they need to be able to kill their own session. I've looked everywhere...
Thanks in advance!Yes, assuming you are using standard definer's rights stored procedures. Only if you specify AUTHID CURRENT_USER when creating the stored procedure will you get an invoker's rights stored procedure, which would run with the privileges of the caller, not of the definer.
Justin -
Granting ALTER SYSTEM privilege to Application user
DB version:10gR2
When we purchased a logistics application software, we have been asked to grant alter system privileges to the Application Oracle user/schema by the application vendor. They said they need this to change Instance level parameters like OPTIMIZER_MODE,..etc. What do you guys think?
Edited by: GarryB on Feb 17, 2009 10:25 PMGarryB,
This is a strange idea. Many parameters can be altered on session level.
If they want to change static parameters, do they also require the privilege to bounce the instance?
Even if the application would need to change parameters, this should be encapsulated in a procedure created in a privileged user, with execute privilege granted to the application owner.
If feel you will regret to have purchased this application sooner or later, the vendor doesn't seem to know much about Oracle.
Hth
Sybrand Bakker
Senior Oracle DBA -
Can't kill session with "Alter system kill session"?
I'm using 9iR2.
After I check the v$session table:
SQL> select sid, serial# from v$session where username='XMLDEMO';
SID SERIAL#
18 19155
I issue the command:
SQL> alter system kill session '18,19155' immediate;
System altered.
But after this, I still can find this session:
SQL> select sid, serial# from v$session where username='XMLDEMO';
SID SERIAL#
18 19155
Can anyone tell me why? Did I miss something?
Any help will be appreciated.
Jinyukeep issuing that query and notice if the serial number starts to change..if it does it is reflecting pmon cleaning up the sessions, when pmon finishes his work
the sesison will disappear from v$session.
steve
I'm using 9iR2.
After I check the v$session table:
SQL> select sid, serial# from v$session where username='XMLDEMO';
SID SERIAL#
18 19155
I issue the command:
SQL> alter system kill session '18,19155' immediate;
System altered.
But after this, I still can find this session:
SQL> select sid, serial# from v$session where username='XMLDEMO';
SID SERIAL#
18 19155
Can anyone tell me why? Did I miss something?
Any help will be appreciated.
Jinyu -
Flush Shared Pool without Alter System Priv
I am trying to device a way to flush the shared pool by a user who doesn't have ALTER SYSTEM priv. I tried creating a stored proc in user's schema who has DBA role
with the following:
execute immediate 'alter system flush shared_pool';
and then granted execute on this to a normal user without explicit alter system priv, but the execution fails and seems that I need to grant alter system explicitly to this user. Is there any other workaorund for this?
Thank You
Kevinit works for me! V10.2.0.4 too.
SQL> set time on
12:11:24 SQL> @privs
12:11:28 SQL> SET TERM ON ECHO ON
12:11:28 SQL> SET SERVEROUTPUT ON
12:11:28 SQL> CREATE USER PTST IDENTIFIED BY PTST DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON users TEMPORARY TABLESPACE TEMP;
User created.
12:11:28 SQL> grant create session to ptst;
Grant succeeded.
12:11:28 SQL> grant alter system to dbadmin;
Grant succeeded.
12:11:28 SQL> connect dbadmin/admindb
Connected.
12:11:28 SQL> set term on echo on
12:11:28 SQL> create or replace procedure flush_pool
12:11:28 2 as
12:11:28 3 begin
12:11:28 4 execute immediate 'alter system flush shared_pool';
12:11:28 5 end flush_pool;
12:11:28 6 /
Procedure created.
12:11:28 SQL> grant execute on flush_pool to ptst;
Grant succeeded.
12:11:28 SQL> connect ptst/ptst
Connected.
12:11:28 SQL> SET TERM ON ECHO ON
12:11:28 SQL> execute dbadmin.flush_pool;
PL/SQL procedure successfully completed.
12:11:29 SQL> connect / as sysdba
Connected.
12:11:29 SQL> drop user ptst;
User dropped. -
How can I allow standard users to update creative cloud without admin rights.
I have over 300 users in a domain environment and I cannot allow them to have admin rights on the machines.Is there a Registry hack or key that we can adjust to allow CC to update without these rights?
This is an open forum, not Adobe support... you need Adobe staff to help
Adobe contact information - http://helpx.adobe.com/contact.html
-Select your product and what you need help with
-Click on the blue box "Still need help? Contact us" -
Please ignore it. By mistakely i posted this thread here.
Hi All,
I want to drop one user. If i made a attempt to drop that user, I rec'd "ORA-01940: cannot drop a user that is currently connected." error. So I checked with sessions with the username. No one is using this user. But it resists some inactive sessions.
SQL> DROP USER test cascade;
DROP USER test cascade
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
SQL>select sid,serial#,username,status from v$session where schemaname='TEST';
SID SERIAL# USERNAME STATUS
131 4026 TEST INACTIVE
143 29325 TEST INACTIVE
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
SQL> alter system kill session '131,4026' immediate;
system altered.
SQL>alter system kill session '143,29325' immediate;
system altered.
Now. I checked in v$sessions,
SQL>select sid,serial#,username,status from v$session where schemaname='TEST';
SID SERIAL# USERNAME STATUS
139 12982 AGILITY_QA INACTIVE
141 54482 AGILITY_QA INACTIVE
It shows some other inactive sessions. so i am trying to kill these 2 sessions again some inactive sessions will show.
Please assist me to fix that problem.
Message was edited by:
Moorthy GSTry the output of the query to kill all sessions:
select 'alter system kill session '''||sid||','||'4026''' immediate;' scr
from v$session
where schemaname='TEST' and status <> 'KILLED'
Regards
RK -
How to rectify the hanging session without killing it?
Hi all,
Please help me out in the follwoing scenario.
In a production server, I have few sessions got hanged at client side. I need to rectify it
I cannot kill the session without commiting the data inserted.
Is there anyway to rectify the problem.
Please help me out.
Thanks
Regards
GathaHi Gatha,
Plz read this article here you will find all the info in very smart way...
[http://www.oracledba.in/display_article.aspx?article_id=284]
A R P I T S I N H A
[http://www.oracledba.in/Main.aspx] -
User cancelling their own session
Hi
Is there functionality available, or something I can activate or develop, that will allow a user to cancel their session entirely from the portal.
The problem we're facing is that if a user does something on a report, like try to view every article for every site (300,000 articles and 170 sites), that puts quite a load on the server. If the user realises their mistake, they can exit IE, but that doesn't seem to cancel the long running request.
I have monitored transaction SM50 in BW, and it doesn't seem like the session is hanging there, so I can't just give them access to that transaction and allow them to kill their session from that screen.
I am thinking that perhaps the session is active on the Java engine, and wondering if there is some way for a user to cancel their session on the Java side of things.
Any ideas?
Cheers,
AndrewAndrew,
Are ou using BW Web or Portal ..? If you are using Portal - you can enable Distributed Session Management (DSM) to achieve the same. -
Urgent-how to run 'alter system kill session 'sid, serial#' in form 6i ?
I want to write a procedure in Form 6i so that user can kill the session by herself.
I know kill session sql is 'alter system kill session 'sid, serial#'', however, I fould that I can only run it it sql plus screen, how can I run it in Form or in Stored procedure?
Urgent....Please!try using Forms_ddl('alter system......'); in the forms. it will execute the dml statements in the form.
zaibi. -
How to "kill" AWT Event Queue thread without using System.exit()?
When I run my program and the first GUI window is displayed a new thread is created - "AWT-Event Queue". When my program finishes, this thread stays alive and I think it causes some problems I have experienced lately.
Is there any possibility to "kill" this thread without using System.exit() (I can't use it for some specific reasons)All threads are kept alive by the JVM session. When you use System.exit(int) you kill the current session, thus killing all threads. I'm not sure, though...
What you could do, to make sure all threads die, is to make ever thread you start member of a thread group. When you want to exit you app, you kill all the threads in the thread group before exit.
A small example:
//Should be declared somewhere
static ThreadGroup threadGroup = new ThreadGroup("My ThreadGroup");
class MyClass extends Thread {
super(threadGroup, "MyThread");
Thread thread = new Thread(threadGroup, "MySecondThread");
void exit() {
//Deprecated, seek alternative
threadGroup.stop();
System.exit(0);
} -
I do not have priviledge to kill the session, and i have checked the forums to create a procedure to kill the session,
so how can i use that procedure to kill the session.
ThanksIf you should be allowed to kill sessions, then your DBA will grant you the ALTER SYSTEM privilege. Or, you could request your DBA to create a stored procedure for it and then grant you execute permission on that procedure. Of course, if your DBA does not choose to do this, then this is a discussion you should be having with your management.
-
A problem within a third-party application is causing it to create and abandon Oracle sessions. At times three hundred or more abandoned sessions accumulated in the instance. The software company is working on the problem. Oracle's background processes will get rid of those sessions after several hours, but at times there were so many they caused the server to start using paging space. We wrote a SQL*Plus script to identify the abandoned sessions and kill them with command "alter system kill session <sid, serial#> immediate;". We automated the execution of the script a week ago. Today I noticed that in my udump directory an Oracle trace file has been created each time our script kills a session. A single trace file is created regardless of how many sessions are killed. No errors appear in the trace file.
Is the creation of these trace files an indication that problems have occurred or are they there for information only?
Since I know how and why the sessions are being killed, is it safe to ignore the trace files?
Thank you,
BillThe OS is AIX 5.2. The database server is 10.2.0.2. We are in the processing of upgrading to AIX 7.1 and database server 11.2.0.3.6.
The script does not enable tracing for the SQL*Plus session.
Below is the alert log message from a session killed at 11:22, and the corresponding trace file created at that same time:
From alert_<sid>.log:
Wed Jul 31 11:22:01 2013
Immediate Kill Session#: 1119, Serial#: 59885
Immediate Kill Session: sess: 70000014dc4a7e0 OS pid: 267254
/u02/admin/EXPRESS/udump $ ls -l express_ora_113358.trc
-rw-r----- 1 oracle dba 2276 Jul 31 11:22 express_ora_113358.trc
/u02/admin/EXPRESS/udump $ pg express_ora_113358.trc
Dump file /u02/admin/EXPRESS/udump/express_ora_113358.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0
System name: AIX
Node name: navis
Release: 2
Version: 5
Machine: 0005CD8C4C00
Instance name: EXPRESS
Redo thread mounted by this instance: 1
Oracle process number: 225
Unix process pid: 113358, image: oracleEXPRESS@navis
*** ACTION NAME:() 2013-07-31 11:22:01.181
*** MODULE NAME:(SQL*Plus) 2013-07-31 11:22:01.181
*** SERVICE NAME:(EXPRESS.WORLD) 2013-07-31 11:22:01.181
*** SESSION ID:(1723.61000) 2013-07-31 11:22:01.181
SO: 70000014d44d278, type: 2, owner: 0, flag: INIT/-/-/0x00
(process) Oracle pid=463, calls cur/top: 0/700000139166298, flag: (0) -
int error: 0, call error: 0, sess error: 0, txn error 0
(post info) last post received: 108 0 4
last post received-location: kslpsr
last process to post me: 70000014d36c398 1 6
last post sent: 0 0 24
last post sent-location: ksasnd
last process posted by me: 70000014d36c398 1 6
(latch info) wait_event=0 bits=0
Process Group: DEFAULT, pseudo proc: 70000014d6aec00
O/S info: user: oracle, term: UNKNOWN, ospid: 267254
OSD pid info: Unix process pid: 267254, image: oracleEXPRESS@navis
Short stack dump:
ksdxfstk+002c<-ksdxcb+04e4<-sspuser+0074<-00004CB0<-nttrd+0120<-nsprecv+0750<-ns
rdr+0114<-nsdo+1714<-nsbrecv+0040<-nioqrc+04a8<-opikndf2+0688<-opitsk+088c<-opii
no+0990<-opiodr+0adc<-opidrv+0474<-sou2o+0090<-opimai_real+01bc<-main+0098<-__st
art+0090
Dump of memory from 0x070000014D2CC3B0 to 0x070000014D2CC5B8
70000014D2CC3B0 00000004 00000000 07000001 39DA8D48 [............9..H]
70000014D2CC3C0 00000010 0003139D 07000001 39166298 [............9.b.]
70000014D2CC3D0 00000003 0003139D 07000001 4C73D508 [............Ls..]
70000014D2CC3E0 0000000B 0003139D 07000001 4DC4A7E0 [............M...]
70000014D2CC3F0 00000004 00031291 00000000 00000000 [................]
70000014D2CC400 00000000 00000000 00000000 00000000 [................]
Repeat 26 times
70000014D2CC5B0 00000000 00000000 [........]
Thanks,
Bill -
Clear the entry for killed/sniped session in v$session
Dear all,
In our production database(11.2.0.1.0) running on windows 2008 server many client session showing inactive from last 4-5 hour and I want to kill those session because all sessions are dedicated so for this I created a resource plan set its idle time after certain interval session status is showing killed but it is not removing entries from v$session but our client demand is it must be clear from v$session so for this i was using DOS command taskkill utility to kill particular os process so I want to know what is the smartest way to do this.This is known behavior, not an issue.
In a dedicated server environment when the session is killed and the rollback completes the process goes away so a join between v$session and v$process will fail. The v$session entry also usually goes away rather quickly, though I have seen cases where the v$session entry hung around till the instance was bounced. But normally Oracle will overlay the v$session entry with a new session using the same sid but a different serial# within seconds on a busy system.
Mark @ http://dbaspot.com/oracle-server/40419-killed-sessions.html
Metalink doc id 1023442.6 is also something confirming it.
See also below link and last reply by Mr. Braj Kishore Mahto.
http://dbaforums.org/oracle/index.php?showtopic=3039
Regards
Girish Sharma
Edited by: Girish Sharma on Nov 21, 2012 5:35 PM
So, what is best in this regard :
ALTER SYSTEM DISCONNECT SESSION
The ALTER SYSTEM DISCONNECT SESSION syntax is an alternative method for killing Oracle sessions. Unlike the KILL SESSION command which asks the session to kill itself, the DISCONNECT SESSION command kills the dedicated server process (or virtual circuit when using Shared Sever), which is equivalent to killing the server process from the operating system. The basic syntax is similar to the KILL SESSION command with the addition of the POST_TRANSACTION clause. The SID and SERIAL# values of the relevant session can be substituted into one of the following statements.
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' POST_TRANSACTION;
SQL> ALTER SYSTEM DISCONNECT SESSION 'sid,serial#' IMMEDIATE;
http://www.oracle-base.com/articles/misc/killing-oracle-sessions.php#disconnect_session -
Unable to kill a session request
i had started to run a calc script and then decided to cancel it manually on a BSO data base. In the sessions I can see that the request is in "Terminating stage" but has been like that forever( almost 5 hours)
i have tried scripts to kill it but failed
Alter System Kill request all;
ALter system logout session all;
Tried to manually kill it through EAS by even using force but it's still there.
Any ideas on how I can kill the session?
Thanks.Once in a while these things just won't go away and you need to kill the serprocess running it. If it is on Windows bring up task manager on the server and look for the Esssvr session that has cpu on it. End that task. To make my live easier, I go into EAS and right click on applications and say stop all applications. The one that does not disappear out of Task manager is the one to terminate. You could also look in the Essbase log and find the PID the application started on.
In Uxin it is easier as you gan do a ps -eaf and see the name of the application and kill -9 it's PID
Maybe you are looking for
-
GNOME 3.2 [GDM] brightness level at minimum by default?
After I updated to GNOME 3.2, I noticed a strange problem; When I boot I just get a blank (black) screen and no GDM! - But when I adjust my brightness to maximum I can see GDM as usual and everything is working as expected. I did a little research, b
-
Importing Thunderbird address book into Mail 3.0?
How can I migrate my thunderbird adress book emails in to the mail adress book?
-
Hi, I have a JtabbedPane with seven tabbed Indexes. Each Index has Button which takes you to the next index, Now the problem is that for each index i have to set some values when this button is pressed or the user selects the index at the tabbed pane
-
Persons disappear when Scripting the Address Book
If I modify the note of an Address Book entry via AppleScript, search no more finds this person. This is how it goes: Put following script in ~/Library/Address Book Plug-Ins/ using terms from application "Address Book" on action property return "phon
-
[SOLVED] Installing the latest development version of GNOME
Is there a way to install GNOME (2.26 development version) from SVN or from an Arch repo? I can't find any information- Last edited by gjoellee (2009-03-01 13:56:34)