ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling
complimentary technical Workshops on Database Security for the first 30
Oracle Database customers located anywhere in North America, EMEA, LATAM, or
APAC that send an email to
asra_us@oracle.com. Request a Workshop for
your organization today.
Purpose
The demos on this page are taken from Jeremiah Wilton's paper presented at UKOUG '08 in Birmingham UK by Dan Morgan.
Given the fact that Linux/UNIX are superior operating systems to Windows if you choose to try some of these demos with Windows expect that you may need to reboot your server.
Useful Views
SELECT view_name FROM dba_views
WHERE view_name LIKE '%V%WAIT%'
AND owner = 'SYS'
ORDER BY 1;
Bug 6073325: SELECT QUERY with CONNECT BY PRIOR fails with ORA-00600 [KKQCBYDRV:1]
SELECT 1
FROM sys.table_privileges tp, user_objects uo
WHERE tp.grantee IN (
SELECT 1
FROM sys.dba_role_privs
CONNECT BY PRIOR prior granted_role = grantee
START WITH with grantee = 'scott');
ORA-07445 Simple Case
SELECT spid
FROM v$process p, v$session s
WHERE p.addr = s.paddr
AND s.sid = sys_context('USERENV','SID');
oracle@db02$ kill -SEGV 2513
ORA-07445 Using PL/SQL
DECLARE
a EXCEPTION;
PRAGMA EXCEPTION_INIT(a, -7445);
BEGIN
RAISE a;
END;
/
EXPLAIN PLAN FOR
SELECT 1
FROM t1 a, t2 b ,t1 c
WHERE b.col1 = 'xxslc_department'
AND a.c1 NOT BETWEEN c.c3 AND c.c4
START WITH a.c2='p'
CONNECT BY PRIOR a.c1 BETWEEN a.c3 AND a.c4;
UPDATE customers
SET cust_first_name = 'Nimrod'
WHERE rownum < 1000;
COMMIT;
SELECT versions_startscn, versions_endscn, versions_xid
FROM customers
VERSIONS BETWEEN timestamp sysdate-(.25/24) and sysdate
WHERE cust_first_name = 'Nimrod';
SELECT undo_sql
FROM flashback_transaction_query
WHERE xid = '00090015000003A1'
BreakDB Source Code
RMAN Class Finals Framework
This framework reports the action to be taken using dbms_output.put_line. To make this work for your environment comment out that line and replace with the appropriate command to drop or corrupt the resource.
One simple way to do it is with UTL_FILE.
I have intentionally not included the destructive code here but if you take my disaster avoidance and recovery class ... you will find the numbers scrambled, the code wrapped, and the damage unmistakeable.
CREATE OR REPLACE PROCEDURE break_db (breakval PLS_INTEGER) AUTHID DEFINER IS
fname VARCHAR2(513);
i PLS_INTEGER;
b BOOLEAN := FALSE;
BEGIN
dbms_output.put_line(TO_CHAR(breakval));
SELECT COUNT(*)
INTO i
FROM v$backup_files
WHERE completion_time > SYSDATE-4/24
AND keep_until > SYSDATE;
-- does it appear there is a current backup?
IF i > 0 THEN
b := TRUE;
END IF;
IF breakval = 0 THEN
dbms_output.put_line('You were lucky this time: Try again');
ELSIF breakval = 1 THEN -- drop a control file
SELECT value
INTO fname
FROM gv$parameter
WHERE name = 'control_files';
fname := SUBSTR(fname,1,INSTR(fname,',',1,1)-1);
dbms_output.put_line('Dropping Control File ' || fname);
ELSIF breakval = 2 THEN -- drop an inactive log file
SELECT MAX(member)
INTO fname
FROM gv$logfile lf, gv$log lg
WHERE lf.group# = lg.group#
AND lg.status = 'INACTIVE';
dbms_output.put_line('Dropping Inactive Log File Member ' || fname);
ELSIF breakval = 3 THEN -- drop active/current log file
SELECT MAX(member)
INTO fname
FROM gv$logfile lf, gv$log lg
WHERE lf.group# = lg.group#
AND lg.status IN ('ACTIVE', 'CURRENT');
dbms_output.put_line('Dropping Active or Current Log File Member ' || fname);
ELSIF breakval = 4 THEN -- dropping log group
SELECT MIN(group#)
INTO i
FROM gv$log;
FOR rec IN (SELECT member FROM gv$logfile) LOOP
dbms_output.put_line('Dropping Log Group ' || TO_CHAR(i) || ' File: ' || rec.member);
END LOOP;
ELSIF breakval = 5 THEN -- drop data file
SELECT MAX(tablespace_name)
INTO fname
FROM (
SELECT tablespace_name, COUNT(*)
FROM dba_data_files
GROUP BY tablespace_name
HAVING COUNT(*) = 1)
WHERE tablespace_name NOT IN ('SYSTEM', 'SYSAUX', 'UNDOTBS1', 'TEMP');
SELECT MAX(file_name)
INTO fname
FROM dba_data_files
WHERE tablespace_name = fname;
dbms_output.put_line('Dropping Data File ' || fname || ' From Tablespace');
ELSIF breakval = 6 THEN -- drop tablespace
SELECT MAX(tablespace_name)
INTO fname
FROM dba_tablespaces
WHERE contents = 'PERMANENT'
AND tablespace_name NOT IN ('SYSTEM', 'SYSAUX');
dbms_output.put_line('Dropping Data Tablespace ' || fname);
ELSIF breakval = 7 THEN -- drop temporary tablespace
SELECT tablespace_name
INTO fname
FROM dba_tablespaces
WHERE contents = 'TEMPORARY';
dbms_output.put_line('Dropping Temporary Tablespace ' || fname);
ELSIF breakval = 8 THEN -- drop undo tablespace
SELECT tablespace_name
INTO fname
FROM dba_tablespaces
WHERE contents = 'UNDO';
dbms_output.put_line('Dropping Undo Tablespace ' || fname);
ELSIF breakval = 9 THEN -- drop system or sysaux tablespace
dbms_output.put_line('Dropping System or SysAux Tablespace. Have a nice day!');
ELSE
dbms_output.put_line('Now you''ve done it!');
END IF;
IF NOT b THEN
dbms_output.put_line('Next Time Use RMAN');
END IF;
END break_db;
/