Saturday 12 July 2014

Moving an Oracle 11.2.0.4.0 Enterprise Edition Standalone Database from a Red Hat Enterprise Linux 6.0 Node to an Oracle Solaris 11.1 Node Using an Oracle RMAN Full Database Backup

Scene: There is a requirement to move an existing Oracle Enterprise Edition database from a server running Red Hat Enterprise Linux 6.0 to a server running Oracle Solaris 11.1 because of the myriad benefits that Oracle Solaris 11.1 offers over Red Hat Enteprise Linux 6.0.

Solution: One can accomplish the above by using RMAN - Oracle's proprietary backup and recovery manager, which provides database backup, restore, and recovery capabilities addressing high availability and disaster recovery concerns.

In my tutorial below, I will demonstrate to you how to use Oracle RMAN to move an enterprise edition database from one node to another by using the backup, restore and recovery capabilities provided by this fantastic software.

Time Duration: 4-5 hours

Kindly note that the below technique will require a downtime in a production environment unless there is a High Availability Disaster Recovery (HADR) solution such as Oracle Data Guard in place.

Prerequisites:
1. The version of the Oracle software must match on both the nodes; there is a way to remediate a version mismatch by running a catalog upgrade, but it is a very complicated process and so should be avoided.
2. Space requirements must be analyzed on the new node and an appropriate amount of space must be added to the filesystems; the filesystem specification may, or may not, be the same on both the nodes, but the space must be adequate enough to store the database.
3. A new listener will have to be created on the new node for the database after it has been moved, unless there is an existing listener on the new node that the database can register itself with. I am assuming that there is a listener already present on the new node in my example, so I will not be creating a new one.
4. New TNS entries will have to be created on the new node, so that users/applications can connect to the database after the restoration and recovery process has been performed on the new node. I have not shown this explicitly in my post below, and I presume that you will google about it.


Implementation Process:

1. Take an Oracle RMAN full backup, which may be either a hot backup, or a cold one depending upon whether the database is in ARCHIVELOG, or in NOARCHIVELOG mode, respectively -

a. If the database is in ARCHIVELOG mode, then taking a hot backup is the easiest strategy, since the database will not have to be shut down for the backup.
b. If the database is in NOARCHIVELOG mode, then the database will have to be restarted either in NOMOUNT state (when using a recovery catalog), or in MOUNT state (when using the control file), for the cold backup.

In my example below, the database is in ARCHIVELOG mode, so I will be taking a hot backup of it instead of a cold one.

A full database backup consists of the following -
a. Data Files
b. Control Files
c. Parameter File (spfile/pfile)
d. Archive log files

Prepare a shell script to initiate the backup ... you may use my script in case if you do not have one ready -

[oracle@linux scripts]$ cat rman_full_backup_disk.sh
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=tgprod
BACKUP_DIR=/u06/backups/
DATE=`date +%d%b%y`
TAG="$ORACLE_SID"_full_"$DATE"
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/oracle/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin
export ORACLE_HOME ORACLE_SID BACKUP_DIR DATE PATH;

rman target / << EOF > $BACKUP_DIR/rman_full_backup_disk_"$ORACLE_SID"_`date +%d-%b-%y`.log
run
{
configure device type disk parallelism 4;
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset database tag $TAG format "$BACKUP_DIR/dbf_tgprod_%U" filesperset 10;
sql 'alter system archive log current';
backup as compressed backupset archivelog all tag $TAG format "$BACKUP_DIR/arc_tgprod_%U" filesperset 10 skip inaccessible;
backup current controlfile tag $TAG format "$BACKUP_DIR/ctl_tgprod_%U";
backup spfile tag $TAG format "$BACKUP_DIR/ora_tgprod_%U";
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
exit
EOF


Provide execute permissions to the above script, as follows -

 [oracle@linux scripts]$ chmod 750 rman_full_backup_disk.sh

Execute the above script, as follows -

 [oracle@linux scripts]$ nohup sh rman_full_backup_disk.sh &

Check the output of the log file to ensure that the backup completes successfully, as follows -

[oracle@linux scripts]$tail -f $BACKUP_DIR/rman_full_backup_disk_$DATE.log


The log file will display the following output on the screen once the script completes execution -

Recovery Manager complete.


2. Now, it's time to proceed to the next step, which is to transfer the backup pieces and log file from the source node to the target (new) node; in this case, the source node is the server running on Red Hat Enterprise Linux 6.0, and the target (new) node is the server running on Oracle Solaris 11.1.

However, before we transfer the backup pieces and log file, we should create a tar ball and compress it in order to save effort and time because there may be many backup pieces and they may be big in size -

[oracle@linux scripts]$cd $BACKUP_DIR
[oracle@linux scripts]$tar -cvf rman_full_backup_disk_tgprod_$DATE.tar *
[oracle@linux scripts]$gzip rman_full_backup_disk_tgprod_$DATE.tar

Finally, it is time to transfer the compressed backup tar ball to the target node, as follows -

[oracle@linux scripts]$nohup scp rman_full_backup_disk_tgprod_$DATE.tar.gz oracle@targetnode:targetpath
Enter Password:

Press Ctrl+z

[oracle@linux scripts]$bg

[oracle@linux scripts]$jobs -l

The job will be running in the background once you fire the above commands, and it will take some time to complete, so in the meanwhile, you can find out the file# of the data files in the backup, as the file# will be required while restoring the database using the SET NEWNAME command.

To find the file# of the data files in the backup, kindly fire the following command:

[oracle@linux scripts]$ cat $BACKUP_DIR/rman_full_backup_tgprod_$DATE.log | grep number
input datafile file number=00004 name=/u02/oradata/TGPROD/datafile/o1_mf_users_8zx1t6yq_.dbf
input datafile file number=00001 name=/u02/oradata/TGPROD/datafile/o1_mf_system_8zx1t6t0_.dbf
input datafile file number=00002 name=/u02/oradata/TGPROD/datafile/o1_mf_sysaux_8zx1t6xn_.dbf
input datafile file number=00003 name=/u02/oradata/TGPROD/datafile/o1_mf_undotbs1_8zx1t6xy_.dbf


By looking at the above output, one can ascertain that a file# of 1 corresponds to the data file of the system tablespace, a file# of 2 corresponds to the data file of the sysaux tablespace, a file# of 3 corresponds to the data file of the undo tablespace, and a file# of 4 corresponds to the data file of the users tablespace.

These file#s will be useful while performing a restore and recovery of the database on the new node.

Decompress and untar the backup tar ball on the target node by using the gunzip and tar -xvf commands, as follows -

[oracle@s11-virtualmachine]$gunzip rman_full_backup_tgprod_$DATE.tar.gz

[oracle@s11-virtualmachine]$tar -xvf rman_full_backup_tgprod_$DATE.tar

3. Once you have performed the above steps, you can now proceed with the database restoration and recovery process, as follows -

Set the ORACLE_HOME and ORACLE_SID environment variables on the new node.

[oracle@s11-virtualmachine]$export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2

[oracle@s11-virtualmachine]$export ORACLE_SID=tgprod

Kindly note that the value of the ORACLE_SID variable must be identical to the name of the instance of the database that is being moved.

Start RMAN once you set the above environment variables, and fire the 'startup nomount' command on the RMAN prompt, as given below -

[oracle@s11-virtualmachine]$rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jun 8 22:19:23 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN>startup nomount;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_2/dbs/inittgprod.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     158662656 bytes

Fixed Size                     2209120 bytes
Variable Size                 92277408 bytes
Database Buffers              58720256 bytes
Redo Buffers                   5455872 bytes

Restore the spfile from the correct backup piece, as given below -

RMAN> restore spfile from '/u03/fast_recovery_area/backups/ora_tgprod_52pa9e0e_1_1';

Starting restore at 08-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=98 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u03/fast_recovery_area/backups/ora_tgprod_52pa9e0e_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 08-JUN-14

RMAN> exit

Recovery Manager complete.

Create the appropriate directory structures to restore the control file from the backup pieces -

[oracle@s11-virtualmachine]$mkdir -p /u02/oradata/TGPROD/controlfile
[oracle@s11-virtualmachine]$mkdir -p /u03/fast_recovery_area/TGPROD/controlfile

Connect to rman again, and restore the control file(s) from the backup piece(s), as given below -

[oracle@s11-virtualmachine]$rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jun 8 22:27:03 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DUMMY (not mounted)

RMAN> restore controlfile to '/u02/oradata/TGPROD/controlfile/control01.ctl' from '/u03/fast_recovery_area/backups/ctl_tgprod_51pa9e0c_1_1';

Starting restore at 08-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=98 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-JUN-14

RMAN> restore controlfile to '/u03/fast_recovery_area/TGPROD/controlfile/control02.ctl' from '/u03/fast_recovery_area/backups/ctl_tgprod_51pa9e0c_1_1';

Starting restore at 08-JUN-14
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-JUN-14

RMAN> exit

Recovery Manager complete.

Connect to sqlplus as SYSDBA and create a pfile from the spfile, and rectify various parameters of the new instance in that pfile, as given below -

[oracle@s11-virtualmachine]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 8 22:35:14 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create pfile from spfile;

File created.

SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> exit
'Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 [oracle@s11-virtualmachine]$

[oracle@s11-virtualmachine]$vi $ORACLE_HOME/dbs/inittgprod.ora

*.audit_file_dest='/u01/app/oracle/admin/tgprod/adump'

*.control_files='/u02/oradata/TGPROD/controlfile/control01.ctl','/u03/fast_recovery_area/TGPROD/controlfile/control02.ctl'

*.db_create_online_log_dest_1='/u02/oradata'

*.db_create_online_log_dest_2='/u03/fast_recovery_area'

*.db_recovery_file_dest='/u03/fast_recovery_area'

Edit the above parameters and update them to their new values, saving the changes made to the file.

Create a new directory structure for the audit files of the database -

[oracle@s11-virtualmachine]$mkdir -p /u01/app/oracle/admin/tgprod/adump

Reconnect to RMAN and mount the instance with the newly created (and edited!) pfile -

[oracle@s11-virtualmachine]$rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jun 8 22:50:18 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> startup mount pfile='$ORACLE_HOME/dbs/inittgprod.ora'

Oracle instance started
database mounted

Total System Global Area     847630336 bytes

Fixed Size                     2215744 bytes
Variable Size                335544512 bytes
Database Buffers             503316480 bytes
Redo Buffers                   6553600 bytes

Register the backup pieces of the target database with the restored control files -

RMAN> catalog start with '/u03/fast_recovery_area/backups';

Starting implicit crosscheck backup at 08-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=10 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=134 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=11 device type=DISK
Crosschecked 24 objects
Finished implicit crosscheck backup at 08-JUN-14

Starting implicit crosscheck copy at 08-JUN-14
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
Crosschecked 2 objects
Finished implicit crosscheck copy at 08-JUN-14

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /u03/fast_recovery_area/backups

List of Files Unknown to the Database
=====================================
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4ppa9dsl_1_1
File Name: /u03/fast_recovery_area/backups/ora_tgprod_52pa9e0e_1_1
File Name: /u03/fast_recovery_area/backups/rman_full_backup_tgprod_07-Jun-14.log
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4cpa9dni_1_1
File Name: /u03/fast_recovery_area/backups/ctl_tgprod_51pa9e0c_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_50pa9dvi_1_1
File Name: /u03/fast_recovery_area/backups/rman_full_backup_tgprod_07-Jun-14.tar
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4gpa9dom_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4upa9dvh_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4npa9dsj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4jpa9drp_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4qpa9du2_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4hpa9dop_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4mpa9dsj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4ipa9drp_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4lpa9drq_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4tpa9du4_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4spa9du3_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4vpa9dvi_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4fpa9dnj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4rpa9du3_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4epa9dnj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4kpa9drq_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4opa9dsk_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4dpa9dnj_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4ppa9dsl_1_1
File Name: /u03/fast_recovery_area/backups/ora_tgprod_52pa9e0e_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4cpa9dni_1_1
File Name: /u03/fast_recovery_area/backups/ctl_tgprod_51pa9e0c_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_50pa9dvi_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4gpa9dom_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4upa9dvh_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4npa9dsj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4jpa9drp_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4qpa9du2_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4hpa9dop_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4mpa9dsj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4ipa9drp_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4lpa9drq_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4tpa9du4_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4spa9du3_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4vpa9dvi_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4fpa9dnj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4rpa9du3_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4epa9dnj_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4kpa9drq_1_1
File Name: /u03/fast_recovery_area/backups/arc_tgprod_4opa9dsk_1_1
File Name: /u03/fast_recovery_area/backups/dbf_tgprod_4dpa9dnj_1_1

List of Files Which Where Not Cataloged
=======================================
File Name: /u03/fast_recovery_area/backups/rman_full_backup_tgprod_07-Jun-14.log
  RMAN-07517: Reason: The file header is corrupted
File Name: /u03/fast_recovery_area/backups/rman_full_backup_tgprod_07-Jun-14.tar
  RMAN-07517: Reason: The file header is corrupted
RMAN> exit

Recovery Manager complete.
[oracle@s11-virtualmachine]$

Create appropriate directory structures for restoring the datafiles of the target database -

[oracle@s11-virtualmachine]$mkdir -p /u02/oradata/TGPROD/datafile

[oracle@s11-virtualmachine]$mkdir -p /u03/fast_recovery_area/TGPROD/datafile

Restore and recover the database by running the below RUN block, but ensure that you provide the correct file#s and target data file paths in the SET NEWNAME command while performing this operation -

[oracle@s11-virtualmachine]$rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Jun 8 23:02:10 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TGPROD (DBID=4287626465, not open)

RMAN>run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;

set newname for datafile 1 to '/u02/oradata/TGPROD/datafile/o1_mf_system_8zx1t6t0_.dbf';
set newname for datafile 2 to '/u02/oradata/TGPROD/datafile/o1_mf_sysaux_8zx1t6xn_.dbf';
set newname for datafile 3 to '/u02/oradata/TGPROD/datafile/o1_mf_undotbs1_8zx1t6xy_.dbf';
set newname for datafile 4 to '/u02/oradata/TGPROD/datafile/o1_mf_users_8zx1t6yq_.dbf';

restore database;
switch datafile all;
recover database;

release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

Kindly note that the 'switch datafile all' command updates the existing (old) data file information in the restored control files with the new information (new data file names and locations).

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=134 device type=DISK

allocated channel: c2
channel c2: SID=10 device type=DISK

allocated channel: c3
channel c3: SID=125 device type=DISK

allocated channel: c4
channel c4: SID=9 device type=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 08-JUN-14

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00004 to /u02/oradata/TGPROD/datafile/o1_mf_users_8zx1t6yq_.dbf
channel c1: reading from backup piece /u03/fast_recovery_area/backups/dbf_tgprod_4cpa9dni_1_1
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00002 to /u02/oradata/TGPROD/datafile/o1_mf_sysaux_8zx1t6xn_.dbf
channel c2: reading from backup piece /u03/fast_recovery_area/backups/dbf_tgprod_4epa9dnj_1_1
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00003 to /u02/oradata/TGPROD/datafile/o1_mf_undotbs1_8zx1t6xy_.dbf
channel c3: reading from backup piece /u03/fast_recovery_area/backups/dbf_tgprod_4fpa9dnj_1_1
channel c4: starting datafile backup set restore
channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00001 to /u02/oradata/TGPROD/datafile/o1_mf_system_8zx1t6t0_.dbf
channel c4: reading from backup piece /u03/fast_recovery_area/backups/dbf_tgprod_4dpa9dnj_1_1
channel c3: piece handle=/u03/fast_recovery_area/backups/dbf_tgprod_4fpa9dnj_1_1 tag=TGPROD_FULL_07JUN14
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:01:10
channel c2: piece handle=/u03/fast_recovery_area/backups/dbf_tgprod_4epa9dnj_1_1 tag=TGPROD_FULL_07JUN14
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:01:34
channel c4: piece handle=/u03/fast_recovery_area/backups/dbf_tgprod_4dpa9dnj_1_1 tag=TGPROD_FULL_07JUN14
channel c4: restored backup piece 1
channel c4: restore complete, elapsed time: 00:02:04
channel c1: piece handle=/u03/fast_recovery_area/backups/dbf_tgprod_4cpa9dni_1_1 tag=TGPROD_FULL_07JUN14
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:03:57
Finished restore at 08-JUN-14

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=849741203 file name=/u02/oradata/TGPROD/datafile/o1_mf_system_8zx1t6t0_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=849741203 file name=/u02/oradata/TGPROD/datafile/o1_mf_sysaux_8zx1t6xn_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=849741203 file name=/u02/oradata/TGPROD/datafile/o1_mf_undotbs1_8zx1t6xy_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=849741203 file name=/u02/oradata/TGPROD/datafile/o1_mf_users_8zx1t6yq_.dbf

Starting recover at 08-JUN-14

starting media recovery

channel c1: starting archived log restore to default destination
channel c1: restoring archived log
archived log thread=1 sequence=162
channel c1: restoring archived log
archived log thread=1 sequence=163
channel c1: reading from backup piece /u03/fast_recovery_area/backups/arc_tgprod_50pa9dvi_1_1
channel c1: piece handle=/u03/fast_recovery_area/backups/arc_tgprod_50pa9dvi_1_1 tag=TGPROD_FULL_07JUN14
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:01
archived log file name=/u03/fast_recovery_area/TGPROD/archivelog/2014_06_08/o1_mf_1_162_9s985zhy_.arc thread=1 sequence=162
channel default: deleting archived log(s)
archived log file name=/u03/fast_recovery_area/TGPROD/archivelog/2014_06_08/o1_mf_1_162_9s985zhy_.arc RECID=194 STAMP=849741207
archived log file name=/u03/fast_recovery_area/TGPROD/archivelog/2014_06_08/o1_mf_1_163_9s985zs7_.arc thread=1 sequence=163
channel default: deleting archived log(s)
archived log file name=/u03/fast_recovery_area/TGPROD/archivelog/2014_06_08/o1_mf_1_163_9s985zs7_.arc RECID=195 STAMP=849741207
released channel: c1
released channel: c2
released channel: c3
released channel: c4

Media Recovery Complete.

Kindly open the database with the RESETLOGS option once the media recovery completes, as given below -

RMAN> alter database open resetlogs;

database opened

RMAN> exit

Recovery Manager complete.
[oracle@s11-virtualmachine]$

Connect to sqlplus as SYSDBA and check whether the database is up and running fine and whether the data files, temp files, control files and online redo log files are present in the correct locations -

[oracle@s11-virtualmachine]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 8 23:30:31 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
TGPROD    READ WRITE

SQL> set lines 150
SQL> set pages 1000
SQL> col name for a70
SQL> select name from v$datafile
union all
select name from v$tempfile
union all
select name from v$controlfile
union all
select member from v$logfile;

NAME
----------------------------------------------------------------------
/u02/oradata/TGPROD/datafile/system01.dbf
/u02/oradata/TGPROD/datafile/sysaux01.dbf
/u02/oradata/TGPROD/datafile/undotbs101.dbf
/u02/oradata/TGPROD/datafile/users01.dbf
/u02/oradata/TGPROD/datafile/o1_mf_temp_9s98gdbq_.tmp
/u02/oradata/TGPROD/controlfile/control01.ctl
/u03/fast_recovery_area/TGPROD/controlfile/control02.ctl
/u02/oradata/TGPROD/onlinelog/o1_mf_3_9s98g0c7_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_3_9s98g32g_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_2_9s98fy5w_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_2_9s98fz3n_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_1_9s98ftrp_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_1_9s98fvxw_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_4_9s98j5rf_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_4_9s98j999_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_5_9s98jg7h_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_5_9s98jhww_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_6_9s98jm1f_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_6_9s98jnyz_.log
/u02/oradata/TGPROD/onlinelog/o1_mf_7_9s98jr3y_.log
/u03/fast_recovery_area/TGPROD/onlinelog/o1_mf_7_9s98jtco_.log

21 rows selected.

Create a new spfile for the database and bounce the database (I have not shown the bounce being taken below...) -

SQL>create spfile from pfile;

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@s11-virtualmachine]$

4. Finally, drop the database on the source node by restarting it in mount exclusive restrict mode, as follows -

[oracle@linux ~]$sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 8 23:40:46 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup force mount exclusive restrict;
ORACLE instance started.

Total System Global Area  847630336 bytes
Fixed Size                  2218072 bytes
Variable Size             377489320 bytes
Database Buffers          461373440 bytes
Redo Buffers                6549504 bytes
Database mounted.
SQL> drop database;

Database dropped.

SQL>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@linux ~]$

Presuming that you will register the newly restored database with a listener and update the tnsnames.ora file with new entries for the application, I conclude that the movement of the database from the Redhat Linux node to the Oracle Solaris node has been finally completed successfully!

Hope you had a good time reading the article! :)
 

2 comments:

  1. 1. The downtime is while the Restoration time, just when the backup finish in the source?
    2. your note mention Solaris, but is Solaris on sparc with big endian format? and the linux is in little endian format?
    PLATFORM ENDIAN_FORMAT

    13 Linux x86 64-bit Little ==> Source (origin)

    2 Solaris[tm] OE (64-bit) Big ==> Target (destination)

    ReplyDelete
  2. My last one updated, are my questions after to read your article.

    I will be grateful for four help.

    ReplyDelete