Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Dropping all objects without dropping the schema

Re: Dropping all objects without dropping the schema

From: Brian Peasland <oracle_dba_at_nospam.peasland.net>
Date: Wed, 17 May 2006 20:46:34 GMT
Message-ID: <IzFGDn.KDp@igsrsparc2.er.usgs.gov>


Jflem wrote:
> Newbie question here-
>
> How does one drop all of the objects in a given schema without dropping
> the schema itself? I have looked at various threads and have tried the
> following with no luck.. I am running 10gR2
>
> select 'drop trigger', trigger_name, trigger_name, ';' from
> user_triggers;
> select 'drop sequence', sequence_name, sequence_name, ';' from
> user_sequences;
> select 'drop table', table_name, tablespace_name, 'cascade
> constraints;' from user_tables;
>

Try the following:

SPOOL drop_me.sql
SELECT 'DROP '||object_type||' '||object_name||';' FROM user_objects;
SPOOL off
@drop_me

HTH,
Brian

-- 
===================================================================

Brian Peasland
oracle_dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Wed May 17 2006 - 15:46:34 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US