杀进程create and truncate脚本
BEGIN
FOR C_R IN (SELECT DISTINCT 'ALTER SYSTEM KILL SESSION ''' || SE.SID || ',' ||
SE.SERIAL# || ''' IMMEDIATE' AS V_SQL,sq.sql_text
FROM V$SQL SQ, V$SESSION SE
WHERE SQ.SQL_ID = SE.SQL_ID
AND SE.STATUS IN ('ACTIVE')
AND UPPER(SQ.SQL_TEXT) LIKE 'CREATE TABLE%') LOOP
BEGIN
EXECUTE IMMEDIATE C_R.V_SQL;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
BEGIN
FOR C_R IN (SELECT DISTINCT 'ALTER SYSTEM KILL SESSION ''' || SE.SID || ',' ||
SE.SERIAL# || ''' IMMEDIATE' AS V_SQL,sq.sql_text
FROM V$SQL SQ, V$SESSION SE
WHERE SQ.SQL_ID = SE.SQL_ID
AND SE.STATUS IN ('ACTIVE')
AND UPPER(SQ.SQL_TEXT) LIKE 'TRUNCATE TABLE%') LOOP
BEGIN
EXECUTE IMMEDIATE C_R.V_SQL;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
END LOOP;
END;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24531354/viewspace-742281/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24531354/viewspace-742281/