Moving a datafile from the file system can be achieved in two ways:
1. While the database is in shutdown or mount stage
2. While the database is running with the select tablespace offline
Moving an Oracle datafile while database is in mount state is performed in the following way:
Step 1: Shutdown and mount the database
shutdown immediate;
startup mount;
Step 2: Check free space avaialbel in the ASM diskgroup for copying the datafile
select file#, name, (bytes/1048576) File_size_MB from v$datafile;
select name, state, total_mb, free_mb from v$asm_diskgroup;
rman target /
Note: Export correct database oracle_sid before running this command.
RMAN>
copy datafile 3 to ‘+data01′;
Step 3: Update the controlfile with the new location of the datafile:
switch datafile 3 to copy;
The file is now in the new location;
select name from v$datafile;
alter database open
1. While the database is in shutdown or mount stage
2. While the database is running with the select tablespace offline
Moving an Oracle datafile while database is in mount state is performed in the following way:
Step 1: Shutdown and mount the database
shutdown immediate;
startup mount;
Step 2: Check free space avaialbel in the ASM diskgroup for copying the datafile
select file#, name, (bytes/1048576) File_size_MB from v$datafile;
select name, state, total_mb, free_mb from v$asm_diskgroup;
rman target /
Note: Export correct database oracle_sid before running this command.
RMAN>
copy datafile 3 to ‘+data01′;
Step 3: Update the controlfile with the new location of the datafile:
switch datafile 3 to copy;
The file is now in the new location;
select name from v$datafile;
alter database open
---------------------------------------------------------------------------------
While the Database is Running (with the selected tablespace offline)
In order to move a datafile without downtime, the tablespace where the datafile resides must be placed offline first.
Step1: Identify the tablespace which contains the datafile and offline that tablespace.
select tablespace_name, file_name from dba_data_files where file_id=3;
Step 2: Place the tablespace offline with below command:
alter tablespace users offline;
- After you have taken the tablespace offline
- execute the same steps above for copying the datafile to the ASM Diskgroup
alter tablespace users online;
---------------------------------------------------------------------------------
No comments:
Post a Comment