How To restore RMAN backup from PROD to TEST database


How to restore RMAN backup from PROD to TEST database 10g,11gR2,12c:-


In this post we will discussed how to restore oracle database using rman.


The situation here is we have taken an RMAN backup on PROD (Source) and we need to restore those backup pieces on different server as TEST (target) database.
Its actually cloning the database from PROD(SOURCE) to TEST(target) using RMAN backup pieces taken on source.

Please follow the following steps outlined below.

Please note source (PROD) is where the backup pieces are available. Copy all the backup piecies (datafile,controlfile and spfile) of source(PROD) database to target(TEST) server using scp.
Once copy completes, Run the following script to list the backup pieces available: Register all the copied backup pieces in the controlfile. (/backup01  is the location of copied backup pieces in the target)
In order to let RMAN know about the backup in '/backup01/rman_backup' backup we use the CATALOG command.

Start the database in nomount as below.

$rman target  /
RMAN>startup nomount;

RMAN> catalog start with '/backup01/rman_backup';
Or

RMAN> catalog backuppiece ‘/backup01/rman_backup/ora_df_020412_21_14_NSNDB_1635_1';

If SPFILE is stored in the control file autobackup. All of the RMAN configuration parameters values are at their defaults so we will need to set the location for the control file autobackup.

On Production server(PROD).

RMAN> show controlfile autobackup format;

Below we will set the location for the control file autobackup and restore the SPFILE to a PFILE and then we shutdown the database.


RMAN> set controlfile autobackup format for device type disk to '/backup01/oracle/oradata/orcl/backup/%F';

Retore spfile to pfile on TEST server.

RMAN> restore spfile to pfile '/backup01/TEST/initorcl.ora' from autobackup;

RMAN> shutdown immediate;

Now that we have the PFILE we need to edit the parameter to reflect the new host’s file system were appropriate.

After making the necessary changes to the PFILE we now will bring the database back up in NOMOUNT mode so we can restore the control files. When bringing the database up in NOMOUNT mode we will use the PFILE we edited earlier.


RMAN> startup nomount pfile='/backup01/TEST/initorcl.ora';

--- Just like the SPFILE we will use the autobackup to restore the control file after setting the control file autobackup format. After restoring the control files we mount the database.

RMAN> set controlfile autobackup format for device type disk to '/u01/app/oracle/oradata’;

RMAN> restore controlfile from autobackup;

Or

We can also restore the controlfile as below.

RMAN>restore controlfile from '/u01/backup/ccf_c-1250176543-20081031-01';

RMAN> alter database mount;

After restoration on pfile, controlfiles we need to restore the database as below.

RMAN> {RUN

SET NEWNAME FOR DATAFILE '/data02/PROD/sysdbfiles/system01PROD.dbf'   TO ‘/backup /TEST/ system01PROD.dbf ‘;

SET NEWNAME FOR DATAFILE 2 TO ‘/backup /TEST/ undo_APPS_UNDOTS5.dbf’;
SET NEWNAME FOR DATAFILE 3 TO ‘/backup /TEST/ prod_data01PROD.dbf’;
SET NEWNAME FOR DATAFILE 4 TO ‘/backup /TEST/ prod_data02PROD.dbf’;
SET NEWNAME FOR DATAFILE 5 TO ‘/backup /TEST/ prod_data03PROD.dbf’;
SET NEWNAME FOR DATAFILE 6 TO ‘/backup /TEST/ prod_data04PROD.dbf’;
SET NEWNAME FOR DATAFILE 7 TO ‘/backup /TEST/ prod_data05PROD.dbf’;
SET NEWNAME FOR DATAFILE 8 TO ‘/backup /TEST/ prod_data06PROD.dbf’;
SET NEWNAME FOR DATAFILE 9 TO ‘/backup /TEST/ prod_data07PROD.dbf’;
SET NEWNAME FOR DATAFILE 10 TO ‘/backup /TEST/ prod_data08PROD.dbf’;
SET NEWNAME FOR DATAFILE 11 TO ‘/backup /TEST/ prod_data09PROD.dbf’;
SET NEWNAME FOR DATAFILE 12 TO ‘/backup /TEST/ prod_data10PROD.dbf’;
SET NEWNAME FOR DATAFILE 13 TO ‘/backup /TEST/ prod_data11PROD.dbf’;
SET NEWNAME FOR DATAFILE 14 TO ‘/backup /TEST/ prod_data12PROD.dbf’;
SET NEWNAME FOR DATAFILE 15 TO ‘/backup /TEST/ prod_data13PROD.dbf’;
SET NEWNAME FOR DATAFILE 16 TO ‘/backup /TEST/ prod_data14PROD.dbf’;
SET NEWNAME FOR DATAFILE 17 TO ‘/backup /TEST/ prod_data15PROD.dbf’;
SET NEWNAME FOR DATAFILE 18 TO ‘/backup /TEST/ prod_data16PROD.dbf’;
SET NEWNAME FOR DATAFILE 19 TO ‘/backup /TEST/ prod_ndx01PROD.dbf

RESTORE DATABASE;
SWITCH DATAFILE ALL;
RECOVER DATABASE;
}

Now open the database as below.

RMAN>sql’ alter database open resetlogs’;

Now we need to check the redo log file location if it don’t match then we will rename it as below.

SQL> select member from v$logfile;

SQL> alter database rename file ‘/data03/TEST/logfiles/redo01PROD.log’ to ‘/data01/TEST/logfiles/redo01PROD.log’;

SQL> alter database rename file ‘/data03/TEST/logfiles/redo02PROD.log’ to ‘/data01/TEST/logfiles/redo01PROD.log’;

SQL> alter database rename file ‘/data03/TEST/logfiles/redo03PROD.log’ to ‘/data01/TEST/logfiles/redo01PROD.log’;

After that we have to add the temp file if TEMP tablespace is empty as below.

SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp00.dbf' size 500m;
SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp01.dbf' size 500m;
SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp02.dbf' size 500m;
SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp03.dbf' size 500m;
SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp04.dbf' size 500m;



If tempfile is available then we can reuse it as.

SQL> select file#,enabled,status from v$tempfile;
     FILE#                ENABLED             STATUS
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
                             READ WRITE       ONLINE
        10   READ WRITE       ONLINE
        11                   READ WRITE      ONLINE
        12   READ WRITE       ONLINE

 SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/data01/TEST/temp01.dbf' size 500m reuse;



For 12c: Multitenant -Backup and Recovery of Container Database (CDB) and Pluggable Database (PDB) you may check at  https://sajidoracledba.blogspot.com/2019/09/12c-multitenant-container-and-pluggable-RMAN-Backup.html  



Steps to recover Applications context file if it is corrupted or deleted

Here is 'steps to recover Applications context file if it is corrupted or deleted'.

If the Oracle Applications Context file is corrupted or deleted , then we need to follow the below steps to recover the Context file  as well.


To retrieve the Apps tier context file.


Run the adclonectx.pl as shown below.


perl /clone/bin/adclonectx.pl retrieve


On being prompted for the context file to be retrieved, select the option of retrieving the Applications tier context file that has been lost and retrieve it to the default location specified by the script.

The above command (adclonectx.pl can be used only when INST_TOP the is still intact. In case that has also been lost accidentally, the Applications tier context file may be retrieved as follows:

Execute the following command on the DB tier:


perl /appsutil/clone/bin/adclonectx.pl retrieve


On being prompted for the context file to be retrieved, select the option of retrieving the Applications tier context file that has been lost.


While confirming the location for the context file, set it to any existing directory with write permission.

Once the context file has been generated in the specified location, move it to the location specified for the context file in the context variable 's_contextfile'.

 To retrieve the DB tier context file:


Execute the following command on the DB tier:


perl /appsutil/clone/bin/adclonectx.pl retrieve


On being prompted for the context file to be retrieved, select the Database tier context file and retrieve it to the default location specified by the script.


How to configure Isupplier on External node in R12

How to configure Isupplier (DMZ) on External node in R12 :-

Steps to Add Node to a Shared Application Tier File System for Oracle E-Business Suite R12 Configuration in a DMZ:---



Here we will know 'how to configure dmz in oracle apps in r12'.


Internal Server:- 192.168.11.15

External Server:- 192.168.11.10

Here I am going to discuss about steps involved in Adding a node with Shared Application Tier File

System.

Mount Share Application Tier File System on External node.

Prerequisites:-

If you have not installed both nfs client and nfs server. first of all install them.

yum install nfs

service nfs status

Edit exports file on source server:-

Add Application Tier File system in /etc/exports as below.

/oracle/apps/ 192.168.11.10(rw,sync)

restart nfs service:-

service nfs restart

chkconfig nfs on

mkdir /oracle/apps


Edit /etc/fstab on destination Server(192.168.11.10):-

192.168.11.15:/oracle/apps /oracle/apps               nfs     rw,intr,bg,hard,timeo=600,wsize=32768,rsize=32768,nfsvers=3,tcp,nolock,acregmin=0,acregmax=0       0 0


check shared file system from destination server:-

showmount -e 192.168.11.15

Mount the shared filesystem(External node) that you are going to add and the following Shared Top's must be visible from all application nodes involved in configuration.

mount -a

or

mount -t nfs 192.168.11.15:/oracle/apps  /oracle/apps

check if /oracle/apps mounted at destination server

df -h

Steps to Add Node to a Shared Applicaton Tier File System

Adding a node to Shared Application Tier File System.


Step 1: Run rapid clone on the existing node(source node)

$ cd $INST_TOP/admin/scripts
$ perl adpreclone.pl appsTier


Shared Top's

COMMON_TOP: /u01/share/apps/apps_st/ramcomn
APPL_TOP: /u01/share/apps/apps_st/ramappl
Tools ORACLE_HOME: /u01/share/apps/tech_st/ramora/10.1.2
Web ORACLE_HOME: /u01/share/apps/tech_st/ramora/10.1.3

Step 2: Create new Context Files for the External node:

– On internal server

abctest --Internal Node
abcapps ---External Node

[appltest@abcapps scripts]$ perl $COMMON_TOP/clone/bin/adclonectx.pl contextfile=/appsebs/inst/apps/PROD_isupplier/appl/admin/Internal.xml

                     Copyright (c) 2002 Oracle Corporation
                        Redwood Shores, California, USA

                        Oracle Applications Rapid Clone

                                 Version 12.0.0

                      adclonectx Version 120.23.12010000.1

Running:
/data01/GSTUAT_8026/apps/apps_st/comn/clone/bin/../jre/bin/java -Xmx600M -classpath /acedata01/GSTUAT_8026/apps/apps_st/comn/clone/bin/../jlib/ojdbc14.jar:/acedata01/GSTUAT_8026/apps/apps_st/comn/clone/bin/../jlib/xmlparserv2.jar:/acedata01/GSTUAT_8026/apps/apps_st/comn/clone/bin/../jlib/java oracle.apps.ad.context.CloneContext  -e /data01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/appl/admin/UAT_aceapps.xml
Enter the APPS password : apps

Log file located at /data01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/admin/scripts/CloneContext_0804113428.log

Provide the values required for creation of the new APPL_TOP Context file.

Target System Hostname (virtual or normal) [abcapps] : abctest

Target System Database SID : UAT

Target System Database Server Node [abctest] :

Target System Database Domain Name [abc-test.com] :

Target System Base Directory : /data01/GSTUAT_8026

Target System Tools ORACLE_HOME Directory [/data01/GSTUAT_8026/apps/tech_st/10.1.2] :

Target System Web ORACLE_HOME Directory [/data01/GSTUAT_8026/apps/tech_st/10.1.3] :

Target System APPL_TOP Directory [/data01/GSTUAT_8026/apps/apps_st/appl] :

Target System COMMON_TOP Directory [/data01/GSTUAT_8026/apps/apps_st/comn] :

Target System Instance Home Directory [/data01/GSTUAT_8026/inst] : /data01/GSTUAT_8026/apps/inst

Username for the Applications File System Owner [appltest] :

Group for the Applications File System Owner [dba] :

Target System Root Service [enabled] :

Target System Web Entry Point Services [enabled] :

Target System Web Application Services [enabled] :

Target System Batch Processing Services [enabled] : disabled

Target System Other Services [disabled] :

Do you want to preserve the Display [abcapps:0.0] (y/n)  : n

Target System Display [abctest:0.0] :

Do you want the the target system to have the same port values as the source system (y/n) [y] ? : n

Target System Port Pool [0-99] : 26
Report file located at /data01/GSTUAT_8026/apps/inst/apps/UAT_abctest/temp/portpool.lst
Complete port information available at /data01/GSTUAT_8026/apps/inst/apps/UAT_abctest/temp/portpool.lst

UTL_FILE_DIR on database tier consists of the following directories.

1. /usr/tmp
2. /usr/tmp
3. /acedata03/UAT_8026/orahome/appsutil/outbound/UAT_abctest
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 1

New context path and file name [UAT_abctest.xml] :

Creating the new APPL_TOP Context file from :
  /data01/GSTUAT_8026/apps/apps_st/appl/ad/12.0.0/admin/template/custom/adxmlctx.tmp

The new APPL_TOP context file has been created :
  /data01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/admin/scripts/UAT_abctest.xml

Log file located at /data01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/admin/scripts/CloneContext_0804113428.log
contextfile=/acedata01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/admin/scripts/UAT_abctest.xml
Check Clone Context logfile /data01/GSTUAT_8026/apps/inst/apps/UAT_aceapps/admin/scripts/CloneContext_0804113428.log for details.


perl $AD_TOP/bin/adconfig.pl contextfile=/oracle/PROD/inst/apps/PROD_isupplier/External.xml


Step 3: Run the txkChangeProfH.sql under $FND_TOP/patch/115/sql using apps user.


SQL>@txkChangeProfH.sql SERVRESP


After new context file(external ) then run autoconfig on internal server and then run autoconfig on external server to add node in fnd_nodes table.
After that start the services.

Step 4: Set below profile as per configuration.

POS: External URL
POS: Internal URL


Query for %NODE%TRUST%. You will see a profile option named 'Node Trust Level'
Set the value of this profile option to External at the server level to external node only

Once set the profile option . Hope you will able to login in External URL accordingly...