Unix Technical Forum

switching datafiles that are used

This is a discussion on switching datafiles that are used within the Oracle Database forums, part of the Database Server Software category; --> I'm running 9i on a Unix AIX 5 system. I have a logical volume that is getting full and ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-25-2008, 01:27 AM
balvey@comcast.net
 
Posts: n/a
Default switching datafiles that are used

I'm running 9i on a Unix AIX 5 system. I have a logical volume that is
getting full and have created a new volume that I want to start using.

I want to create a datafile, on the new disk, for each datafile that
existed on the old disk. After doing this how can I insure that I wont
write to the old disk anymore?

I have turned off the autoextend on those old datafiles, is that enough
to get them to quite writing to the old files when they have used what
has been allocated already? I'm also going to resize the old datafiles
after I have completed the creation of the new ones.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-25-2008, 01:27 AM
Mladen Gogala
 
Posts: n/a
Default Re: switching datafiles that are used

On Thu, 05 Jan 2006 11:44:17 -0800, balvey wrote:

> I'm running 9i on a Unix AIX 5 system. I have a logical volume that is
> getting full and have created a new volume that I want to start using.
>
> I want to create a datafile, on the new disk, for each datafile that
> existed on the old disk.


There is a litle known and unexplored command called "cp". You should shut
your database down and utilize this expert command:

cp /olddir/* /newdir/


Please, you should not execute something like rm -rf $ORACLE_HOME under
any circumstances. When cp command finishes (and that might take some time,
depending on the size of your database) you should bring your database up
to the mount phase ("alter database mount") and rename all the files by
utilizing "alter database rename file <old file> to <new file>" command
for each and every one of them.

Your database is now mounted and files are renamed. You can now open the
database and remove the old files.


> After doing this how can I insure that I wont
> write to the old disk anymore?
>
> I have turned off the autoextend on those old datafiles, is that enough
> to get them to quite writing to the old files when they have used what
> has been allocated already? I'm also going to resize the old datafiles
> after I have completed the creation of the new ones.


--
http://www.mgogala.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2008, 01:27 AM
balvey@comcast.net
 
Posts: n/a
Default Re: switching datafiles that are used

I don't want to copy. I want new datafiles without losing the old ones.
They still need to be read but any new data needs to be written to my
new disk.

Basically I need to know if I turn off autoextend on a datafile will
the new datafiles start to be used when the old fills up.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-25-2008, 01:27 AM
Mladen Gogala
 
Posts: n/a
Default Re: switching datafiles that are used

On Thu, 05 Jan 2006 12:57:11 -0800, balvey wrote:

> I don't want to copy. I want new datafiles without losing the old ones.
> They still need to be read but any new data needs to be written to my
> new disk.


So, add the new ones to your new disk. Where is the problem? Set
DB_CREATE_FILE_DEST to the new disk and you'll have OMF (Oh My F....).

--
http://www.mgogala.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-25-2008, 01:28 AM
Joel Garry
 
Posts: n/a
Default Re: switching datafiles that are used

bal... wrote:

>Basically I need to know if I turn off autoextend on a datafile will
>the new datafiles start to be used when the old fills up.


Oracle seems to round robin the placement of data into multiple
datafiles within a tablespace. So it is possible the new data files
will be written before the old fill up. I'm not sure of the exact
round robin algorithm, so I don't know what Oracle will do with a new
empty one and an almost full old one. You might want to test based on
your specific configuration and app.

It's difficult to give advice without knowing the reason you are asking
(are you archiving? Suffering from Compulsive Tuning Disorder? Using
WORM devices? RAID-5 old data?), as well as the scope of the request
(10 tables? 100000 tables? One tablespace? 100000 tablespaces?). In
the olden days, there were tricks we did to make segments appear on
specific disks for various reasons, some based on myth. With modern
devices, we tend to just SAME and let the electronic sprites sort it
out. You might want to read up on read-only tablespaces if you really
don't want to write to some things. You might want to review the
concepts manual to be sure you understand the definitions of
tablespaces, segments and so forth.

And I'm not entirely clear on how you intend to resize full
datafiles...

jg
--
@home.com is bogus.
"You can't sit there waiting for every last piece of information." -
Martin Baron
http://www.signonsandiego.com/uniont..._1n5media.html

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-25-2008, 01:28 AM
Andrew Allen
 
Posts: n/a
Default Re: switching datafiles that are used

balvey@comcast.net wrote:
> I don't want to copy. I want new datafiles without losing the old ones.
> They still need to be read but any new data needs to be written to my
> new disk.
>
> Basically I need to know if I turn off autoextend on a datafile will
> the new datafiles start to be used when the old fills up.
>

1) alter each existing datafile so autoextend is off.
2) alter each datafile so that it is resized to the end of the HWM.
That is, resize it to release back to the OS any free space beyond the
end of the last used extent.
3) add a datafile for each tablespace on the new disk volume.

Done.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-25-2008, 01:29 AM
balvey@comcast.net
 
Posts: n/a
Default Re: switching datafiles that are used

Datafiles are not full, the disk (volume) is getting full, I only have
1G left. I don't want the old datafiles to extend and completely fill
up the disk that they are on.

Not really sure how many tables or indexes, I'm estimating bunches. It
is 12 different tablespaces though. None of that really matters though,
I just don't want to fill up that disk that the datafiles reside on.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-25-2008, 01:30 AM
balvey@comcast.net
 
Posts: n/a
Default Re: switching datafiles that are used

finally an answer worth reading. thanks, that is what I have done; just
wanted to make sure I was going down the correct path.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:12 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com