Clone Steps Rman

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 10

cold

hot
rman duplicate - PROD (online) - DEV/TEST
Active Duplicate - no backups - there will be load on PROD
Standby database - clone - rman duplicate - no load at all on production

rman backup - rsync - copy the backup to dev machines -

RapidClone
----------

RMAN Cloning
-----------

DEV -> TEST

> start - once the backup is completed - comment out the backup
> don't add datafiles when the cloning/restore are going

DEV > UAT

UAT > TEST

Make the below changes in spfile or init.file

log_archive_dest_1 = 'LOCATION=/d01/oracle/DEV/archive'
log_archive_format = archDEV%t_%s_%r.dbf

convert from noarchivelog to archivelog

shutdown immediate
startup mount
alter database archivelog;
alter database open;

archive log list

alter system switch logfile;

-- take the backup (copy backfiles from source to target)

rman target /

-- RMAN backup

run {
allocate channel d1 type disk maxpiecesize 2047M;
allocate channel d2 type disk maxpiecesize 2047M;
allocate channel d3 type disk maxpiecesize 2047M;
backup format '/d01/oracle/backup/df_t%t_s%s_p%p' database;
sql 'alter system archive log current';
backup format '/d01/oracle/backup/al_t%t_s%s_p%p' archivelog all;
backup format '/d01/oracle/backup/control%U' current controlfile;
delete noprompt archivelog all backed up 2 times to device type disk;
release channel d1;
}

PROD
----

Stage2: Prepare the Source System (PRODSERVER)

Prepare the source system (System can be up)


-- on the dbtier
cd /d02/oracle/QA/12.1.0/appsutil/scripts/UAT_linux4/
perl adpreclone.pl dbTier
-- on the application tier
. ./APPSUAT_linux4.env
cd $ADMIN_SCRIPTS_HOME
perl adpreclone.pl appsTier

-- copy the ORACLE_HOME/RMAN Backups from PROD - clone instance

On the cloned machine - Target Instance

a>Configure the <RDBMS ORACLE_HOME>

cd /d02/oracle/QA/12.1.0/appsutil/clone/bin/
-- create xml,init.ora,tnsnames

perl adcfgclone.pl dbTechStack

UAT -> TEST

initRMANN.ora, tnsnames.ora,listener.ora, xml - touch the database

db folder
database files

update initTEST.ora file

db_file_name_convert=("/d01/oracle/PROD/data","/d01/oracle/UAT/data")
log_file_name_convert=("/d01/oracle/PROD/data","/d01/oracle/UAT/data")

-- Clone without conneting to PROD

-- Suppose you want to move tablespace to different location

set newname for tablespace APPS_TS_TX_DATA to


'/d02/oracle/TEST/db/apps_st/data/datafile/%b';

cat > duplicate.rcv


run
{
allocate auxiliary channel C1 device type disk;
allocate auxiliary channel C2 device type disk;
allocate auxiliary channel C3 device type disk;
allocate auxiliary channel C4 device type disk;
SET NEWNAME FOR DATABASE TO '/d01/oracle/UAT/data/%b';
DUPLICATE DATABASE TO "UAT" BACKUP LOCATION '/d01/oracle/PROD/rmanbackup'
NOFILENAMECHECK;
}

cat > run.sh

$ORACLE_HOME/bin/rman auxiliary / log=dup.log @duplicate.rcv

nohup sh run.sh &

tail -f dup.log

connect on db server
sqlplus apps/apps
EXEC FND_CONC_CLONE.SETUP_CLEAN;

run autoconfig

Application clone

/d01/oracle/PROD/fs1/EBSapps/comn/clone/bin

perl adcfgclone.pl appsTier dualfs

Copyright (c) 2002, 2015 Oracle Corporation


Redwood Shores, California, USA

Oracle E-Business Suite Rapid Clone

Version 12.2

adcfgclone Version 120.63.12020000.56

Enter the APPS password : production password

Enter the Weblogic AdminServer password : new password

Do you want to add a node (yes/no) [no] :

Running: Context clone...

Log file located at /d01/oracle/UAT/fs2/EBSapps/comn/clone/bin/CloneContext_0315


094935.log

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

Target System Hostname (virtual or normal) [erp] :


Target System Database SID : UAT

Target System Database Server Node [erp] :

Target System Database Domain Name [appsdba.info] :

Target System Base Directory : /d01/oracle/UAT

Target System Base Directory set to /d01/oracle/UAT

Target System Current File System Base set to /d01/oracle/UAT/fs2

Target System Other File System Base set to /d01/oracle/UAT/fs1

Target System Fusion Middleware Home set to /d01/oracle/UAT/fs2/FMW_Home


Target System Other File System Fusion Middleware Home set to /d01/oracle/UAT/fs
1/FMW_Home

Target System Web Oracle Home set to /d01/oracle/UAT/fs2/FMW_Home/webtier


Target System Other File System Web Oracle Home set to /d01/oracle/UAT/fs1/FMW_H
ome/webtier

Target System Appl TOP set to /d01/oracle/UAT/fs2/EBSapps/appl


Target System Other File System Appl TOP set to /d01/oracle/UAT/fs1/EBSapps/appl

Target System COMMON TOP set to /d01/oracle/UAT/fs2/EBSapps/comn


Target System Other File System COMMON TOP set to /d01/oracle/UAT/fs1/EBSapps/co
mn

Target System Instance Home Directory [/d01/oracle/UAT] :

Target System Current File System Instance Top set to /d01/oracle/UAT/fs2/inst/a


pps/UAT_erp

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

Target System Display [erp:0.0] :

Target System Root Service [enabled] :

Target System Web Entry Point Services [enabled] :

Target System Web Application Services [enabled] :

Target System Batch Processing Services [enabled] :

Target System Other Services [disabled] :

Target System Port Pool [0-99] : 20

Checking the port pool 20


done: Port Pool 20 is free
Report file located at /d01/oracle/UAT/fs2/inst/apps/UAT_erp/admin/out/portpool.
lst

UTL_FILE_DIR on database tier consists of the following directories.

1. /usr/tmp
2. /usr/tmp/UAT
3. /d01/oracle/UAT/12.1.0/appsutil/outbound/UAT_erp
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 2
The new APPL_TOP context file has been created :
/d01/oracle/UAT/fs2/inst/apps/UAT_erp/appl/admin/UAT_erp.xml
Check Clone Context logfile
/d01/oracle/UAT/fs2/EBSapps/comn/clone/bin/CloneContext_0315094935.log for details.

Creating Patch file system context file.....

Log file located at


/d01/oracle/UAT/fs2/EBSapps/comn/clone/bin/CloneContextPatch_0315095128.log

Target System Other File System Instance Top set to


/d01/oracle/UAT/fs1/inst/apps/UAT_erp

Target System Port Pool [0-99] : 21

Checking the port pool 21


done: Port Pool 21 is free
Report file located at /d01/oracle/UAT/fs1/inst/apps/UAT_erp/admin/out/portpool.lst
The new APPL_TOP context file has been created :
/d01/oracle/UAT/fs1/inst/apps/UAT_erp/appl/admin/UAT_erp.xml
Check Clone Context logfile
/d01/oracle/UAT/fs2/EBSapps/comn/clone/bin/CloneContextPatch_0315095128.log for
details.

FMW Pre-requisite check log file location :


/d01/oracle/UAT/fs2/EBSapps/comn/clone/FMW/logs/prereqcheck.log
Running: FMW pre-req check...

Configuring: Run file system....


LogFile located at
/d01/oracle/UAT/fs2/inst/apps/UAT_erp/admin/log/clone/run/RCloneApplyAppstier_03150
952.log

Configuring: Patch file system....


LogFile located at
/d01/oracle/UAT/fs2/inst/apps/UAT_erp/admin/log/clone/patch/RCloneApplyAppstier_031
51015.log

Do you want to startup the Application Services for UAT? (y/n) [n] : n

Web browser -

Finishing Tasks

varies from client to client -


5 minutes

Site%Name - profile - "TEST - Clone of PROD as 04-jun-2014"


Custom_top changes
PRoduction password - FNDCPASS (autoconfig on dbTier and appsTier) -
apps/apps - sysadmin/sysadmin

4 hours - Post clone steps - workflow, payment configuration , customization

-- Keeping all the pending (normal/standby/scheduled) requests are on hold

UPDATE apps.fnd_concurrent_requests SET hold_flag = 'Y' WHERE phase_code = 'P' AND


status_code in ('I','Q','F');
commit;

