RE: How to truncate all the tables in a schema in one shot?

RE: How to truncate all the tables in a schema in one shot?

 

  

I normally disable constraints,
Then truncate with re-use storage option,
Then enable the constraints.

Hope the following scripts that generate another scripts help.



SELECT 'ALTER table ' ||table_name||' disable constraint '||
constraint_name || ';'
FROM user_constraints;

SELECT 'TRUNCATE table ' ||table_name|| ' REUSE STORAGE ' || ';'
FROM user_tables;

SELECT 'ALTER table ' ||table_name||' enable constraint '||
constraint_name || ';'
FROM user_constraints;


Thanks,
------------------------------------------------------------------------
----
David Chiu

-----Original Message-----
From: Ranganath H M
[mailto:oracledba-ezmlmshield-x30718484.[Email address protected]
Sent: Wednesday, July 05, 2006 8:54 AM
To: LazyDBA Discussion
Subject: How to truncate all the tables in a schema in one shot?

Hi,
How to truncate all the tables in a schema in one shot.

Thanks,
Ringa


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com To unsubscribe:
see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com By using this list you agree
to these terms:http://www.lazydba.com/legal.html




Oracle LazyDBA home page