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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. Oracle Database 12.2 RMAN Cross Platform Tablespace Transport Over Network
  2. Unable to Drop Undo tablespace Since Undo Segment is in Needs Recovery
  3. How to Drop Undo Tablespace in Oracle Database
  4. ASMLib-Managed Disks on Multipathed iSCSI Targets are not Discovered after Server Reboot in CentOS/RHEL 7
  5. How to Check the Environment Variables for an Oracle Process
  6. How to trace asmcmd command on UNIX/Linux
  7. Oracle Database – How to Recover from a Lost or Deleted Datafile with Different Scenarios
  8. How to Shrink the datafile of Undo Tablespace in Oracle Database
  9. How To Cancel A SQL Query In Oracle Database 18c
  10. How to Recover From Lost or Missing Database Parameter Files (PFILE or SPFILE)

You May Also Like

Primary Sidebar

Recent Posts

  • What are different Oracle Database Vault Roles
  • Unable to export realm protected table using data pump
  • Beginners Guide to Oracle Database Vault
  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary