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: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 24 Jul 2002 00:41:11 +0200
Message-ID: <cqmrjuknlr2ave2fukd4d6sa928l4e5j32@4ax.com>


On Tue, 23 Jul 2002 23:56:35 +0200, Rick Denoire <100.17706_at_germanynet.de> wrote:

>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

begin
for tablist in (select table_name from user_tables order by table_name) loop
execute immediate 'truncate table '||tablist.table_name; end loop;
end;
/

Hth

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Tue Jul 23 2002 - 17:41:11 CDT

Original text of this message

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