Oracle database migration from server to server using RMAN


Datafiles move from one disk to another disk, Database move from one disk to another disk, switch database to rman incrementally updated backup copy images.

Complete database migration from one server to another using rman backup in scheduled window / downtime:

Source server:
1.       Check the all application services are in down or not. Have make sure all the application services down before starting.
Sql>select process, program, username from v$session where username not like '%oracle%';
2.       Make sure the switch log file / check point at database level.
Sql> alter system switch logfile;
Or
Sql> alter system checkpoint;
3.       Take the rman full backup.
Rman > backup database plus archivelog;
Above command takes the full database backup. Also takes backup of spfile and controlfile but have to configure controlfile auto backup on then it takes the backup as $ORACLE_HOME/dbs/c-dbid-date.
4.       Using scp send the all backup files to target server.
5.       Copy all password file, listener, tnsnames, sqlnet.ora file to target server.

 Target server:
1.       Install oracle binaries, place the password file in $ORACLE_HOME/dbs location, listener, tnsnames and sqlnet.ora file in $ORACLE_HOME/network/admin location.
2.       Set the bash_profile.sh for oracle user, export ORACLE_SID=orcl (instance name).
3.       Connect to the rman.
Rman target sys/pwd

Rman> set dbid 43123423;

Rman> restore spfile from ‘/u01/backup/c-43123423-20170823’ to ‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/spfileorcl.ora’;

Sql> startup nomount

Rman> restore controlfile from ‘/u01/backup/c-43123423-20170823’; (please make sure the path of the controlfile from pfile)

Sql> startup mount;


Rman>  run { 
catalog start with '/backup location/';
set newname for database to '/new database files location/%b';
restore database;
switch datafile all;
recover database;
}

Above run block

1.    Catalog start with ‘backup sets location’ : rman catalogs the backup copies.
2.    Set newname for database to ‘/destination/%b’ : it renames the all datafiles location to new location in target server.
%b specifies stripped datafiles to single location
3.    Restore database: restore the database
4.    Switch datafile all: it switches all the datafile to new location
5.    Recover database: it recovers the database
4.       Rename the all redo log files.
Sql> select member from v$logfile;
Sql> alter database rename file '/previous path/redo01.log' to '/new path/redo01.log';
5.       Open database using open reset logs.
Sql> alter database open reset logs;
6.       Create temporary tablespace make as default.




0 $type={blogger}:

Post a Comment