There are 2 different scenarios to consider:
- Renaming an OMF to a non-OMF name.
- Renaming an OMF to another OMF-compliant name.
Note that renaming an OMF to another OMF-compliant name is not normally recommended. You should allow Oracle to name the files. But, should you wish to rename one but maintain its OMF status, it can be accomplished.
Here are the 3 methods for renaming an OMF.
Method 1
Rename tablespace and make it offline.
SQL> ALTER TABLESPACE tsname OFFLINE
2. Move/Rename the file at the OS level. Depending on the underlying OS commands may be different.
3. Rename the datafiles from the “tsname” tablespace from old to new:
SQL> ALTER TABLESPACE tsname RENAME DATAFILE 'oldomfname' TO 'newnonomfname';
4. Make “tsname” tablespace online:
SQL> ALTER TABLESPACE tsname ONLINE
Method 2
1. Shutdown the database first.
SQL> SHUTDOWN IMMEDIATE (or normal)
2. Move/Rename the file at the OS level. Depending on the underlying OS commands may be different.
3. Start the database in Mount stage.
SQL> STARTUP MOUNT
4. Rename the datafile at database level:
SQL> ALTER DATABASE RENAME FILE 'oldomfname' TO 'newnonomfname';
5. Open database in read write mode.
SQL> ALTER DATABASE OPEN
If you attempt to rename an OMF to another OMF-compliant name at the mount stage with the ALTER DATABASE command, you will receive the following errors:
ORA-01511: error in renaming log/data files ORA-01276: Cannot add a file with an Oracle Managed Files file name.
Method 3
1. Shutdown the database first:
SQL> SHUTDOWN IMMEDIATE (or normal)
2. Move/Rename the file at the OS level. Depending on the underlying OS commands may be different.
3. Recreate the controlfile with the desired name. For details on recreating the controlfile, refer to the below document.