Dynamic tablespace creation script in database
412903Nov 15 2006 — edited Nov 15 2006Hi,
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