Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, June 13, 2017

begin backup mode

DBWn checkpoints the tablespace (writes out all dirty blocks as of a given SCN)
CKPT stops updating the Checkpoint SCN field in the datafile headers and begins updating the Hot Backup Checkpoint SCN field instead
LGWR begins logging full images of changed blocks the first time a block is changed after being written by DBWn

Adpreclone and Adcfgclone

What will happen When you run Adpreclone and Adcfgclone?
Adpreclone.pl script prepare the source system to be cloned by collecting information about source
system. Create a cloning stage area,generate template and driver from existing files that contain source specific hard coded value.
When you run “adpreclone.pl dbTier” on DB side
Following directories will be created in the ORACLE_HOME/appsutil/cloneJlib, db, data where “Jlib” relates to libraries “db” will contain the techstack information, “data” will contain the information related to datafiles and required for cloning.
Creates driver files at ORACLE_HOME/appsutil/driver/instconf.drv
Converts inventory from binary to xml, the xml file is located at $ORACLE_HOME/appsutil/clone/context/db/Sid_context.xml
Prepare database for cloning:  This includes creating database control file script and datafile location information file at
$ORACLE_HOME/appsutil/templateadcrdbclone.sql, dbfinfo.lst
Generates database creation driver file at ORACLE_HOME/appsutil/clone/data/driverdata.drv
Copy JDBC Libraries at ORACLE_HOME/appsutil/clone/jlib/classes12.jar and appsutil

When you run “adpreclone.pl appsTier” On Apps Side
This will create stage directory at $COMMON_TOP/clone. This also run in two steps.
Techstack:  Creates template files for Oracle_iAS_Home/appsutil/template and Oracle_806_Home/appsutil/template
Creates Techstack driver files for IAS_ORACLE_HOME/appsutil/driver/instconf.drv and 806_ORACLE_HOME/appsutil/driver/instconf.drv
APPL_TOP preparation:  It will create application top driver file at $COMMON_TOP/clone/appl/driver/appl.drv-Copy JDBC libraries and $COMMON_TOP/clone/jlib/classes111.zip

what Perl adcfgclone.pl dbTechStack do?
Perl adcfgclone.pl dbTechStack will do below things.
1)Create context file
2)Register ORACLE_HOME
3)Relink ORACLE_HOME
4)Configure ORACLE_HOME
5)Start SQL*NET listener

what Perl adcfgclone.pl dbTier do?
1)Create context file
2)Register ORACLE_HOME
3)Relink ORACLE_HOME
4)Configure ORACLE_HOME
5)Recreate controlfile
6)Configure database
7)Start SQL*NET listener
==
cd $ORACLE_HOME/appsutils/clone/bin
perl adcfgclone.pl dbTier pwd=apps
This will use the templates and driver files those were created while running adpreclone.pl on source system and has been copied to target system.
Following scripts are run by adcfgclone.pl dbTier for configuring techstack
adchkutl.sh — This will check the system for ld, ar, cc, and make versions.
adclonectx.pl — This will clone the context file. This will ceate a new context file as per the details of this instance.
runInstallConfigDriver — located in $Oracle_Home/appsutil/driver/instconf.drv
Relinking $Oracle_Home/appsutil/install/adlnkoh.sh — This will relink ORACLE_HOME
For data on database side, following scripts are runDriver file $Oracle_Home/appsutil/clone/context/data/driver/data.drv
Create database adcrdb.zipAutoconfig is runControl file creation adcrdbclone.sql
Run adcfgclone.pl for dbTier.

what Perl adcfgclone.pl appsTier do?
perl adcfgclone.pl appsTier will do below things.
1)Create context file
2)Register ORACLE_HOME
3)Relink ORACLE_HOME
4)Configure ORACLE_HOME
5)Create INST_TOP
6)Configure APPL_TOP
7)Start Apps Processses
==
On Application Side

cd $COMMON_TOP/clone/bin/
perl adcfgclone.pl appsTier pwd=apps
Following scripts are run by adcfgclone.pl:
Creates context file for target adclonectx.pl
Run driver files $ORACLE_HOME/appsutil/driver/instconf.drv and $IAS_ORACLE_HOME/appsutil/driver/instconf.drv
Relinking of Oracle Home $ORACLE_HOME/bin/adlnk806.sh and $IAS_ORACLE_HOME/bin/adlnkiAS.sh
At the end it will run the driver file $COMMON_TOP/clone/appl/driver/appl.drv and then runs autoconfig.

When we run adcfgclone.pl which script it will call?
It will call adclone.pl which is located at $AD_TOP/bin .

When we run perl adpreclone.pl dbTier why it requires apps password?
It requires a database connection to validate apps schema.

When do you run adpreclone on Production?
If any changes made to either TechStack,database or any patches applied.

How do we find adpreclone is run in source or not ?
 If clone directory exists under $RDBMS_ORACLE_HOME/appsutil for oracle user and $COMMON_TOP/clone for applmgr user.

When we run perl adpreclone.pl appTier why it will not prompt for apps password?
It doesn’t require db a connection.

adcfgclone on database node we had three modes
perl adcfgclone.pl dbTier
It will configure the ORACLE_HOME on the target database tier node and  recreate the controlfiles.
This is specially used in case of standby database and/or hot backups. It will take care of all the steps.

perl adcfgclone.pl dbTechStack
It will configure the ORACLE_HOME on the target database tier node only. Relink the oracle home.

perl adcfgclone.pl dbconfig
It is used to configure the database with  context file.Database should be in open mode.

adcfgclone.pl appsTier dualfs
DUALFS – new feature is introduced in the latest AD-TXK Delta 7.
This feature will create both the filesystems fs1 and fs2 during the clonning process.

Cloning Procedure:

Instance Details:
Source Instance : PRD
Target Instance : TST

Pre-Tasks:
Do blackout and bring down taget system’s services
Backup parameter file, CONTEXT_FILEs and all environment file of both application and database.
Remove Application files(apps_st, tech_st and INST_TOP) of target system.
drop the database:
screen -S ownuser
sudo su - oracle
Startup mount exclusive restrict;
show parameter CLUSTER_DATABASE;
select name,open_mode from v$database;
Drop database;
Verify space on the database node and applications node

Prepare the source system:
On source, run adpreclone.pl ( if not executed recently)
$ cd  $ORACLE_HOME/appsutil/scripts/[CONTEXT_NAME]
$ perl adpreclone.pl dbTier

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

Copying files:
On DB Node
Copy the latest DB backups from source to target (Including archivelog backup and controlfile backup)
On Apps Node
Copy apps_st and tech_st from source application node to target application node.

Steps to Clone Database, here can be multiple ways.
1.With duplicate from backup or standby database:

cle@hostname scripts]$ cat duplicate.sh
#!/bin/ksh
today=`date +"%Y%m%d_%H:%M:%S"`
. /u01/home/oracle/TST.env
rman=$ORACLE_HOME/bin/rman
$ORACLE_HOME/bin/rman cmdfile=/u01/script/duplicate.fic log=/u01/log/rman_9june17.log
[oracle@hostname scripts]$ cat duplicate.fic
@/u01/script/duplicate.cnx
run {
allocate auxiliary channel uisk1 type DISK;
SET NEWNAME FOR BLOCK CHANGE TRACKING FILE TO '+MAN';
#set until time "TO_DATE('2016-06-19 00:25:00','yyyy-mm-dd hh24:mi:ss')";
duplicate database to TST backup location '/backup/PRD/rman' nofilenamecheck
LOGFILE
  GROUP 1 ('+TST_REDO') SIZE 500M,
  GROUP 2 ('+TST_REDO') SIZE 500M,
  GROUP 3 ('+TST_REDO') SIZE 500M
  ;
  }
[oracle@hostname scripts]$ cat /u01/script/duplicate.cnx
set echo off
connect auxiliary /
set echo on
[oracle@hostname scripts]$

2. Available hot backup:
Change the db_name parameter in pfile that is backed up (eg: TST to PRD)
Start the target db using modified pfile
Sql > startup nomount pfile=’/backup/clone/initTST.ora’
Rstore the controlfile from the backup of PRD
RMAN> restore controlfile from ‘/backup/clone/PRD/PRD.ctl’

Mount the database
Sql> alter database mount
Once db is mounted catalog the backups copied from source.
RMAN > catalog start with ‘/backup/clone/PROD/’;

Once the backups are cataloged we can restore the database usig the PRD’s backup. But the database files are pointing to PRD’s
location so it will try to restore the datafiles to PRD’s location which may not exist in target.

Hence we will have to rename the datafiles to point to new(TST) location before restoring. We can rename the files or use SET NEWNAME in RMAN before restoring.
eg: set newname for datafile 1 to ‘/u01/oracle/TST/system.dbf’;

Note : Below script can be used to create the script for “SET NEWNAME”. Change the path of target datafile location and run the script in source.
select ‘set newname for datafile ‘ || file_id || ‘ to ”/u01/oracle/TST/’ ||
substr(file_name,instr(file_name,’/’,-1)+1) || ”’;’
from dba_data_files;

Restore and recover the database
Eg:
Rman>run {
set until time “to_date(’26/08/2017 24:20:00′,’dd/mm/yyyy hh24:mi:ss’)”;
set newname for datafile 1 to ‘/u01/oracle/TST/system.dbf’;
set newname for datafile 44 to ‘/u01/oracle/TST/apps_ts_tx_data_01.dbf’;
set newname for datafile 76 to ‘/u01/oracle/TST/apps_ts_tx_idx01.dbf’;
set newname for datafile 35 to ‘/u01/oracle/TST/sysaux_01.dbf’;
set newname for datafile 37 to ‘/u01/oracle/TST/undotbs1_01.dbf’;
allocate channel ch1 type disk;
allocate channel ch2 type disk;
restore database;
switch datafile all;
recover database;
release channel ch1;
release channel ch2;
}

After the database is restored and recovered then open the database using resetlogs.
SQL> alter database open resetlogs;
Change the database name to TEST
nid TARGET=SYS/welcome123 DBNAME=TEST
Once the database is renamed the nid command will bring down the database. Start it using the old pfile in ORACLE_HOME/dbs. (which has db_name as TEST)
Sql>startup mount

Sql>alter database open resetlogs;

3. Put the source in begun backup mode and contnue:
Put the database in the begin backup mode so that the backup can be performed without disturbing to other operations in the database.
SQL> alter database begin backup;
You can check the status of backup activation mode by using the below command
SQL> select * from v$backup;
status:ACTIVE
Copy the all database files from the database tier to the target location
Next release the database from the backup mode,
SQL> alter database end backup;
Status:NOT ACTIVE
Next take backup of the controlfile to the backup location by using the command,
SQL> alter database backup contolfile to trace as ‘/u01/oraR12/cont.sql’;
Copy the generated archivelog file to the target location which is required for recovering the database at target location. Copy the trace of controlfile also.
$ cd /u01/oraR12/db/tech_st/11.1.0/appsutil/clone/bin
$ perl adcfgclone.pl dbTechStack
Recreates the database control files
Once control file is created, database will be in mount stage. Execute recover command using backup control file after the database is mounted.
SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
Starts the database

4.Cold Backup

Post Steps in Database:
Recreate ALL the temp tablespaces.
SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN;
Run auto-config on DB Tier after ensuring that the DB and listener are up and running.

Steps to Clone Application:

Compare the size (du –sh) output with production for same content.
cd /u01/oracle/TST/apps/apps_st/comn/clone/bin
perl adcfgclone.pl appsTier <Path of the context_file that was saved in Pre Task B>
Stop the concurrent managers and workfow.
Stop the Applications
Change Apps password:
FNDCPASS apps/xxx 0 Y system/xx SYSTEM APPLSYS XXX
Change Sysasmin password:
FNDCPASS apps/xxx 0 Y system/xxx USER SYSADMIN xxx
Point all the fndcpesr soft links in $XX_TOP/bin to $FND_TOP/bin/fndcpesr
Run cmclean.sql
Run adautocfg.sh
Start all the services
Login to the application using login page and launch the forms.CM check
Change the Site Name to the name of the current environment with information of the Refreshed time