Skip to Main Content

SQL & PL/SQL

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!

PL/SQL code to add to datafile

981609Feb 25 2015 — edited Mar 15 2015

Can somebody help me with some PL/SQL code. I would like to do the following:

get last datafile from tablespace
if (value in > 30GB)
then
  
  Loop
    alter database add datafile '+DATA01' size 30GB
    # Note datafile cant be bigger than 30GB
    # ie if 40GB is entered than 2 entries are created one for 30GB
    #    the second for 10GB
  end Loop
else
    same logic add size to datafile up to 30GB
    Loop
      if go over 30 GB than create new datafile
    End Loop
if

Please excuse the syntax as I know its not correct.  In summary,
what I want to do is create datafiles no bigger to 30GB for the
extra space just create new datafiles untl we hit the "value in"
limit

this can be hard-code "'+DATA01'"
  

Note, I dont want to use autoextend datafile as I want to control the size of my tablespaces...

Any code would be greatly apprecuated,.

Thanks to all who answer

This post has been answered by Jarkko Turpeinen on Feb 26 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2015
Added on Feb 25 2015
21 comments
6,847 views