update applsys.fnd_profile_option_values
set profile_option_value=(select 'TEST Instance. Copy of PROD as of '||
to_char(max(actual_completion_date),'MM/DD/YYYY HH24:MI')
from applsys.fnd_concurrent_requests) where level_id=10001 and
(application_id,profile_option_id) in (select
fpo.application_id,fpo.profile_option_id from applsys.fnd_profile_options
fpo,applsys.fnd_profile_options_tl fpt where
fpo.profile_option_name=fpt.profile_option_name and
fpt.user_profile_option_name='Site Name');
commit;

------------------------------- IGNORE THE BELOW -------------------------------

On prod -

select member from v$logfile


union
select name from v$controlfile
union
select name from v$datafile
union
select name from v$tempfile;

create password file - on prod server

orapwd file=orapwTEST password=oracle entries=5 - PROD


remote_login_passwordfile=EXCLUSIVE

On cloned instance- RMANC

-- make an entry in tnsnames.ora

PROD=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=linux4.oracle.com)(PORT=1561))
(CONNECT_DATA=
(SERVICE_NAME=PROD)
(INSTANCE_NAME=PROD)
)
)

-- check connection from target machine

sqlplus sys/oracle@PROD as sysdba

-- make an entry for ifile in initDEV.ora

cat RMANC_linux4_ifile.ora

db_file_name_convert=("/d02/oracle/UAT/data","/d02/oracle/TEST/data")
log_file_name_convert=("/d02/oracle/UAT/data","/d02/oracle/TEST/data")

-- Use seperate users.

oraprod
oradev

startup nomount

cat > dup.rman


run {
allocate auxiliary channel C1 device type disk;
allocate auxiliary channel C2 device type disk;
allocate auxiliary channel C3 device type disk;
allocate auxiliary channel C4 device type disk;
duplicate target database to "UAT";
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}

-- Backup

cat > run.sh

$ORACLE_HOME/bin/rman target sys/oracle@prod auxiliary / log=/home/orauat/dup.log


@dup.rman

-----------------------------------------------------------------------------------
---------

-----------------------------------------------------------------------------------
--------

---- let me try - without backup's


$ORACLE_HOME/bin/rman target sys/oracle@PROD auxiliary /
log=/home/oravis/dup_20oct.log @dup.rman
-----

sh run.sh

-- instance - mount

cd $ORACLE_HOME/appsutil/install/PATCH_testdb
sqlplus "/as sysdba" @adupdlib.sql so
sh adautoconfig

dbconfig - existing xml

--------------------------------

When recovery happens

show parameter db_name

PROD

alter database backup controlfile to trace;

startup nomount

show parameter db_name

TEST

recover database using backup controlfile until cancel;

-------------------------------

-- In case recovery failed

recover database using backup controlfile until cancel;


25618
25619
25620
CANCEL

Media Recovery - Success

alter database open resetlogs;

25618

On the cloned instance

$ORACLE_HOME/bin/rman target sys/oracle@PROD

RAC - NON-RAC
run {

allocate channel t1 type disk;


# Set the destination if you want it to be recovered into
# different location. By default it would be restored to
# the default location
set archivelog destination to '/tmp';
restore archivelog from logseq 17179 until logseq 17200;
release channel t1;
}

sqlplus "/as sysdba"

recover database using backup controlfile until cancel;


/tmp/25618
/tmp/25619
/tmp/25620
CANCEL

-- PROD backups for clone

autoconfig - succesfull

apps

issue 2

SQL> alter database open resetlogs;


alter database open resetlogs
*
ERROR at line 1:
ORA-19838: Cannot use this control file to open database

SQL> alter database backup controlfile to trace;

Database altered.

SQL> show parameter db_name

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_name string PRD

CREATE CONTROLFILE SET DATABASE "TST" RESETLOGS NOARCHIVELOG


MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 512
MAXINSTANCES 1
MAXLOGHISTORY 876

SQL> startup nomount


ORACLE instance started.

Total System Global Area 1071333376 bytes


Fixed Size 1349732 bytes
Variable Size 557844380 bytes
Database Buffers 499122176 bytes
Redo Buffers 13017088 bytes
SQL> show parameter db_name

NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
db_name string
R12TST

SQL> @control

Control file created.

SQL> alter database open resetlogs;

Database altered.

SQL> show parameter db_name

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_name string R12TST

You might also like