Hello everyone!
I hope you're doing well!
Today, I needed to move a datafile to another ASM Disk Group.
The process was simple, but remember that this step-by-step worked for me, but it may not work for you.
So do it in a test environment if you're not sure.
Important:
- For SYS and SYSAUX, the procedure will be slightly different, so don't use this step-by-step in these two cases.
- There are also other ways to do this process, today I chose to do this one.
So, let's go to the party!
1) Check the datafile path
SQL> SELECT file#, name FROM v$datafile where name like '%zab%';
2) Create a backup as copy with RMAN
RMAN> BACKUP AS COPY DATAFILE 69 format '+DGFRA';
RMAN> BACKUP AS COPY DATAFILE 69 format '+DGFRA';
3) I put the datafile offline
SQL> ALTER DATABASE DATAFILE 69 offline;
4) I switch & recover the datafile
RMAN> switch datafile 69 to copy;
RMAN> recover datafile 69;
RMAN> recover datafile 69;
5) I put the datafile online
SQL> ALTER DATABASE DATAFILE 69 online;
6) Check the datafile in the new location
SQL> SELECT file#, name FROM v$datafile where name like '%zab%';7) Delete the old datafile
RMAN> delete datafilecopy '+DGDATA/PRD/DATAFILE/tbs_zabbix.334.1144323691';
As simple as that!
Regards
Mario