Saturday, January 9, 2016

How to check which directories you have privilege to read & write before running export dump in oracle

To check on which directories you have privilege to read & write:
#################################################################

SQL> SELECT privilege, directory_name
2 FROM user_tab_privs t, all_directories d
3 WHERE t.table_name(+)=d.directory_name
4 ORDER BY 2,1;



How to enable debug mode in toad:

1. Grant debug any procedure to user_name;
2. Grant debug connect session to user_name;
3. GRANT EXECUTE ON DBMS_DEBUG to public;



========================
How to kill blocking session:
First check the session are not background;

set serveroutput on;
declare
CURSOR killist
IS
select s.sid, s.serial#
from v$session s
where last_call_et > 180
and s.status='ACTIVE'
and s.event<>'SQL*Net message from client'
and s.sid in (select HOLDING_SESSION from dba_blockers);
begin
for kills in killist loop
-- dbms_output.put_line('alter system kill session '''||kills.sid||','||kills.serial#||'''');
execute immediate 'alter system kill session ''' ||kills.sid||','||kills.serial#||'''';
end loop;
end;
/




##Killing a session


exec sys.kill(1147,13662)


No comments: