Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: tkprof and security?
trace_on.sql
REM Script to turn TRACE MODE on for a selected SID.
set serveroutput ON size 2000;
set verify OFF;
DECLARE
r_sid NUMBER; v_sid NUMBER; v_serial NUMBER; v_username VARCHAR(30); v_status VARCHAR2(8); v_server VARCHAR2(9); p_server_pid VARCHAR2(9);
BEGIN
-- Accept r_sid Number 'What SID do you wish to trace? - '
r_sid := &SID;
SELECT s.sid, s.serial#, s.status, s.server, p.spid
INTO v_sid, v_serial, v_status, v_server, p_server_pid
FROM v$session s, v$process p
WHERE s.sid = r_sid
AND s.paddr = p.addr;
DBMS_OUTPUT.PUT_LINE ('Sid ' || TO_CHAR(v_sid) ||
' Serial# ' || TO_CHAR(v_serial) || ' Username ' || v_username || ' Status ' || v_status || ' Server ' || v_server );IF v_server != 'DEDICATED' THEN
SYS.DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(v_sid, v_serial, TRUE);
DBMS_OUTPUT.PUT_LINE ('Trace Mode is ON for '||v_sid); DBMS_OUTPUT.PUT_LINE ('Output sent to udump/ora_'||p_server_pid||'.trc');
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE ('Cannot find a session for SID '||TO_CHAR(r_sid));
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Error: '||SQLERRM);
END;
/
traceoff.sql
REM Script to turn TRACE MODE off for a selected SID.
set serveroutput ON size 2000;
set verify OFF;
DECLARE
r_sid NUMBER; v_sid NUMBER; v_serial NUMBER; v_username VARCHAR(30); v_status VARCHAR2(8); v_server VARCHAR2(9); p_server_pid VARCHAR2(9);
BEGIN
-- Accept r_sid Number 'What SID do you wish to trace? - '
r_sid := &SID;
SELECT s.sid, s.serial#, s.status, s.server, p.spid
INTO v_sid, v_serial, v_status, v_server, p_server_pid
FROM v$session s, v$process p
WHERE s.sid = r_sid
AND s.paddr = p.addr;
DBMS_OUTPUT.PUT_LINE ('Sid ' || TO_CHAR(v_sid) ||
' Serial# ' || TO_CHAR(v_serial) || ' Username ' || v_username || ' Status ' || v_status || ' Server ' || v_server );-- Time to Turn Trace OFF
SYS.DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(v_sid, v_serial, FALSE);
DBMS_OUTPUT.PUT_LINE ('Trace Mode is OFF for '||v_sid); DBMS_OUTPUT.PUT_LINE ('Output is in udump/ora_'||p_server_pid||'.ora');
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE ('Cannot find a session for SID '||TO_CHAR(r_sid));
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('Error: '||SQLERRM);
END;
/
>>> hamcdc_at_yahoo.co.uk 05/09/01 04:30AM >>> On a development box, 'alter session' should not cause too much harm. If you're concerned, write a package as SYS which turns on tracing for the developers session and just grant access on that...
You may want to look at _trace_files_public parameter as well so they can see their trace files.
hth
connor
"Some days you're the pigeon, some days you're the statue"
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: =?iso-8859-1?q?Connor=20McDonald?= INET: hamcdc_at_yahoo.co.uk Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Tim Sawmiller INET: sawmillert_at_state.mi.us Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed May 09 2001 - 06:53:39 CDT