Page 1

Renaming a Data File

Administration Tips

Renaming a Data File There is only one question to ask yourself before carrying out this task: Is the Data File to be renamed part of the SYSTEM tablespace, or not? If the answer is "YES", then the procedure is as follows: Shutdown the database At the operating system, use appropriate O/S commands to actually rename the file Issue the command STARTUP MOUNT; Issue the command ALTER DATABASE RENAME FILE '/OLDFILENAME' TO '/NEWFILENAME'; Issue the command ALTER DATABASE OPEN; If the answer is "NO", then the procedure is as follows: Offline the relevant tablespace by issuing the command ALTER TABLESPACE BLAH OFFLINE; At the operating system, use appropriate O/S commands to actually rename the file Issue the command ALTER TABLESPACE RENAME DATAFILE '/OLDFILENAME' TO '/NEWFILENAME'; Bring the tablespace back online with the command ALTER TABLESPACE BLAH ONLINE; Actually, you could do the deed in this case by following exactly the same procedure as indicated for when it's the SYSTEM data file being renamed. However, the procedure described here has the distinct advantage of not requiring the entire database to be out of commission for the duration of the exercise. Any User wanting access to data contained within the affected tablespace will be stuffed, of course. But Users accessing data in other tablespaces will not even know that such maintenance is being performed. Incidentally, the crucial point to realise here is that, despite the various Oracle commands saying "rename datafile" or "rename file", Oracle never actually does any such thing! Renaming or moving or deleting files at the Operating System is strictly a job for the operating system itself (at least until you get to Oracle 9i). All the commands actually do is to re-jig the pointers to the file as stored within the Control File. Important stuff, no doubt -but the command is somewhat misleading as to its scope.

Copyright Š Howard Rogers 2001

10/17/2001

Page 1 of 1

datafilerename  

Offline the relevant tablespace by issuing the command ALTER TABLESPACE BLAH OFFLINE ; At the operating system, use appropriate O/S commands...

Read more
Read more
Similar to
Popular now
Just for you