Showing posts with label Security. Show all posts
Showing posts with label Security. Show all posts

Tuesday, July 3, 2007

How to Restrict Access of Some Users or Program in Oracle Prodcution Database

CREATE OR REPLACE TRIGGER programe_restrication

AFTER LOGON ON DATABASE

BEGIN

FOR x IN (SELECT username, program

FROM SYS.v_$session

WHERE audsid = USERENV ('sessionid'))

LOOP

IF LTRIM (RTRIM (x.username)) = 'AHMADBILAL'

AND LTRIM (RTRIM (x.program)) IN ('sqlplusw.exe', 'TOAD.exe')

THEN

raise_application_error

(-20999,

'Not authorized to use in the Production environment!'

);

END IF;

END LOOP;

END programe_restrication;

/

Saturday, June 2, 2007

How to Kill Oracle Session

Get All Lock Objects by Using Following Query

SELECT a.object_id, a.session_id, b.object_name
FROM v$locked_object a, dba_objects b
WHERE a.object_id = b.object_id


Get Session id From below Query by Passing session _id (get From Above query)

For example i got 67 from above query

SELECT SID, serial#,SID||','||serial# "session id", username, command, schemaname, osuser, machine, terminal
FROM v$session
WHERE SID = 67;

I got 93,10383 from above query
Pass Session Id In below query

ALTER system kill session '93,10383'