In case database is using ASM diskgroup to place the database files. Some times we need to change the datafile directory name from neerajDEV to neerajTEST.
Assumption:
Database has placed the datafiles in +DATA
DB_UNIQUE_NAME is neerajDEV
ASM uses the OMF to place the datafiles in diskgroups. OMF uses below methods to place the files in asm diskgroup.
<DiskGroup_name>/neerajDEV/
>>>>>DATAFILE
>>>>>PARAMETERFILE
>>>>>CONTROLFILE
>>>>>ONLINELOG
>>>>>ARCVHIVELOG
Case:
In ASM, you created the directory manually and now database is using this directory to place several database files. Due to rename activity, you want to rename the directory.
Challenge:
ASMCMD does not provide option to rename the directory like we have 'mv' at OS level.
Solution:
You can use the ALTER DISKGROUP <DG_NAME> rename directory 'sourcename' to 'destname';
Condition:
- Rename of the direcotry is possible only in one case if the system_created column value for files is mentioned as 'N' in v$ASM_ALIAS view.
Example:
alter diskgroup DATA rename directory '+DATA\neerajDEV\datafiles' to '+DATA\neerajTEST\datafiles';
- In case the value is of SYSTEM_CREATED column for files is mentioned as 'Y' in v$ASM_ALIAS view, alter diskgroup will not be helpful.
In that case use the RMAN with new DB_UNIQE_NAME and backup database as copy followed by switch database to copy
No comments:
Post a Comment