Saturday 14 June 2014

rman duplicate command for rman cloning(Robustness of ORACLE Technology)



ROBUSTNESS OF ORACLE TECHNOLOGIES : PART1
* Cloning Oracle Database  using backup based duplication
----------------------------------------------------------------------------
I was wondering about the cloning of oracle database using rman which directly converts the database name from ‘X’ to ‘Y’.
For example If I have a production database named PROD, I want to clone it to a new server for testing and the database name I want to keep as TEST.  
Is it possible using rman? If Yes, how can we do ?
The answer is yes and in fact it is the simplest way of doing cloning using rman duplicate command.
There are various ways to use rman duplicate command for database cloning depending on your requirement and availability.
Here are the ways:
Broad classification:
·         Backup based Duplication (only requires backup piece full with archivelog. Source database connection does require)
·         Active duplication (connection to source is required, no backups required )
  In my scenario I had only database rman full backup with archivelog(backup database plus archivelog) was there.
So I did the following steps to clone :
Environment:
Source DB
Target DB
PROD
TEST
DB_FILE_NAME_CONVERT=/u01/PROD/oradata
DB_FILE_NAME_CONVERT=
/u02/TEST/oradata
LOG_FILE_NAME_CONVERT=/u01/PROD/oradata
LOG_FILE_NAME_CONVERT=
/u01/TEST/oradata

I created a initialization parameter file initTEST.ora set the parameter according to TEST database server filesystem.


Added the following parameters in the initTEST.ora
DB_NAME= ‘TEST’
DB_FILE_NAME_CONVERT==’/u01/PROD/oradata’,’/u02/TEST/oradata’
LOG_FILE_NAME_CONVERT=’/u01/PROD/oradata’,’/u02/TEST/oradata’
I have created password file for TEST DATABASE
$cd $ORACLE_HOME/dbs
$orapwd file=orapwTEST password=system$

Copied the backup pieces from PROD to TEST Database location
‘/backup/PROD’
Now we are ready for Backup based duplication
I have started the TEST database with startup nomount.
Then I connected auxiliary database
$rman AUXILIARY /

Rman>duplicate database PROD dbid=123455 to TEST
      BACKUP LOCATION=‘/backup/PROD’
      NOFILENAMECHECK;

At the end it has started with database with name TEST

WOW!!!! It is awesome. It has reduced many steps unlike my previous way of doing rman restore manually.

If I would have used active duplication I would have to use the below rman command
$rman TARGET sys/password@source AUXILIARY /
 
Before running the above command I would have to configure listener and 
tnsnames.ora file for connecting to PROD database.
 
Then, for cloning here would be the command
 
RMAN>DUPLICATE TARGET DATABASE TO TEST
  SPFILE 
  NOFILENAMECHECK;
 
Please feel free to ask at viewssharings.blogspot.in@gmail.com

Friday 6 June 2014

SCAN LISTENER is showing Intermediate state in 11gR2 RAC

Hi, recently I met a problem with scan listener twice and I solved them in two different scenario.

when I observed in $crsctl stat res -t output scan listenr1 is showing intermediate state and lsnrctl status listener_scan1 is showing no services then I just did the below step in order to relocate the scan where it may belongs

$srvctl relocate scan_listener -i 2 -n ecdb1

it went fine in 1st time.  as other two scan listeners were running fine I did not touch them.

At the second time I faced the same issue, I tried to do the same as above but It all scan listeners were showing intermediate state.

I did the below steps to solve the problem.

step-1  stop all listeners running from ORACLE_HOME and GRID_HOME
$lsnrctl stop 
step-2  stop scan_listeners using srvctl stop scan in the grid home
$srvctl stop scan_listener (stop all scan listeners)
step-3 start the scan using srvctl start scan from grid home
$ srvctl stop scan (stop all scan VIPS)
step-4 start scan VIP using srvctl start scan the scan_listeners from grid home
$ srvctl start scan
$srvctl start scan_listener

Then start the listener from GRID_ORACLE_HOME, this has to be done carefully. Don't start the listener from RDBMS_ORACLE_HOME
now check in crsctl stat res -t scan listeners are online with no problem

 Please feel free to ask manojpalbabu@gmail.com