dbTalk Databases Forums  

How to drop all of a user's data?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss How to drop all of a user's data? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default How to drop all of a user's data? - 07-21-2006 , 03:37 PM






I have user joeschmo in a 10g database. I have a script that creates a
bunch of tables, sequences, packages, etc. under that user (called
joeschmo.table1, etc.)

How can I delete all the tables, sequences, packages, etc. for user
joeschmo - without deleting the user? I can do a lot of drop table x,
drop sequence y, but I was hoping for something in a single statement.

I'm probably missing something obvious...


Reply With Quote
  #2  
Old   
Robbert van der Hoorn
 
Posts: n/a

Default Re: How to drop all of a user's data? - 07-21-2006 , 05:59 PM







<andrew.fabbro (AT) gmail (DOT) com> wrote

Quote:
I have user joeschmo in a 10g database. I have a script that creates a
bunch of tables, sequences, packages, etc. under that user (called
joeschmo.table1, etc.)

How can I delete all the tables, sequences, packages, etc. for user
joeschmo - without deleting the user? I can do a lot of drop table x,
drop sequence y, but I was hoping for something in a single statement.

I'm probably missing something obvious...

Drop user, (re)create user?




Reply With Quote
  #3  
Old   
Michel Cadot
 
Posts: n/a

Default Re: How to drop all of a user's data? - 07-22-2006 , 12:21 AM




<andrew.fabbro (AT) gmail (DOT) com> a écrit dans le message de news: 1153514221.715473.214990 (AT) s13g20...oglegroups.com...
Quote:
I have user joeschmo in a 10g database. I have a script that creates a
bunch of tables, sequences, packages, etc. under that user (called
joeschmo.table1, etc.)

How can I delete all the tables, sequences, packages, etc. for user
joeschmo - without deleting the user? I can do a lot of drop table x,
drop sequence y, but I was hoping for something in a single statement.

I'm probably missing something obvious...

set heading off
set pagesize 0
set feedback off
set timing off
set time off
set trimspool on
set trimout on
set linesize 100
set echo off
spool t
select 'drop '||object_type||' '||object_name||
decode(object_type,'CLUSTER',' including tables cascade constraints',
'TABLE',' cascade constraints',
'')||';'
from user_objects
where object_type in ('CLUSTER','CONTEXT','DATABASE LINK','DIMENSION',
'DIRECTORY','FUNCTION','INDEX TYPE',
'JAVA','LIBRARY','MATERIALIZED VIEW','OPERATOR',
'OUTLINE','PACKAGE','PROCEDURE','SEQUENCE',
'SYNONYM','TABLE','TYPE','VIEW')
order by object_type, object_name
/
spool off
@t.lst

Regards
Michel Cadot




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.