Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
If youAnnelize said:I don't want to drop the entire schema.
DROP USER username CASCADE
I was not aware that "the easy way" is ruled out of the competition. If we are looking for "the hardest way", I'm sure I can contrive some very time-consuming, labour-intensive methods for draining a schema if that is the goal. <grin>Annelize said:I don't want to drop and recreate the schema as that would be an easy way of getting rid of everything.
Annelize said:I want to explicitly drop tables and everything that reference it.
select 'DROP TABLE ' || object_name || ';'
from user_objects
where object_type = 'TABLE'
REM **************************************************************
REM David L. Hunt (file author) distributes this and other
REM files/scripts for educational purposes only, to illustrate the
REM use or application of various computing techniques. Neither the
REM author nor "Dasages, LLC" makes any warranty regarding this
REM script's fitness for any industrial application or purpose nor is
REM there any claim that this or any similarly-distributed scripts
REM are error free or should be used for any purpose other than
REM illustration.
REM
REM Please contact the author via email (dave@dasages.com) when
REM you have comments, suggestions, and/or difficulties with this
REM package or its functions.
REM
REM [Please keep the above disclaimer and the embedded electronic
REM documentation with this script.]
REM **************************************************************
set feedback off
set pagesize 0
spool temp.sql
select 'DROP TABLE '||table_name||' cascade constraints;'
from user_tables
order by table_name
/
select 'DROP '||object_type||' '||object_name||';'
from user_objects
where object_type not in ('TABLE','INDEX','TRIGGER')
order by object_type, object_name
/
spool off
set pagesize 35
set feedback on
prompt
prompt To actually drop objects from this schema, '@temp.sql' at the SQL> prompt
prompt
DROP TABLE TIMES cascade constraints;
DROP TABLE X cascade constraints;
DROP DATABASE LINK YADA.WORLD;
DROP FUNCTION GET_DATE;
DROP FUNCTION GET_DISTANCE;
DROP FUNCTION TO_MILLISECS;
DROP PACKAGE VAC;
DROP PACKAGE VACATION_LIABILITY;
DROP PACKAGE BODY VAC;
DROP PACKAGE BODY VACATION_LIABILITY;
DROP PROCEDURE PREP_USER_CONSTRAINTS;
DROP PROCEDURE PRT;
DROP PROCEDURE SK;
DROP SEQUENCE S_CUSTOMER_ID;
DROP SEQUENCE S_DEPT_ID;
DROP SEQUENCE S_EMP_ID;
begin
for f in (select 'DROP TABLE '||table_name||' cascade constraints' cmd
from user_tables) loop
execute immediate f.cmd;
end loop;
for f in (select 'DROP '||object_type||' '||object_name cmd
from user_objects) loop
execute immediate f.cmd;
end loop;
end ;