Clean Up Tablespaces

—Clean Up Tablespaces

During Lab Testing with table partitioning scripting I came to around the need of below code…

SET SERVEROUTPUT ON
DECLARE
CNT INT:=0;
BEGIN
LOOP

CNT := CNT + 1;

EXECUTE IMMEDIATE 'DROP TABLESPACE TBS_SESS_USAGE_SMRY0'||CNT||' INCLUDING CONTENTS AND DATAFILES';

DBMS_OUTPUT.PUT_LINE('DROP TABLESPACE TBS_SESS_USAGE_SMRY0'||CNT||' INCLUDING CONTENTS AND DATAFILES');

EXIT WHEN CNT >= 8;
END LOOP;
END;
/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s