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: How to TRUNCATE USER

Re: How to TRUNCATE USER

From: Dusha <lobov_at_ssc.ufacom.ru>
Date: Wed, 24 Jul 2002 11:10:25 +0600
Message-ID: <ahlcrj$ol$1@bashnet.ru>

"Rick Denoire" <100.17706_at_germanynet.de> ???????/???????? ? ???????? ?????????: news:oojrjuoetm26s9e4ht469i38n0d95sbsij_at_4ax.com...
> Hello
>
> This is simple: Preparing a DB for import. I know about IGNORE=Y but I
> would prefer a clean state to begin with. I could also drop the user
> whose schema I want to get rid of before importing, but this is prone
> to errors since I would need to recreate all his properties
> (privileges, roles etc.). Finally, I could drop all his objects,
> hundreds of them... rather not.
>
> So how can I truncate users, meaning getting rid of all his data in
> order to reimport again?
>
> Thanks
> Rick

set heading off
set wrap off
set echo off
set pagesize 0
set linesize 200
spool truncate_user.sql
select 'drop '||OBJECT_TYPE
||' '||OBJECT_NAME||decode(OBJECT_TYPE,'TABLE',' cascade constraint;',';') from user_objects where object_type
in ('VIEW','PACKAGE','PROCEDURE','FUNCTION','TABLE','SEQUENCE'); spool off
@truncate_user; Received on Wed Jul 24 2002 - 00:10:25 CDT

Original text of this message

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