• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to move or rename a datafile in the same ASM diskgroup (Using ASM alias)

by admin

ASM files can be renamed like any other files in a standard filesystem. For ASM, rename is performed through some type of statements (ADD ALIAS, RENAME ALIAS, ADD DIRECTORY) to manipulate filenames, alias, and directories.

Renaming datafiles is sometimes needed when database file names still contain old database name after a database on ASM is renamed (for example with nid). Then, it is required to change ASM datafile names accordingly with the new database name. RMAN backup copy doesn’t work in this case as file still remains in the same diskgroup.

Follow the steps given below to perform such a rename.

Changes at ASM Instance

1. Create directory names within diskgroup.

alter diskgroup dg1 add directory '+dg1/[new_dir_name]';
alter diskgroup dg1 add directory '+dg1/[new_dir_name]/[datafile]';

For Example:

old datafile name: +DG1/ee1020/datafile/books.256.652915493
new datafile name: +DG1/DD1020/datafile/books.dbf
alter diskgroup dg1 add directory '+DG1/DD1020';
alter diskgroup dg1 add directory '+DG1/DD1020/datafile';

2. Create an alias for the target datafile name with new path and filename

alter diskgroup dg1 add alias 
'[fully_qualified_new_data_file_name]' for '[fully_qualified_old_data_file_name]';

For Example:

alter diskgroup dg1 add alias 
'+DG1/DD1020/datafile/books.dbf' for '+DG1/ee1020/datafile/books.256.652915493';

Change at Database instance

1. Startup database in mount mode and rename the datafile. To use this clause for a datafile or tempfile, the database needs to be in mount mode. The database can also be open, but the datafile or tempfile being renamed must be offline.

startup mount
alter database rename file 
'[fully_qualified_old_data_file_name]' to '[fully_qualified_new_data_file_name]';

For Example:

alter database rename file 
'+DG1/ee1020/datafile/books.256.652915493' to '+DG1/DD1020/datafile/books.dbf';
Note: “Rename Alias” on system-created filenames fails with ORA-15177. There is no way to rename a system generated ASM filename. Once a user-created-alias is added in the diskgroup, then you can use “rename alias” to rename the filename within ASM.

For Example:

alter diskgroup dg1 
rename alias '+DG1/DD1020/datafile/books.dbf' to '+DG1/DD1020/datafile/books2.dbf';

Filed Under: ASM, oracle

Some more articles you might also be interested in …

  1. How to Switch to a New Undo Tablespace in Oracle Database
  2. Beginners Guide to Sequences in Oracle
  3. Oracle Tablespace Transport for a Single Partition
  4. Oracle Data Guard 12c New Feature: Far Sync Standby
  5. How to Enable or Disable Veritas ODM for Oracle database 12.1.0.1
  6. How to Optimize a Data Guard Configuration
  7. How To Disable Advanced Analytics in Oracle Database 12c?
  8. What is spfile in Oracle Database
  9. ASMLib-Managed Disks on Multipathed iSCSI Targets are not Discovered after Server Reboot in CentOS/RHEL 7
  10. ORA-19554: error allocating device, device type: SBT_TAPE, device name:

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright