Thursday, 19 April 2018

Clone Steps Rman

1.
Run adpreclone.pl in db Tier
No Need to down server:
cd $ORACLE_HOME/appsutil/scripts/$SID/

perl adpreclone.pl dbTier
take Oracle_Home as tar:
tar -cvf db.tar 11.1.0/
scp -r db.tar root@192.168.1.4:/u01/db/


2.
Run adpreclone.pl in apps Tier

cd /u01/applprod/apps/inst/apps/PROD_tos01/admin/scripts
or $ADMIN_SCRIPTS_HOME
No Need to down server:
perl adpreclone.pl appsTier

take only apps and comn tar , not required inst.
under apps - apps_st and Tech_st .

tar -cvf apps.tar apps/

scp -r apps.tar root@192.168.1.4:/u01/apps/


3.
Create apps and db user
useradd -g dba -G oinstall applprod
useradd -g dba -G oinstall oraprod
passwd applprod
passwd oraprod

4.Create Folder structure.

mkdir -p /u01/oraprod/db/tech_st/
chown -R oraprod:dba /u01/oraprod/db/tech_st/
chmod -R 775 /u01/oraprod/db/tech_st/

mkdir -p /u01/oraprod/db/apps_st/data
chown -R oraprod:dba /u01/oraprod/db/apps_st/data
chmod -R 775 /u01/oraprod/db/apps_st/data

mkdir -p rman archive
chown -R oraprod:dba rman archive
chmod -R 775 rman archive

5.
Extract db.tar to /u01/oraprod/db/tech_st/
mv db.tar /u01/oraprod/db/tech_st/
oraprod$ tar -xvf db.tar

6.send all rman file to server.
Extarct rman.tar to /u01/oraprod/rman
Extarct archive.tar to /u01/oraprod/archive

Note:How to replace string in vi Editor.

7.Extract apps.tar to respective directory.
mkdir -p /u01/applprod/
chown -R applprod:dba /u01/applprod/
chmod -R 775 /u01/applprod/

cd /u01/applprod/
apps$]tar -xvf apps.tar

#tar -xvf apps.tar
chown -R applprd:dba apps
chmod -R 775 apps



8.
Take Full Rman backup with archivelog.

rman target /

RMAN> RUN {
configure controlfile autobackup format for device type diks to '/u01/orauat/rman_backup/3feb2013_Bkp/%F';
configure controlfile autobackup on;
allocate channel d1 type disk;
backup tag FULL_DB database plus archivelog format '/u01/orauat/rman_backup/3feb2013_Bkp/db_%t_%s.bkp';
release channel d1;
}

take this backup and send to destination server:

cd /u01/orauat/
tar -cvf rman.tar rman/

scp -r rman.tar root@192.168.1.4:/u01/oraprod/rman/


9.Restore backup of database and application on Target Node:
RDBMS Oracle Home Configuration:

After extracting , RDBMS_Software , go to,
Oracle_Home/appsutil/clone/bin
perl adcfgclone.pl dbTechStack

Provide the values required for creation of the new Database Context file.
Target System Hostname (virtual or normal) [tos01] :
Target Instance is RAC (y/n) [n] : n
Target System Database SID : PROD (Source was UAT)
Target System Base Directory : /u01/oraprod/db/
Target System utl_file_dir Directory List : /usr/tmp
Number of DATA_TOP's on the Target System [1] :
Target System DATA_TOP Directory 1 [/u01/app/orauat/db/apps_st/data] : /u01/oraprod/db/apps_st/data
Target System RDBMS ORACLE_HOME Directory [/u01/oraprod/db/db/tech_st/11.1.0] : /u01/oraprod/db/tech_st/11.1.0
Do you want to preserve the Display [null] (y/n) ? : n
Target System Display [tos01: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] : 80


10.
Step 1> set in .bash_profile,
ORACLE_SID=UAT
export $ORACLE_SID
#Original Value is PROD, replaced for restore and recover of rman db


>• copy initPROD.ora to initUAT.ora
vi initUAT.ora
db_name = UAT(Changed from PROD to UAT)

control_files = /u01/oraprod/db/apps_st/data/cntrl01.dbf


Go to $ORACLE_HOME
Take env file name as PROD_tos01.env,put into .bash_profile.

11.start db,
> startup nomount pfile='/u01/oraprod/db/tech_st/11.1.0/dbs/initUAT.ora';
Total System Global Area 1068937216 bytes
Fixed Size 2166536 bytes
Variable Size 427819256 bytes
Database Buffers 624951296 bytes
Redo Buffers 14000128 bytes

>rman target / nocatalog
connected to target database: UAT (not mounted)
go to rman and check controlfile .

RMAN> restore controlfile from '/u01/oraprod/rman/rman/UAT_Control_File973790400_458_1';
RMAN> alter database mount;

cd /u01/oraprod/rman/rman


12.Catalog all rman and archiver files.
rman]$ rman target / nocatalog
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973788948_448_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973788948_449_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973788949_450_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973788949_451_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973790110_452_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_973790121_453_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_Arch_Log973790373_454_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_Arch_Log973790373_455_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_Arch_Log973790374_456_1';
catalog backuppiece '/u01/oraprod/rman/rman/UAT_Arch_Log973790374_457_1';

catalog backuppiece '/u01/oraprod/rman/rman/egt0njpq_1_1';
catalog backuppiece '/u01/oraprod/rman/rman/eht0njqu_1_1';

catalog backuppiece '/u01/oraprod/rman/rman/i8t0nm1k_1_1';
catalog backuppiece '/u01/oraprod/rman/rman/i9t0nm1r_1_1';


13.Prepare script for restoration purpose.

take this script help wise and assemble all datafile in one location
with new rman loction name:

Run On Source:

(select 'set newname for datafile '||FILE_ID||' to '''||file_name||''';'from dba_data_files);

You Will Get,
restore_rman.sql

run {
set newname for datafile 13 to '/u01/oraprod/db/apps_st/data/system12.dbf';
set newname for datafile 354 to '/u01/oraprod/db/apps_st/data/system11.dbf';
set newname for datafile 288 to '/u01/oraprod/db/apps_st/data/system10.dbf';
set newname for datafile 1 to '/u01/oraprod/db/apps_st/data/system01.dbf';
set newname for datafile 2 to '/u01/oraprod/db/apps_st/data/system02.dbf';
set newname for datafile 3 to '/u01/oraprod/db/apps_st/data/system03.dbf';
set newname for datafile 4 to '/u01/oraprod/db/apps_st/data/system04.dbf';
set newname for datafile 5 to '/u01/oraprod/db/apps_st/data/system05.dbf';
set newname for datafile 295 to '/u01/oraprod/db/apps_st/data/system06.dbf';
set newname for datafile 351 to '/u01/oraprod/db/apps_st/data/system07.dbf';
set newname for datafile 353 to '/u01/oraprod/db/apps_st/data/system08.dbf';
set newname for datafile 352 to '/u01/oraprod/db/apps_st/data/system09.dbf';
set newname for datafile 6 to '/u01/oraprod/db/apps_st/data/ctxd01.dbf';
set newname for datafile 7 to '/u01/oraprod/db/apps_st/data/owad01.dbf';
set newname for datafile 8 to '/u01/oraprod/db/apps_st/data/a_queue02.dbf';
set newname for datafile 9 to '/u01/oraprod/db/apps_st/data/odm.dbf';
set newname for datafile 10 to '/u01/oraprod/db/apps_st/data/olap.dbf';
set newname for datafile 11 to '/u01/oraprod/db/apps_st/data/sysaux01.dbf';
set newname for datafile 12 to '/u01/oraprod/db/apps_st/data/apps_ts_tools01.dbf';
set newname for datafile 14 to '/u01/oraprod/db/apps_st/data/a_txn_data04.dbf';
set newname for datafile 15 to '/u01/oraprod/db/apps_st/data/a_txn_ind06.dbf';
set newname for datafile 16 to '/u01/oraprod/db/apps_st/data/a_ref03.dbf';
set newname for datafile 17 to '/u01/oraprod/db/apps_st/data/a_int02.dbf';
set newname for datafile 18 to '/u01/oraprod/db/apps_st/data/sysaux02.dbf';
set newname for datafile 314 to '/u01/oraprod/db/apps_st/data/portal01.dbf';
set newname for datafile 379 to '/u01/oraprod/db/apps_st/data/undo01.dbf';
set newname for datafile 392 to '/u01/oraprod/db/apps_st/data/a_txn_data01.dbf';
set newname for datafile 393 to '/u01/oraprod/db/apps_st/data/a_txn_ind01.dbf';
set newname for datafile 394 to '/u01/oraprod/db/apps_st/data/a_ref01.dbf';
set newname for datafile 395 to '/u01/oraprod/db/apps_st/data/a_int01.dbf';
set newname for datafile 396 to '/u01/oraprod/db/apps_st/data/a_summ01.dbf';
set newname for datafile 397 to '/u01/oraprod/db/apps_st/data/a_nolog01.dbf';
set newname for datafile 398 to '/u01/oraprod/db/apps_st/data/a_archive01.dbf';
set newname for datafile 399 to '/u01/oraprod/db/apps_st/data/a_queue01.dbf';
set newname for datafile 400 to '/u01/oraprod/db/apps_st/data/a_media01.dbf';
set newname for datafile 401 to '/u01/oraprod/db/apps_st/data/a_txn_data02.dbf';
set newname for datafile 402 to '/u01/oraprod/db/apps_st/data/a_txn_data03.dbf';
set newname for datafile 403 to '/u01/oraprod/db/apps_st/data/a_txn_ind02.dbf';
set newname for datafile 404 to '/u01/oraprod/db/apps_st/data/a_txn_ind03.dbf';
set newname for datafile 405 to '/u01/oraprod/db/apps_st/data/a_txn_ind04.dbf';
set newname for datafile 406 to '/u01/oraprod/db/apps_st/data/a_txn_ind05.dbf';
set newname for datafile 407 to '/u01/oraprod/db/apps_st/data/a_ref02.dbf';
restore database;
switch datafile all;
}

14.
RMAN>list backup of archivelog all;
Thrd Seq
1 13

RUN {
set until sequence 14 thread 1;
recover database;
}

15.
>- Rename online LOGFILES:
sqlplus / as sysdba
select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/orauat/db/apps_st/data/log02a.dbf
/u01/app/orauat/db/apps_st/data/log02b.dbf
/u01/app/orauat/db/apps_st/data/log01a.dbf
/u01/app/orauat/db/apps_st/data/log01b.dbf

alter database rename file '/u01/app/orauat/db/apps_st/data/log02a.dbf' to '/u01/oraprod/db/apps_st/data/log02a.dbf';
alter database rename file '/u01/app/orauat/db/apps_st/data/log02b.dbf' to '/u01/oraprod/db/apps_st/data/log02b.dbf';
alter database rename file '/u01/app/orauat/db/apps_st/data/log01a.dbf' to '/u01/oraprod/db/apps_st/data/log01a.dbf';
alter database rename file '/u01/app/orauat/db/apps_st/data/log01b.dbf' to '/u01/oraprod/db/apps_st/data/log01b.dbf';

>- Open database using resetlogs:
SQL> alter database open resetlogs;

>- Create and drop TEMP tablspace
select name from v$tempfile;
/u01/app/orauat/db/apps_st/data/temp01.dbf
/u01/app/orauat/db/apps_st/data/temp02.dbf


create TEMPORARY TABLESPACE TEMP3 TEMPFILE '/u01/oraprod/db/apps_st/data/temp003.dbf' size 4000M;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp3;
drop tablespace temp1 including contents and datafiles;
drop tablespace temp2 including contents and datafiles;


16.
>- Change database name using "nid" command

SQL> shut immediate
SQL> startup nomount pfile='/u01/oraprod/db/tech_st/11.1.0/dbs/initUAT.ora';
SQL> alter database mount;

SQL> select open_mode, name from v$database;


OPEN_MODE NAME
---------- ---------
MOUNTED UAT

$ nid TARGET=sys DBNAME=PROD
Password: as sysdba

Connected to database UAT (DBID=2998215867)
Change database ID and database name UAT to PROD? (Y/[N]) => Y
Database ID for database PROD changed to 385712722.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.
Instance shutdown complete

17.- Change ORACLE_SID in environment file and start database with reset logs:

Oracle Home:/u01/oraprod/db/tech_st/11.1.0
PROD_tos01.env

$grep ORACLE_SID PROD_tos01.env
ORACLE_SID="PROD"
export ORACLE_SID

[oraprod@tos01 dbs]$ vi initUAT.ora
(changed from UAT TO PROD)
db_name = PROD

[oraprod@tos01 dbs]$ mv initUAT.ora initPROD.ora
Now start with pfile initPROD.ora
SQL> startup nomount pfile='/u01/oraprod/db/tech_st/11.1.0/dbs/initPROD.ora';
SQL> alter database mount;
alter database open resetlogs;

SQL> select open_mode, name from v$database;

OPEN_MODE NAME
---------- ---------
READ WRITE PROD


18.
>- Run autoconfig on database Tier:
cd $ORACLE_HOME/appsutil/scripts/PROD_tos01
/u01/oraprod/db/tech_st/11.1.0/appsutil/scripts/PROD_tos01
sh adautocfg.sh
AutoConfig completed successfully.


>Run clone Configuration script on application Tier(applprod)
/u01/applprod/apps/apps_st/comn/clone/bin
perl adcfgclone.pl appsTier

Target System Hostname (virtual or normal) [tos01] :
Target System Database SID : PROD
Target System Database Server Node [tos01] :
Target System Base Directory : /u01/applprod/apps
Target System Tools ORACLE_HOME Directory [/u01/applprod/apps/apps/tech_st/10.1.2] : /u01/applprod/apps/tech_st/10.1.2
Target System Web ORACLE_HOME Directory [/u01/applprod/apps/apps/tech_st/10.1.3] : /u01/applprod/apps/tech_st/10.1.3
Target System APPL_TOP Directory [/u01/applprod/apps/apps/apps_st/appl] : /u01/applprod/apps/apps_st/appl
Target System COMMON_TOP Directory [/u01/applprod/apps/apps/apps_st/comn] : /u01/applprod/apps/apps_st/comn
Target System Instance Home Directory [/u01/applprod/apps/inst] : /u01/applprod/apps/inst
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] :
Do you want to preserve the Display [tos02:0.0] (y/n) ? : n
Target System Display [tos01: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] : 80


19.Entry in bash profile.

APPS:
ADD ENTRY TO .bash profile:
. /u01/applprod/apps/apps_st/appl/APPSPROD_tos01.env
http://192.168.1.4:8080

DB:
. /u01/oraprod/db/tech_st/11.1.0/PROD_tos01.env

REMOVE ALL UNWANTED PARAMETER FILE FROM OH/DBS LOCATION , FOR AVOIDING CONFLICTING.
CREATE spfile from pfile.And Use spfile,Renamed pfile also.

PROFILE OPTION:
Java%
Site Name


SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN;
commit;



- Running autoconfig on database Tier:
/u01/oraprod/db/tech_st/11.1.0/appsutil/scripts/PROD_tos01/
sh adautocfg.sh



- Running autoconfig on application Tier:
/u01/applprod/apps/inst/apps/PROD_tos01/admin/scripts
sh adautocfg.sh


WF:
select TEXT_VALUE from WF_NOTIFICATION_ATTRIBUTES ;
select TEXT_VALUE from WF_ITEM_ATTRIBUTE_VALUES;
select GUID from WF_SYSTEMS;
select NAME from WF_SYSTEMS;
select ADDRESS from WF_AGENTS;
select WEB_HOST_NAME from FND_FORM_FUNCTIONS;
select WEB_AGENT_NAME from FND_FORM_FUNCTIONS;
select LOGFILE_NAME from FND_CONCURRENT_REQUESTS;
select OUTFILE_NAME from FND_CONCURRENT_REQUESTS;

4. Verify the APPLCSF variable setting
s_applcsf variable in the context file and then run AutoConfig.

5.
5. Update the SESSION_COOKIE_DOMAIN value in ICX_PARAMETERS
select SESSION_COOKIE_DOMAIN from ICX_PARAMETERS;
select home_url from ICX_PARAMETERS;















No comments:

Post a Comment