Created
February 15, 2019 10:32
-
-
Save vitaminac/1253421baab16f55015be1d8d5c9e1f1 to your computer and use it in GitHub Desktop.
script to kill all session in oracle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
FOR R IN ( | |
SELECT | |
SID, | |
SERIAL# | |
FROM V$SESSION | |
WHERE USERNAME IS NOT NULL AND SID <> ( | |
SELECT sys_context('USERENV', 'SID') | |
FROM DUAL)) | |
LOOP EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION ''' || R.SID || ',' || R.SERIAL# || ''''; | |
END LOOP; | |
END; | |
DISCONNECT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment