Tuesday, June 3, 2008

Relocate Database Files

Three files is called database files1. Datafiles & Tempfiles2. Control files3. Redo log files
Sometime we need to move database files from old to new location.How to move DATAFILES from old to new locationExcept SYSTEM,UNDO & TEMP tablespaceStep:1. Take tablespace offlinealter tablespace tbsname OFFLINE;2. through OS command MOVE datafiles from old to new location.mv 'old location' to 'new location'3. rename datafiles in database.alter database rename file 'old location' to 'new location';4. Take tablespace ONLINEalter tablespace tbsname ONLINE;For SYSTEM or UNDO tablespaceStep:1. shutdown databaseshutdown immediate;2. move datafile old to new location through OS command.mv old location new location3. startup database with mount stage.startup mount;4. rename datafile in databasealter databaserename file 'old location' to 'new location';5. open database for normal usealter database open;We can't relocate tempfile, if we need to relocate tempfile then best option is recreate temp tablespace with new location.How to move REDO LOG MEMBER from old to new location
Step:1. shutdown databaseshutdown immediate;2. mv redo log member from old to new locationmv oldlocation newlocation3. startup database with mount stagestartup mount;4. rename redo log member in databasealter database rename file 'old location' to 'new location';5. open database for normal usealter database open;How to move control file old to new location
Step:1. shutdown databaseshutdown immediate;2. mv controlfile to old to new locationmv old location new location3. edit CONTROL_FILES parameter in pfile and change location from old to newCONTROL_FILES='new location'4. recreate SPFILE from PFILEcreate spfile from pfile;5. startup databasestartup;

No comments: