Tuesday 19 December 2017

HOW TO IDENTIFY THE MASTER NODE IN RAC 11G R2


[root@alpha cssd]# pwd

/u01/product/1120/grid_home/log/alpha/cssd

[root@alpha cssd]#

[root@alpha cssd]# cat ocssd.log | grep "master node" | tail -1
2017-12-19 22:38:54.764: [    CSSD][1238542656]clssgmCMReconfig: reconfiguration successful, incarnation 409006089 with 2 nodes, local node number 1, master node number 2

[root@alpha cssd]#

Monday 13 November 2017

Oracle 12c (12.2.0.1) binaries Installation on Oracle Linux 7


In this post, I’m installing the Oracle Database 12c Release 2 (12.2.0.1.0) software on Oracle Linux 7.4.  Only the software is being installed at this point.
First and foremost, before you start, make sure your Linux server meets the minimum hardware requirements:
  • 1GB of RAM (plus appropriately sized swap space)
  • 6.4GB of disk space for the software installation
  • 1GB of disk space for your /tmp directory

Download the database 12c software

You need to download both Oracle Database 12cR2 parts from the Oracle Technology Network (OTN).
Once you’ve downloaded the software, unzip file to a staging area:
[oracle@localhost 12c]$ ll
total 3372756
drwxr-xr-x. 7 oracle oinstall       4096 Jan 26  2017 database
-rw-r--r--. 1 oracle oinstall 3453696911 Nov 11 00:22 linuxx64_12201_database.zip
[oracle@localhost 12c]$ cd database/
[oracle@localhost database]$ ll
total 24
drwxr-xr-x.  4 oracle oinstall 4096 Jan 26  2017 install
drwxrwxr-x.  2 oracle oinstall   61 Jan 26  2017 response
drwxr-xr-x.  2 oracle oinstall   35 Jan 26  2017 rpm
-rwxr-xr-x.  1 oracle oinstall 8771 Jan 26  2017 runInstaller
drwxrwxr-x.  2 oracle oinstall   29 Jan 26  2017 sshsetup
drwxr-xr-x. 14 oracle oinstall 4096 Jan 26  2017 stage
-rwxr-xr-x.  1 oracle oinstall  500 Feb  7  2013 welcome.html
[oracle@localhost database]$ 
























So we successfully completed the software installation of Oracle 12CR2. Happy DBA'ing :)

Sunday 25 June 2017

Rolling forward physical standby database using RMAN incremental SCN backup

Rolling forward physical standby database using RMAN incremental SCN backup 
*************************************************************************************************

At PRIMARY database

SQL> select max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
            17

At STANDBY database

SQL> select max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
            10

Mistakenly archive log sequence no 11 deleted from primary database archive log location, till archive logs#16 received at physical standby.
But due missing archive log# 11, MRP process has been stopped, which results archive log gap. 

Below is practical illustration, how to roll forward physical standby databases using RMAN incremental SCN backup.


1) Take min SCN from out of 3 queries from Physical standby

SQL> SELECT CURRENT_SCN FROM V$DATABASE;

CURRENT_SCN
-----------------
962773 

SQL> select database_role, current_scn from v$database;

SQL> select min(checkpoint_change#) from v$datafile_header;

2) Stop MRP process at standby database

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

3) Check MRP status

select RECOVERY_MODE from v$archive_dest_status;
select process,sequence#,status from v$managed_standby;

4) Take SCN based backup from primary database in order to sync with physical standby

$ rman target sys/dg123@prod

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 24 12:00:20 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: prod (DBID=3216454145)

RMAN> backup incremental from scn 962773 database format '/u01/prod/fra/StbyIncr_%U';

Starting backup at 24-JUN-17

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device type=DISK
backup will be obsolete on date 01-JUL-17
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/prod/datafiles/prod/system01.dbf
input datafile file number=00002 name=/u01/prod/datafiles/prod/sysaux01.dbf
input datafile file number=00003 name=/u01/prod/datafiles/prod/undotbs01.dbf
input datafile file number=00004 name=/u01/prod/datafiles/prod/users01.dbf
channel ORA_DISK_1: starting piece 1 at 24-JUN-17
channel ORA_DISK_1: finished piece 1 at 24-JUN-17
piece handle=/u01/prod/fra/StbyIncr_0as7jiv4_1_1 tag=TAG20170624T120908 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

using channel ORA_DISK_1
backup will be obsolete on date 01-JUL-17
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 24-JUN-17
channel ORA_DISK_1: finished piece 1 at 24-JUN-17
piece handle=/u01/prod/fra/StbyIncr_0bs7jiv5_1_1 tag=TAG20170624T120908 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 24-JUN-17

RMAN> backup current controlfile for standby format '/u01/prod/fra/Stby_control_%U';

Starting backup at 24-JUN-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 24-JUN-17
channel ORA_DISK_1: finished piece 1 at 24-JUN-17
piece handle=/u01/prod/fra/Stby_control_0cs7jive_1_1 tag=TAG20170624T120918 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-JUN-17

RMAN> exit


5) Copy RMAN backup including controlfile to standby FRA.

6) Connect RMAN to standby target

$ rman target sys/dg123@standby

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 24 12:14:20 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: prod (DBID=3170486146)

RMAN> catalog start with '/u01/standby/fra/';

using target database control file instead of recovery catalog
searching for all files that match the pattern /u01/standby/fra/

List of Files Unknown to the Database
=====================================
File Name: /u01/standby/fra/Stby_control_0cs7jive_1_1
File Name: /u01/standby/fra/StbyIncr_0as7jiv4_1_1
File Name: /u01/standby/fra/StbyIncr_0bs7jiv5_1_1

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/standby/fra/Stby_control_0cs7jive_1_1
File Name: /u01/standby/fra/StbyIncr_0as7jiv4_1_1
File Name: /u01/standby/fra/StbyIncr_0bs7jiv5_1_1


7) Before proceed with recover database, make sure standby database should be MOUNT state. If not below error will occure


RMAN> recover database noredo;

Starting recover at 24-JUN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/standby/datafiles/system01.dbf
destination for restore of datafile 00002: /u01/standby/datafiles/sysaux01.dbf
destination for restore of datafile 00003: /u01/standby/datafiles/undotbs01.dbf
destination for restore of datafile 00004: /u01/standby/datafiles/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/standby/fra/StbyIncr_0as7jiv4_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/24/2017 12:16:25
ORA-19870: error while restoring backup piece /u01/standby/fra/StbyIncr_0as7jiv4_1_1
ORA-19573: cannot obtain exclusive enqueue for datafile 1


so,

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY            MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
Database mounted.
SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@stand dbs]$
[oracle@stand dbs]$  rman target sys/dg123@standby

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 24 13:05:24 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: prod (DBID=3170486146, not open)

RMAN> recover database noredo;

Starting recover at 24-JUN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/standby/datafiles/system01.dbf
destination for restore of datafile 00002: /u01/standby/datafiles/sysaux01.dbf
destination for restore of datafile 00003: /u01/standby/datafiles/undotbs01.dbf
destination for restore of datafile 00004: /u01/standby/datafiles/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/standby/fra/StbyIncr_0as7jiv4_1_1
channel ORA_DISK_1: piece handle=/u01/standby/fra/StbyIncr_0as7jiv4_1_1 tag=TAG20170624T120908
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

Finished recover at 24-JUN-17

RMAN> 

[oracle@stand dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Jun 24 13:06:30 2017

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL> shut immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


SQL> startup nomount
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
SQL> !

[oracle@stand fra]$ ll
total 19720
drwxr-x--- 4 oracle oinstall    4096 Jun 24 11:37 standby
-rw-r----- 1 oracle oinstall 9797632 Jun 24 12:13 Stby_control_0cs7jive_1_1
-rw-r----- 1 oracle oinstall  557056 Jun 24 12:13 StbyIncr_0as7jiv4_1_1
-rw-r----- 1 oracle oinstall 9797632 Jun 24 12:14 StbyIncr_0bs7jiv5_1_1
[oracle@stand fra]$
[oracle@stand fra]$ rman target sys/dg123@standby

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Jun 24 13:07:29 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: prod (not mounted)

RMAN> restore standby controlfile from '/u01/standby/fra/Stby_control_0cs7jive_1_1';

Starting restore at 24-JUN-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/standby/datafiles/stndcnt.ctl
Finished restore at 24-JUN-17

RMAN> exit


Recovery Manager complete.


SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.


SQL> startup mount
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
Database mounted.
SQL>
SQL>
SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY RECOVERY NEEDED

SQL>
SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL>
SQL> select max(sequence#) from v$archived_log where applied='YES';

MAX(SEQUENCE#)
--------------
            17

SQL>
SQL> /

MAX(SEQUENCE#)
--------------
            18



SQL> select count(1) from sinu.emp;
select count(1) from sinu.emp;
                     *
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only


SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-10456: cannot open standby database; media recovery session may be in
progress


SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

SQL>
SQL>
SQL> alter database open;

Database altered.

SQL> alter database recover managed standby database disconnect from session using current logfile;

Database altered.

SQL>
SQL>
SQL>
SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY WITH APPLY MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL> select count(1) from sinu.emp;

  COUNT(1)
----------
         4

SQL> select * from sinu.emp;

        ID
----------
         1
         1
         1
         1

SQL>

Happy DBA'ing :)


Saturday 24 June 2017

Conversion of Physical standby to Snapshot standby and vice versa


Conversion of PHYSICAL standby to SNAPSHOT standby
******************************************************************

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL>
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL>
SQL> sho parameter db_recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/standby/fra
db_recovery_file_dest_size           big integer 3882M
SQL>
SQL>
SQL> alter database recover managed standby database cancel;

Database altered.

SQL>
SQL>
SQL> shut immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
Database mounted.
SQL>
SQL> alter database convert to snapshot standby;

Database altered.

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  SNAPSHOT STANDBY NOT ALLOWED

SQL> alter database open;

Database altered.

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;


OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ WRITE           MAXIMUM PERFORMANCE  SNAPSHOT STANDBY NOT ALLOWED

SQL> SQL>



Conversion of SNAPSHOT standby to PHYSICAL standby
*******************************************************************

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
Database mounted.
SQL>
SQL> alter database convert to physical standby;

Database altered.

SQL> SQL> shut immediate
ORA-01507: database not mounted
ORACLE instance shut down.


SQL> startup
ORACLE instance started.

Total System Global Area 1286066176 bytes
Fixed Size                  2213016 bytes
Variable Size             754977640 bytes
Database Buffers          520093696 bytes
Redo Buffers                8781824 bytes
Database mounted.
Database opened.
SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY            MAXIMUM PERFORMANCE  PHYSICAL STANDBY RECOVERY NEEDED

SQL>
SQL> alter database recover managed standby database disconnect from session using current logfile;

Database altered.

SQL>
SQL> select RECOVERY_MODE from v$archive_dest_status;

RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY
IDLE
IDLE
IDLE
IDLE
IDLE
IDLE
IDLE
IDLE
IDLE
IDLE

32 rows selected.

SQL>
SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY WITH APPLY MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL>
SQL>

Sunday 18 June 2017

Step by step Physical standby database creation using RMAN DUPLICATE in oracle 11g.

Step by step Physical standby database creation using RMAN DUPLICATE in oracle 11g.
*******************************************************************************************************

Oracle binaries installed with one stand alone database created.

IP: 192.168.56.2
Primary DB_NAME=prod
Primary DB_UNIQUE_NAME=prod

on Physical standby, I have installed only oracle binaries.

IP: 192.168.56.3
Primary DB_NAME=prod
Primary DB_UNIQUE_NAME=stdby

Required Parameters:
********************
                          
DB_NAME    - Must be same on primary & on all standby
DB_UNIQUE_NAME    - Must be UNIQUE on all database respectively
LOG_ARCHIVE_CONFIG    - This parameter includes DB_UNIQUE_NAME which are the part of DATAGUARD configuration
LOG_ARCHIVE_DEST_n    - Define Local & Remote archive log file location
LOG_ARCHIVE_DEST_STATE_n - Define state of archiving (ENABLE or DEFER)
REMOTE_LOGIN_PASSWORDFILE - Must be in EXCLUSIVE mode
FAL_SERVER - Use for archivelog gap resolution (required only in physical standby server)
DB_FILE_NAME_CONVERT - Required when directory structure is different FOR datafiles
LOG_FILE_NAME_CONVERT - Required when directory structure is different FOR logfiles
STANDBY_FILE_MANAGEMENT - Keep AUTO to create file automatically on standby


STEPS:
******
on PRIMARY database:

1) ENABLE ARCHIVELOG MODE

SELECT LOG_MODE FROM V$DATABASE;

IF ARCHIVELOG MODE is DISABLE, follow below steps to enable it.

SHUT IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;

2) ENABLE FORCE LOGGING MODE

SELECT FORCE_LOGGING FROM V$DATABASE;

ALTER DATABASE FORCE LOGGING;

3) VERIFY DB_NAME & DB_UNIQUE_NAME OF Primary Database

SHOW PARAMETER DB_NAME;
SHOW PARAMETER DB_UNIQUE_NAME;

4) CONFIGURE LOG_ARCHIVE_CONFIG PARAMETER

ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,stdby)';

5) SET ARCHIVELOG DESTINATION FOR STANDBY 

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=ngprd VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ngprd';

ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;

6) SET REMOTE LOGIN PASSWORD TO EXCLUSIVE

ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;

SHOW PARAMETER REMOTE_LOGIN_PASSWORDFILE;

7) SET FAL_SERVER PARAMETER

ALTER SYSTEM SET FAL_SERVER=stdby;

8) ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

9) CONFIGURE REQUIRED NETWORK SERVICES using "NETMGR"


10) CREATE STANDBY CONTROLFILE & PFILE

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/stndcnt.ctl';
CREATE PFILE='/tmp/initstdby.ora' FROM SPFILE;

11) MODIFY initstdby.ora file 

i)   change DB_UNIQUE_NAME
ii)  change FAL_SERVER
iii) change log_archive_dest_n
iv)  change location of controlfile

To achieve switchover & switchback (DR) activity, modify same parameters as in production into standby pfile.

12) CREATE APPROPRIATE DIRECTORY STRUCTURE AND MOVE BACKUP, PASSWORD FILE, CONTROLFILE & PFILE

NOTE:- If you fail to move password file to standby destination, you will face below error, while transporting logs to standy site.

ORA-01031: insufficient privileges

In order to rectify this error, move password file to $ORACLE_HOME/dbs location and rename with ora$ORACLE_SID.


ON PHYSICAL SERVER:
*******************
1) CREATE NETWORK SERVICES & UPDATE /etc/oratab FILE

2) START LISTENER on BOTH database

3) Startup database in nomount with updated standby pfile.


SQL> startup nomount pfile='/u01/app/oracle/standbyuct/1120/dbhome/dbs/initstdby.ora';
ORACLE instance started.

Total System Global Area 1336176640 bytes
Fixed Size                  2213136 bytes
Variable Size             788531952 bytes
Database Buffers          536870912 bytes
Redo Buffers                8560640 bytes
SQL>


ON PRIMARY SERVER:
******************

13) Connect to RMAN with target and auxiliary server


[oracle@prod ~]$ rman target sys/dg123@prod auxiliary sys/dg123@stdby

Recovery Manager: Release 11.2.0.1.0 - standbyuction on Sun Jun 18 00:55:50 2017

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: prod (DBID=3169964256)
connected to auxiliary database: prod (not mounted)

RMAN> duplicate target database for standby from active database nofilenamecheck;

Starting Duplicate Db at 18-JUN-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/standbyuct/1120/dbhome/dbs/orapwprod' auxiliary format
 '/u01/app/oracle/standbyuct/1120/dbhome/dbs/orapwstdby'   ;
}
executing Memory Script

Starting backup at 18-JUN-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=41 device type=DISK
Finished backup at 18-JUN-17

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/u01/prod/datafiles/prod/stndcnt.ctl';
}
executing Memory Script

Starting backup at 18-JUN-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/standbyuct/1120/dbhome/dbs/snapcf_prod.f tag=TAG20170618T005703 RECID=3 STAMP=946947426
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 18-JUN-17

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/prod/datafiles/prod/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/prod/datafiles/prod/system01.dbf";
   set newname for datafile  2 to
 "/u01/prod/datafiles/prod/sysaux01.dbf";
   set newname for datafile  3 to
 "/u01/prod/datafiles/prod/undotbs01.dbf";
   set newname for datafile  4 to
 "/u01/prod/datafiles/prod/users01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u01/prod/datafiles/prod/system01.dbf"   datafile
 2 auxiliary format
 "/u01/prod/datafiles/prod/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u01/prod/datafiles/prod/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u01/prod/datafiles/prod/users01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/prod/datafiles/prod/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 18-JUN-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/prod/datafiles/prod/system01.dbf
output file name=/u01/prod/datafiles/prod/system01.dbf tag=TAG20170618T005716
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/prod/datafiles/prod/sysaux01.dbf
output file name=/u01/prod/datafiles/prod/sysaux01.dbf tag=TAG20170618T005716
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/prod/datafiles/prod/undotbs01.dbf
output file name=/u01/prod/datafiles/prod/undotbs01.dbf tag=TAG20170618T005716
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/prod/datafiles/prod/users01.dbf
output file name=/u01/prod/datafiles/prod/users01.dbf tag=TAG20170618T005716
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-JUN-17

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=946947666 file name=/u01/prod/datafiles/prod/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=946947666 file name=/u01/prod/datafiles/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=946947666 file name=/u01/prod/datafiles/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=946947666 file name=/u01/prod/datafiles/prod/users01.dbf
Finished Duplicate Db at 18-JUN-17

RMAN>
RMAN>
RMAN> exit


Recovery Manager complete.
[oracle@standby ~]$


ON STANDBY SERVER
******************

4) Check the database status and start MRP process

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY RECOVERY NEEDED

SQL> alter database recover managed standby database disconnect from session;

Database altered.

SQL> select recovery_mode from v$archive_dest_status;

RECOVERY_MODE
-----------------------
MANAGED
IDLE
IDLE
IDLE
IDLE
IDLE

32 rows selected.

SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
MOUNTED              MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED

SQL> shut immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> 
SQL>
SQL>
SQL> startup
ORACLE instance started.

Total System Global Area 1336176640 bytes
Fixed Size                  2213136 bytes
Variable Size             788531952 bytes
Database Buffers          536870912 bytes
Redo Buffers                8560640 bytes
Database mounted.
Database opened.
SQL> select OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;

OPEN_MODE            PROTECTION_MODE      DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- -------------------- ---------------- --------------------
READ ONLY            MAXIMUM PERFORMANCE  PHYSICAL STANDBY NOT ALLOWED