Migrating Oracle Database from File system to ASM
Source DB Version: 12.1.0.2.0 - File System
Target DB Version: 12.1.0.2.0 - ASM Database
Steps to Migrate Database from from File system to ASM using RMAN:
1) Take Full RMAN backup with archivelog & current controlfile from source db.
2) Copy pfile and password file from source db to target db
3) Restore RMAN backup on Target DB
On Source Side:
We will be targeting to take a hot backup assuming we dont have downtime, hence it is necessary that database is up and running, if not please start the database.
Just to note we can even take cold backup, my demonstration will be for hot backup.
sqlplus / as sysdba
startup
Please check if the LOG_MODE is Archive
select name,log_mode from v$database;
Check for correct ORACLE_SID, if not set the ORACLE_SID
echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)
Next step is to take RMAN Backup
rman target /
run {
backup database format="PATH_TO_BACKUP_LOCATION/db_%U";
backup archivelog all format="PATH_TO_BACKUP_LOCATION/archs_%U";
backup current controlfile format="PATH_TO_BACKUP_LOCATION/control.bks";
}
Take a Pfile backup from the Source Instance
SQL> create pfile from spfile;
Go to ORACLE_HOME/dbs, copy the password file and pfile from SOURCE to TARGET
Copy the Backup files to the Target Database (You can use SCP, RSYNC, SFTP any method to move the file across)
On Target Side:
Assuming the backup files, Pfile and Password file is copied to the Target server, we will now proceed with restoration of database at Target
Check for correct ORACLE_SID, if not set the ORACLE_SID
echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)
sqlplus / as sysdba
startup nomount pfile='PATH_TO_PFILE';
create spfile from pfile;
After creating spfile we will now proceed with restoration of database.
rman target /
RMAN> startup nomount force
RMAN> ALTER SYSTEM SET CONTROL_FILES='+DATA','+DATA' SCOPE=SPFILE SID='*';
RMAN> shutdown immediate
RMAN> startup nomount
RMAN> restore controlfile from 'PATH_TO_BACKUP_LOCATION';
RMAN> Alter database mount;
RMAN> create spfile='+DATA' from memory;
RMAN> shutdown immediate
RMAN> startup nomount
Note : Clear init file data and append spfile location
rman target /
RMAN> catalog start with 'path_to_backup_files';
RMAN> run {
RMAN> set newname for database to '+DATA';
RMAN> restore database;
RMAN> switch datafile all;
RMAN> RECOVER DATABASE;
RMAN> }
Rename the REDO file location
ALTER DATABASE RENAME FILE 'OLD_PATH' TO '+RECO';
After Restoration of the database lets open the database and add TEMP tablespace as required.
sqlplus / as sysdba
alter database open resetlogs;
Check the status of the restored database, it should be in READ WRITE Mode.
SQL> select name,open_mode,log_mode, version from v$database,v$instance;
Target DB Version: 12.1.0.2.0 - ASM Database
Steps to Migrate Database from from File system to ASM using RMAN:
1) Take Full RMAN backup with archivelog & current controlfile from source db.
2) Copy pfile and password file from source db to target db
3) Restore RMAN backup on Target DB
On Source Side:
We will be targeting to take a hot backup assuming we dont have downtime, hence it is necessary that database is up and running, if not please start the database.
Just to note we can even take cold backup, my demonstration will be for hot backup.
sqlplus / as sysdba
startup
Please check if the LOG_MODE is Archive
select name,log_mode from v$database;
Check for correct ORACLE_SID, if not set the ORACLE_SID
echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)
Next step is to take RMAN Backup
rman target /
run {
backup database format="PATH_TO_BACKUP_LOCATION/db_%U";
backup archivelog all format="PATH_TO_BACKUP_LOCATION/archs_%U";
backup current controlfile format="PATH_TO_BACKUP_LOCATION/control.bks";
}
Take a Pfile backup from the Source Instance
SQL> create pfile from spfile;
Go to ORACLE_HOME/dbs, copy the password file and pfile from SOURCE to TARGET
Copy the Backup files to the Target Database (You can use SCP, RSYNC, SFTP any method to move the file across)
On Target Side:
Assuming the backup files, Pfile and Password file is copied to the Target server, we will now proceed with restoration of database at Target
Check for correct ORACLE_SID, if not set the ORACLE_SID
echo $ORACLE_SID
export ORACLE_SID=ORCL (To Set ORACLE_SID)
sqlplus / as sysdba
startup nomount pfile='PATH_TO_PFILE';
create spfile from pfile;
After creating spfile we will now proceed with restoration of database.
rman target /
RMAN> startup nomount force
RMAN> ALTER SYSTEM SET CONTROL_FILES='+DATA','+DATA' SCOPE=SPFILE SID='*';
RMAN> shutdown immediate
RMAN> startup nomount
RMAN> restore controlfile from 'PATH_TO_BACKUP_LOCATION';
RMAN> Alter database mount;
RMAN> create spfile='+DATA' from memory;
RMAN> shutdown immediate
RMAN> startup nomount
Note : Clear init file data and append spfile location
rman target /
RMAN> catalog start with 'path_to_backup_files';
RMAN> run {
RMAN> set newname for database to '+DATA';
RMAN> restore database;
RMAN> switch datafile all;
RMAN> RECOVER DATABASE;
RMAN> }
Rename the REDO file location
ALTER DATABASE RENAME FILE 'OLD_PATH' TO '+RECO';
After Restoration of the database lets open the database and add TEMP tablespace as required.
sqlplus / as sysdba
alter database open resetlogs;
Check the status of the restored database, it should be in READ WRITE Mode.
SQL> select name,open_mode,log_mode, version from v$database,v$instance;
Comments
Post a Comment