Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic tablespace creation script in database

412903Nov 15 2006 — edited Nov 15 2006
Hi,


I am looking for a script which can generate create tablespace statements dynamically from the existing database so that I can run these create tablespace statements on to the new databases.

My first try is like this


SQL> select ' create tablespace ' || tablespace_name a || ' datafile ' || ' size
s)|| ' from ' || dba_free_space where tablespace_name = a ||' extent managemen
|| select initial_extent from dba_tablespaces where tablespace_name = || ' segment space management auto ;' from dba_tablespaces;

This sql should resemble the following template.

Create tablespace D0001 datafile
'/ldata/<SITE CODE>/<FILE DB NAME>/oradata/<SID NAME>/<SID NAME>_d0034a.dbf' size 640M extent management local uniform size 64K segment space management auto;


I will add datafile location later in the create tablespace script.


I want to thank you in advance for any help on this.


Regards,

prabhath
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2006
Added on Nov 15 2006
8 comments
2,151 views