Saturday, August 19, 2017

Unable To Create Dump file | ORA-39001,ORA-39000,ORA-31641,ORA-27054


Error Details:
*****************

Export: Release 11.2.0.3.0 - Production on Sat Apr 29 15:00:44 2017

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "/mount-mig/TT0037598650/fullpserv_01.dmp"
ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
Additional information: 3
Additional information: 18


Solution Description:
**************************
Mostly you will get this error on SunOS:
----------------------------------------------------
Start The Database And Run This : sqlplus / as sysdba

ALTER SYSTEM SET EVENTS '10298 trace name context forever, level 32'; 


Datapump Import (IMPDP) fails due to Error ORA-31693,ORA-31640,ORA-19505,ORA-27037


Error Details:
*****************

ORA-31693: Table data object "VERTEX"."RATECITY" failed to load/unload and is being skipped due to error:
ORA-31640: unable to open dump file "/mnt/vertex/importdata/expdp_fulldb_vert/expdp_fulldb_vertppf_19082017_02.dmp" for read
ORA-19505: failed to identify file "/mnt/vertex/importdata/expdp_fulldb_vert/expdp_fulldb_vertppf_19082017_02.dmp"
ORA-27037: unable to obtain file status

Solution Description:
**************************

Issue is due to the mount/file system was not being accessible from the second node.
Then use Cluster=N to force Data Pump to use only the instance where the job is started and ran again data pump job using below datapump parameter:

Cluster=N

Monday, August 14, 2017

Restore RMAN Backup To Another Brand New DB Server

Watch this video to understand concept 


$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
## Restore RMAN backup To another New DB Server  ##
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


Primary Database Information
*************************************

  Host : delhi.localdomain (192.168.56.103)
  DB_NAME : prod
  Disk_Group : /disk01, /FRA

Standby Database Information
*************************************

  Host :   bangalore.localdomain (192.168.56.104)
  DB_NAME : prod
  DB_UNIQUE_NAME: prod_sty
  Disk_Group : /disk02, /FRA


========================================================
Basic pre-check before deploying Active Standby database server.
------------------------------------------------------------------------------------------------

(i) Primary Server, Instance, Databases details. 
 ********************************************************


  NAME      INSTANCE_NAME    HOST_NAME            DATABASE_ROLE        LOG_MODE        LOGINS     OPEN_MODE       STARTUP_TIME         VERSION
  --------- ---------------- -------------------- -------------------- --------------- ---------- --------------- -------------------- -----------
  PROD      prod             delhi.localdomain   PRIMARY              ARCHIVELOG      ALLOWED    READ WRITE      2017:07:31 22:54:15  11.2.0.4.0


 
 (ii) Archive log Should be enable & Flash Recovery Area Details.
 ******************************************************************************
   
  SQL> archive log list
 
  Database log mode              Archive Mode
  Automatic archival             Enabled
  Archive destination            USE_DB_RECOVERY_FILE_DEST
  Oldest online log sequence     18
  Next log sequence to archive   20
  Current log sequence           20

  SQL> show parameter recovery
 
  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- ------------------------------
  db_recovery_file_dest                string      /FRA/prod
  db_recovery_file_dest_size           big integer 4182M
  recovery_parallelism                 integer     0
 

 (iii) File-System Details of Target Side.
 ************************************************

  [oracle@bangaloe ~]$ df -h /disk02
  Filesystem            Size  Used Avail Use% Mounted on
  /dev/mapper/vg_target-lv_root
       86G   22G   60G  27% /
     
  [oracle@bangaloe ~]$ df -h /FRA
  Filesystem            Size  Used Avail Use% Mounted on
  /dev/mapper/vg_target-lv_root
       86G   22G   60G  27% /

 


Step: 1
==============================================
Set environments and start rman for prod ( @Primary Site).
--------------------------------------------------------------------------------

[oracle@source ~]$ . oraenv
ORACLE_SID = [oracle] ? prod
The Oracle base has been set to /u01/app/oracle
[oracle@source ~]$

[oracle@source ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Aug 5 13:03:57 2017

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

connected to target database: prod (DBID=3010714195)

Step: 2
============================================================================
Now check old backup details, but we need new backup with autocontrolfile ( @Primary Site).
------------------------------------------------------------------------------------------------------------------------------------


RMAN> list backup;
using target database control file instead of recovery catalog
specification does not match any backup in the repository

Step: 3
===========================================================================
Check controlfile autobakcup details, It's should ON, if Not then enable it. ( @Primary Site).
----------------------------------------------------------------------------------------------------------------------------------


RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name prod are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_prod.f'; # default

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored


Step: 4
===============================================
Take full databae backup with archivelog ( @Primary Site).
----------------------------------------------------------------------------------


RMAN> backup database plus archivelog;

Starting backup at 05-AUG-17
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=4 RECID=1 STAMP=950913403
input archived log thread=1 sequence=5 RECID=2 STAMP=950913405
input archived log thread=1 sequence=6 RECID=3 STAMP=950915922
input archived log thread=1 sequence=7 RECID=4 STAMP=950915925
input archived log thread=1 sequence=8 RECID=5 STAMP=950918291
input archived log thread=1 sequence=9 RECID=6 STAMP=950918867
input archived log thread=1 sequence=10 RECID=7 STAMP=950918898
input archived log thread=1 sequence=11 RECID=8 STAMP=950919116
input archived log thread=1 sequence=12 RECID=9 STAMP=950919118
input archived log thread=1 sequence=13 RECID=10 STAMP=950919119
input archived log thread=1 sequence=14 RECID=16 STAMP=950919173
input archived log thread=1 sequence=15 RECID=18 STAMP=950919788
input archived log thread=1 sequence=16 RECID=20 STAMP=950919790
input archived log thread=1 sequence=17 RECID=22 STAMP=950919791
input archived log thread=1 sequence=18 RECID=24 STAMP=950919793
input archived log thread=1 sequence=19 RECID=26 STAMP=950919794
input archived log thread=1 sequence=20 RECID=28 STAMP=950919795
input archived log thread=1 sequence=21 RECID=30 STAMP=950919796
input archived log thread=1 sequence=22 RECID=32 STAMP=950919796
input archived log thread=1 sequence=23 RECID=34 STAMP=950919796
input archived log thread=1 sequence=24 RECID=36 STAMP=950919797
input archived log thread=1 sequence=25 RECID=38 STAMP=950919797
input archived log thread=1 sequence=26 RECID=41 STAMP=950973779
input archived log thread=1 sequence=27 RECID=42 STAMP=951224601
input archived log thread=1 sequence=28 RECID=43 STAMP=951224605
input archived log thread=1 sequence=29 RECID=44 STAMP=951224875
channel ORA_DISK_1: starting piece 1 at 05-AUG-17
channel ORA_DISK_1: finished piece 1 at 05-AUG-17
piece handle=/FRA/prod/prod/backupset/2017_08_05/o1_mf_annnn_TAG20170805T130755_drbxgnbo_.bkp tag=TAG20170805T130755 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 05-AUG-17

Starting backup at 05-AUG-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
input datafile file number=00001 name=/disk01/prod/prod/system01.dbf
input datafile file number=00002 name=/disk01/prod/prod/sysaux01.dbf
input datafile file number=00005 name=/disk01/prod/prod/example01.dbf
input datafile file number=00003 name=/disk01/prod/prod/undotbs01.dbf
input datafile file number=00004 name=/disk01/prod/prod/users01.dbf
channel ORA_DISK_1: starting piece 1 at 05-AUG-17
channel ORA_DISK_1: finished piece 1 at 05-AUG-17
piece handle=/FRA/prod/prod/backupset/2017_08_05/o1_mf_nnndf_TAG20170805T130803_drbxgwpf_.bkp tag=TAG20170805T130803 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
Finished backup at 05-AUG-17

Starting backup at 05-AUG-17
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=30 RECID=45 STAMP=951224968
channel ORA_DISK_1: starting piece 1 at 05-AUG-17
channel ORA_DISK_1: finished piece 1 at 05-AUG-17
piece handle=/FRA/prod/prod/backupset/2017_08_05/o1_mf_annnn_TAG20170805T130928_drbxkk2x_.bkp tag=TAG20170805T130928 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-AUG-17

Starting Control File and SPFILE Autobackup at 05-AUG-17
piece handle=/FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 05-AUG-17

RMAN> exit


Step: 5
===========================================
Creare some directiories on target side ( @Target Site).
----------------------------------------------------------------------------

[oracle@target ~]$ mkdir -p  /FRA/prod

[oracle@target ~]$ mkdir -p /disk02/prod

[oracle@target ~]$ mkdir -p /u01/app/oracle/admin/prod/adump

Step: 6
===================================================================
Tranfer backupset,autobackup & password file to target location  ( @Primary Site).
-------------------------------------------------------------------------------------------------------------------


[oracle@source prod]$ pwd
/FRA/prod/prod
[oracle@source prod]$ ls -lrth
total 16K
drwxr-x--- 2 oracle oinstall 4.0K Aug  2 16:30 flashback
drwxr-x--- 5 oracle oinstall 4.0K Aug  5 13:03 archivelog
drwxr-x--- 3 oracle oinstall 4.0K Aug  5 13:07 backupset
drwxr-x--- 3 oracle oinstall 4.0K Aug  5 13:09 autobackup

[oracle@source prod]$ scp -r backupset autobackup oracle@192.168.56.102:/FRA/prod/prod
oracle@192.168.56.102's password:

o1_mf_annnn_TAG20170805T130755_drbxgnbo_.bkp                   100%   67MB  67.3MB/s   00:01
o1_mf_annnn_TAG20170805T130928_drbxkk2x_.bkp                   100%   57KB  56.5KB/s   00:00
o1_mf_nnndf_TAG20170805T130803_drbxgwpf_.bkp                   100% 1085MB  60.3MB/s   00:18
o1_mf_s_951224970_drbxklvm_.bkp                                100% 9888KB   9.7MB/s   00:00

[oracle@source prod]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/
[oracle@source dbs]$ ls -lrth

total 19M
-rw-r--r--. 1 oracle oinstall 2.8K May 15  2009 init.ora
-rw-r-----. 1 oracle oinstall   24 Jul 26 12:46 lkPROD
-rw-r-----. 1 oracle oinstall 2.5K Jul 26 14:22 orapwprod
-rw-rw----. 1 oracle oinstall 1.6K Aug  1 00:35 hc_prod.dat
-rw-r-----. 1 oracle oinstall 3.5K Aug  1 00:36 spfileprod.ora
-rw-r-----. 1 oracle oinstall 9.4M Aug  1 00:54 snapcf_prod.f
-rw-r-----  1 oracle oinstall   24 Aug  1 21:15 lkprod
-rw-r-----  1 oracle oinstall 1.5K Aug  1 21:17 orapwprod
-rw-rw----  1 oracle oinstall 1.6K Aug  5 13:03 hc_prod.dat
-rw-r-----  1 oracle oinstall 3.5K Aug  5 13:04 spfileprod.ora
-rw-r-----  1 oracle oinstall 9.6M Aug  5 13:09 snapcf_prod.f

[oracle@source dbs]$ scp orapwprod oracle@192.168.56.102:/u01/app/oracle/product/11.2.0/db_1/dbs/
oracle@192.168.56.102's password:

orapwprod                                                    100% 1536     1.5KB/s   00:00


Step: 7
=============================================================================
On target server start database via rman and restore spfile from autobackup  ( @Target Site).
-------------------------------------------------------------------------------------------------------------------------------------

[oracle@target ~]$ vi /etc/oratab

[oracle@target ~]$ . oraenv
ORACLE_SID = [oracle] ? prod
The Oracle base has been set to /u01/app/oracle

[oracle@target dbs]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Aug 5 13:18:43 2017

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

connected to target database (not started)

RMAN> startup nomount force;

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initprod.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                281019272 bytes
Database Buffers             780140544 bytes
Redo Buffers                   5517312 bytes

RMAN> restore spfile from '/FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp';

Starting restore at 05-AUG-17
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 05-AUG-17

RMAN> exit


Step: 8
==========================================================================================
Come to target SQL*Plus promte and create pfile from spfile and do some modification acording to target server.  ( @Target Site).
--------------------------------------------------------------------------------------------------------------------------------------------------------------


[oracle@target ~]$ . oraenv
ORACLE_SID = [oracle] ? prod
The Oracle base has been set to /u01/app/oracle

[oracle@target ~]$ cd $ORACLE_HOME/dbs
[oracle@target dbs]$ ls -lrth

-rw-r-----  1 oracle oinstall 3.5K Aug  5 13:28 spfileprod.ora
[oracle@target dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 5 13:30:41 2017

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


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

SQL> create pfile from spfile;

File created.

SQL> exit


[oracle@target dbs]$ ls -lrth

-rw-r-----  1 oracle oinstall 3.5K Aug  5 13:28 spfileprod.ora
-rw-r--r--  1 oracle oinstall 1.4K Aug  5 13:30 initprod.ora

[oracle@target dbs]$ vi initprod.ora

*.audit_file_dest='/u01/app/oracle/admin/prod/adump'
*.control_files='/disk02/prod/prod/control01.ctl','/disk02/prod/prod/control02.ctl'
*.db_recovery_file_dest='/FRA/prod'

:wq


Step: 9
======================================================================================
Remove spfile from dbs location, down previous stared instnace  & start it again via pfile  ( @Target Site).
------------------------------------------------------------------------------------------------------------------------------------------------------

[oracle@target dbs]$ rm -rf spfileprod.ora

[oracle@target dbs]$ ps -ef | grep pmon | grep -v grep
oracle    2437     1  0 13:19 ?        00:00:00 ora_pmon_prod
[oracle@target dbs]$
[oracle@target dbs]$ !s
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 5 13:37:09 2017

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


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


SQL> shut immediate
ORA-01507: database not mounted


[oracle@target dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 5 13:38:03 2017

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2253784 bytes
Variable Size            1006636072 bytes
Database Buffers          637534208 bytes
Redo Buffers                7094272 bytes
SQL> create spfile from pfile;

File created.

SQL> exit


Step: 10
=====================================================================================
Now start rman and restore controlfile from autobackup & put database in mount stage  ( @Target Site).
------------------------------------------------------------------------------------------------------------------------------------------------------

[oracle@target dbs]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Aug 5 13:38:27 2017

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

connected to target database: prod (not mounted)

RMAN> restore controlfile from '/FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp';

Starting restore at 05-AUG-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:01
output file name=/disk02/prod/prod/control01.ctl
output file name=/disk02/prod/prod/control02.ctl
Finished restore at 05-AUG-17

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

Step: 11
========================================================
Now tell your newly stared db to your backup location  ( @Target Site).
-------------------------------------------------------------------------------------------------

RMAN> catalog start with '/FRA/prod/prod/';

Starting implicit crosscheck backup at 05-AUG-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 05-AUG-17

Starting implicit crosscheck copy at 05-AUG-17
using channel ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck copy at 05-AUG-17

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp

searching for all files that match the pattern /FRA/prod/prod/

List of Files Unknown to the Database
=====================================
File Name: /FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp

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

List of Cataloged Files
=======================
File Name: /FRA/prod/prod/autobackup/2017_08_05/o1_mf_s_951224970_drbxklvm_.bkp


Step: 12
=============================================
Finally restore & recovery your database  ( @Target Site).
-------------------------------------------------------------------------------

RMAN> run {
2> SET NEWNAME FOR DATAFILE 1 TO "/disk02/prod/prod/system01.dbf";                                                                 
3> SET NEWNAME FOR DATAFILE 2 TO "/disk02/prod/prod/sysaux01.dbf";                                                                 
4> SET NEWNAME FOR DATAFILE 3 TO "/disk02/prod/prod/undotbs01.dbf";                                                                
5> SET NEWNAME FOR DATAFILE 4 TO "/disk02/prod/prod/users01.dbf";                                                                  
6> SET NEWNAME FOR DATAFILE 5 TO "/disk02/prod/prod/example01.dbf";
7> restore database;
8> switch datafile all;
9> recover database;
10> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 05-AUG-17
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /disk02/prod/prod/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /disk02/prod/prod/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /disk02/prod/prod/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /disk02/prod/prod/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /disk02/prod/prod/example01.dbf
channel ORA_DISK_1: reading from backup piece /FRA/prod/prod/backupset/2017_08_05/o1_mf_nnndf_TAG20170805T130803_drbxgwpf_.bkp
channel ORA_DISK_1: piece handle=/FRA/prod/prod/backupset/2017_08_05/o1_mf_nnndf_TAG20170805T130803_drbxgwpf_.bkp tag=TAG20170805T130803
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 05-AUG-17

datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=951227735 file name=/disk02/prod/prod/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=951227735 file name=/disk02/prod/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=951227735 file name=/disk02/prod/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=12 STAMP=951227735 file name=/disk02/prod/prod/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=13 STAMP=951227735 file name=/disk02/prod/prod/example01.dbf

Starting recover at 05-AUG-17
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=30
channel ORA_DISK_1: reading from backup piece /FRA/prod/prod/backupset/2017_08_05/o1_mf_annnn_TAG20170805T130928_drbxkk2x_.bkp
channel ORA_DISK_1: piece handle=/FRA/prod/prod/backupset/2017_08_05/o1_mf_annnn_TAG20170805T130928_drbxkk2x_.bkp tag=TAG20170805T130928
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/FRA/prod/prod/archivelog/2017_08_05/o1_mf_1_30_drc080cv_.arc thread=1 sequence=30
channel default: deleting archived log(s)
archived log file name=/FRA/prod/prod/archivelog/2017_08_05/o1_mf_1_30_drc080cv_.arc RECID=46 STAMP=951227736
unable to find archived log
archived log thread=1 sequence=31
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/05/2017 13:55:37
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 31 and starting SCN of 1044850

RMAN> exit

******************************************
Note: the error can be ignored as RMAN has applied all the available archive log files and is now trying to apply a non-existent archive log file.the error can be ignored as RMAN has applied all the available archive log files and is now trying to apply a non-existent archive log file.
**********************************************



Step: 13
===================================================================================
Now try to start your database with resetlogs and will get below error, then rename your redologs. ( @Target Site).
------------------------------------------------------------------------------------------------------------------------------------------------

SQL> ALTER DATABASE OPEN RESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-00349: failure obtaining block size for '/disk01/prod/prod/redo01.log'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9


SQL> alter database rename file  '/disk01/prod/prod/redo01.log' TO '/disk02/prod/prod/redo01.log';

Database altered.

SQL> alter database rename file  '/disk01/prod/prod/redo02.log' TO '/disk02/prod/prod/redo02.log';

Database altered.

SQL> alter database rename file  '/disk01/prod/prod/redo03.log' TO '/disk02/prod/prod/redo03.log';

Database altered.


Step: 14
========================================================================================
Again try to start your database with resetlogs and will get below error, Clear your one unclear redologfile. ( @Target Site).
--------------------------------------------------------------------------------------------------------------------------------------------------------

SQL> ALTER DATABASE OPEN RESETLOGS;
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-00392: log 1 of thread 1 is being cleared, operation not allowed
ORA-00312: online log 1 thread 1: '/disk02/prod/prod/redo01.log'



SQL> select GROUP#,THREAD#,BYTES,BLOCKSIZE,MEMBERS,ARCHIVED,STATUS,FIRST_CHANGE#,FIRST_TIME,NEXT_CHANGE#,NEXT_TIME from v$log;

    GROUP#    THREAD#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
         1          1   52428800        512          1 NO  CLEARING_CURRENT       1044850 05-AUG-17   2.8147E+14
         3          1   52428800        512          1 YES CLEARING               1044763 05-AUG-17      1044850 05-AUG-17
         2          1   52428800        512          1 YES CLEARING               1041102 05-AUG-17      1044763 05-AUG-17



SQL>  alter database clear logfile '/disk02/prod/prod/redo01.log';

Database altered.

Step: 14
===========================================================================
Again try to start your database with resetlogs and you are done here..!!. ( @Target Site).
---------------------------------------------------------------------------------------------------------------------------------


SQL> select GROUP#,THREAD#,BYTES,BLOCKSIZE,MEMBERS,ARCHIVED,STATUS,FIRST_CHANGE#,FIRST_TIME,NEXT_CHANGE#,NEXT_TIME from v$log;

    GROUP#    THREAD#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
         1          1   52428800        512          1 NO  CURRENT                1044850 05-AUG-17   2.8147E+14
         3          1   52428800        512          1 YES CLEARING               1044763 05-AUG-17      1044850 05-AUG-17
         2          1   52428800        512          1 YES CLEARING               1041102 05-AUG-17      1044763 05-AUG-17

SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

SQL> exit

Pradeep Kumar
+91-9972201100

Wednesday, August 2, 2017

Physical Standby : RMAN Active Duplicate method (Without backup)





$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
## 11g Standby : RMAN Active Duplicate method (Without backup) ##
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


Primary Database Information
*************************************

Host:     source.localdomain (192.168.56.101)
DB_NAME:   prod
DB_UNIQUE_NAME: prod
Disk_Group:   /disk01, /FRA

Standby Database Information
*************************************

Host:     target.localdomain (192.168.56.102)
DB_NAME:   prod
DB_UNIQUE_NAME: prod_sty
Disk_Group:   /disk02, /FRA


========================================================
Basic pre-check before deploying Active Standby database server.
------------------------------------------------------------------------------------------------

(i) Primary Server, Instance, Databases details. 
 ********************************************************


NAME      INSTANCE_NAME    HOST_NAME            DATABASE_ROLE        LOG_MODE        LOGINS     OPEN_MODE       STARTUP_TIME         VERSION
--------- ---------------- -------------------- -------------------- --------------- ---------- --------------- -------------------- -----------
PROD      prod             source.localdomain   PRIMARY              ARCHIVELOG      ALLOWED    READ WRITE      2017:07:31 22:54:15  11.2.0.4.0

 (ii) Disgroups Details of Primary Side.
 **********************************************

[oracle@source ~]$ df -h /disk01
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_source-lv_root
86G   14G   68G  17% /
[oracle@source ~]$ df -h /FRA
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_source-lv_root
86G   14G   68G  17% /

  
 (iii) Archive log Should be enable & Flash Recovery Area Details.
 ******************************************************************************
   
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     18
Next log sequence to archive   20
Current log sequence           20

SQL> show parameter recovery
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /FRA/prod
db_recovery_file_dest_size           big integer 4182M
recovery_parallelism                 integer     0

 (iv) check whether standby server pinging from primary. 
 ******************************************************************

[oracle@source ~]$ ping 192.168.56.102
PING 192.168.56.102 (192.168.56.102) 56(84) bytes of data.
64 bytes from 192.168.56.102: icmp_seq=1 ttl=64 time=0.510 ms
64 bytes from 192.168.56.102: icmp_seq=2 ttl=64 time=0.458 ms
64 bytes from 192.168.56.102: icmp_seq=3 ttl=64 time=0.465 ms
64 bytes from 192.168.56.102: icmp_seq=4 ttl=64 time=0.540 ms
^C
--- 192.168.56.102 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3331ms
rtt min/avg/max/mdev = 0.458/0.493/0.540/0.037 ms


 (v) check whether primary server pinging from standby.
 *******************************************************************

[oracle@target ~]$ ping 192.168.56.101
PING 192.168.56.101 (192.168.56.101) 56(84) bytes of data.
64 bytes from 192.168.56.101: icmp_seq=1 ttl=64 time=0.195 ms
64 bytes from 192.168.56.101: icmp_seq=2 ttl=64 time=0.402 ms
64 bytes from 192.168.56.101: icmp_seq=3 ttl=64 time=0.216 ms
64 bytes from 192.168.56.101: icmp_seq=4 ttl=64 time=0.184 ms
^C
--- 192.168.56.101 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3305ms
rtt min/avg/max/mdev = 0.184/0.249/0.402/0.089 ms




 (vi) File-System Details of Standby Side.
 ************************************************

[oracle@target ~]$ df -h /disk02
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_root
86G   22G   60G  27% /
[oracle@target ~]$ df -h /FRA
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_target-lv_root
86G   22G   60G  27% /

 
**************
Primary Site :
**************

Step: 1
=========================================
Enable Database Force Logging ( @Primary Site).
-----------------------------------------------------------------------

SQL> ALTER DATABASE FORCE LOGGING;

Database altered.

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      prod

SQL> show parameter db_uni

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      prod

Step: 2
====================================================
Setting up up Log_Archive_Config Parameter ( @Primary Site).
-----------------------------------------------------------------------------------------

SQL> show parameter LOG_ARCHIVE_CONFIG

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string


SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(prod,prod_sty)';

System altered.

SQL>  show parameter LOG_ARCHIVE_CONFIG

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      DG_CONFIG=(prod,prod_sty)



Step: 3
==========================================================================================
Setting up Log_Archive_Dest_1 (To store Local Archive log ) & Log_Archive_Dest_2 ( To Send local archive to remote server 'Standby' ) Parameter ( @Primary Site).
-------------------------------------------------------------------------------------------------------------------------------------------------------------

SQL> show parameter LOG_ARCHIVE_DEST_1

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string

SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prod';

System altered.

SQL> show parameter LOG_ARCHIVE_DEST_2

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2                   string


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=prod_sty ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=prod_sty';

System altered.

Step: 4
===========================================
Setting up up following parameters ( @Primary Site).
--------------------------------------------------------------------------

SQL> show parameter LOG_ARCHIVE_FORMAT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_format                   string      %t_%s_%r.dbf

SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;

System altered.

SQL> show parameter LOG_ARCHIVE_MAX_PROCESSES

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_max_processes            integer     4

SQL> show parameter REMOTE_LOGIN_PASSWORDFILE

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile            string      EXCLUSIVE


SQL> sho parameter fal_client

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string


SQL> ALTER SYSTEM SET fal_client='prod';

System altered.

SQL> sho parameter fal_server

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_server                           string


SQL> ALTER SYSTEM SET fal_server='prod_sty';

System altered


SQL> show parameter DB_FILE_NAME_CONVERT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string

SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/disk02','/disk01' SCOPE=SPFILE;

System altered.

SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/FRA','/FRA','/disk02','/disk01'  SCOPE=SPFILE;

System altered.

SQL> show parameter STANDBY_FILE_MANAGEMENT

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      MANUAL

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

System altered.

Step: 5
===========================================================
Setting up listener file to add static entry of Primary  ( @Primary  Site).
-----------------------------------------------------------------------------------------------------

LISTENER_PROD =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1522))
    )
  )

SID_LIST_LISTENER_PROD =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = prod)
    )
  )

*********************************************************************
Remark: First stop dynamic listener the start static listener 
*********************************************************************

[oracle@source admin]$ lsnrctl stop

[oracle@source admin]$ lsnrctl start LISTENER_PROD


Step: 6
=============================================================
Setting up  tnsname.ora file with following configuration ( @Primary Site).
---------------------------------------------------------------------------------------------------------


PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
    )
  )

#######################################################################

PROD_STY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.102)(PORT = 1527))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod_sty)
    )
  )


Step: 7
===================================================================
Transfer password file to standby dbs location  via scp command ( @Primary Site).
--------------------------------------------------------------------------------------------------------------------

[oracle@dell ~]$ cd /u01/app/oracle/porduct/11.2.0/db_1/dbs/

[oracle@dell dbs]$ ls -lrth orapwprod

-rw-r----- 1 oracle oinstall 1.5K Oct 10 18:53 orapwprod

[oracle@dell stby]$ scp orapwprod oracle@192.168.56.102:/u01/app/oracle/product/11.2.0/db_1/dbs

The authenticity of host '192.168.56.102 (192.168.56.102)' can't be established.
RSA key fingerprint is 49:bf:88:ea:da:29:80:0e:36:68:e4:9c:79:68:02:21.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.56.102' (RSA) to the list of known hosts.
oracle@192.168.56.102's password:

orapwprod                            1536     1.5KB/s   00:00



*************
Standby Site:
*************

Step: 8
============================================================
Edit listener file to add static entry of standby instance  ( @Standby  Site).
--------------------------------------------------------------------------------------------------------

LISTENER_PROD_STY =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.102)(PORT = 1527))
    )
  )

SID_LIST_LISTENER_PROD_STY =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = prod_sty)
    )
  )


Step: 9
=====================================================
Start your listener  and Check listener status ( @Standby  Site).
-------------------------------------------------------------------------------------------

[oracle@target admin]$ lsnrctl start LISTENER_PROD_STY

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 31-JUL-2017 23:30:28

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/target/listener_prod_sty/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.102)(PORT=1527)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.102)(PORT=1527)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_PROD_STY
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                31-JUL-2017 23:30:28
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/target/listener_prod_sty/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.102)(PORT=1527)))
Services Summary...
Service "prod_sty" has 1 instance(s).
  Instance "prod_sty", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully



Step: 10
===========================================
Edit tnsname.ora file to add entry  ( @Standby  Site).
--------------------------------------------------------------------------

vi this file via oracle user "/u01/app/oracle/DELLuct/11.2.0/db_1/network/admin/tnsnames.ora"



PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
    )
  )
######################################################################

PROD_STY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.102)(PORT = 1527))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod_sty)
    )
  )

Step: 11
=========================================================
Create directory structure adump via oracle user   ( @Standby  Site).
---------------------------------------------------------------------------------------------------
[oracle@dell-dr opt]$ mkdir -p /u01/app/oracle/admin/prod_sty/adump
[oracle@target dbs]$ mkdir -p /disk02/prod/prod
[oracle@target dbs]$ mkdir -p /FRA/prod_sty

Step: 12
==========================================================================================
Make a copy of password file "orapwdell" of with the name of standby db_unique_name of "orapwdell_dr"   ( @Standby  Site).
---------------------------------------------------------------------------------------------------------------------------------------------------------------

[oracle@dell-dr dbs]$ mv orapwprod orapwprod_sty

Step: 13
======================================================================
Make a dummy initdell_dr.ora pfile with only to parameter.  ( @Standby  Site).
---------------------------------------------------------------------------------------------------------------------

[oracle@dell-dr dbs]$ vi prod_sty.ora

db_unique_name='prod_dr'
db_name='prod'


Step: 14
=======================================================================
Set the environment for standby server like SID & ORACLE_HOME ( @Standby  Site).
--------------------------------------------------------------------------------------------------------------------------

vi /etc/oratab

prod_sty:/u01/app/oracle/product/11.2.0/db_1:N

:wq


[oracle@target dbs]$ . oraenv
ORACLE_SID = [test] ? prod_sty
The Oracle base remains unchanged with value /u01/app/oracle


Step: 15
==========================================================================================
Connect with sqlplus with sysdba & startup instance in "NOMOUNT" state with dummy pfile.  ( @Standby  Site).
-----------------------------------------------------------------------------------------------------------------------------------------------------------

[oracle@target ~]$ . oraenv
ORACLE_SID = [oracle] ? prod_sty
The Oracle base has been set to /u01/app/oracle
[oracle@target dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 31 23:38:18 2017

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

Connected to an idle instance.

SQL> STARTUP NOMOUNT PFILE='/u01/app/oracle/product/11.2.0/db_1/dbs/initprod_sty.ora'
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size                  2251816 bytes
Variable Size             159384536 bytes
Database Buffers           50331648 bytes
Redo Buffers                5189632 bytes
SQL>



Step: 16
============================================================
Open duplicate session and connect with rman   ( @Standby  Site).
-------------------------------------------------------------------------------------------------------

[oracle@target ~]$ rman TARGET sys/sys@PROD AUXILIARY sys/sys@PROD_STY

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jul 31 23:39:39 2017

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

connected to target database: PROD (DBID=362197903)
connected to auxiliary database: PROD (not mounted)

RMAN>

Step: 17
======================================================
Run the following script at rman prompt   ( @Standby  Site).
---------------------------------------------------------------------------------------------

run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;

duplicate target database for standby from active database
spfile
  parameter_value_convert 'prod','prod_sty'
  set db_unique_name='prod_sty'
  set db_file_name_convert='/disk01','/disk02'
  set log_file_name_convert='/FRA','/FRA','/disk01','/disk02'
  set control_files='/disk02/prod/prod/controlfile_01.ctl'
  set log_archive_max_processes='5'
  set fal_client='prod_sty'
  set fal_server='prod'
  set standby_file_management='AUTO'
  set log_archive_config='dg_config=(prod_sty,prod)'
  set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
  set log_archive_dest_2='service=prod NOAFFIRM ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prod'
  NOFILENAMECHECK;
}


Example :
**********

RMAN> run {
2> allocate channel prmy1 type disk;
3> allocate channel prmy2 type disk;
4> allocate channel prmy3 type disk;
5> allocate channel prmy4 type disk;
6> allocate auxiliary channel stby type disk;
7>
8> duplicate target database for standby from active database
9> spfile
10>   parameter_value_convert 'prod','prod_sty'
11>   set db_unique_name='prod_sty'
12>   set db_file_name_convert='/disk01','/disk02'
13>   set log_file_name_convert='/FRA','/FRA','/disk01','/disk02'
14>   set control_files='/disk02/prod/prod/controlfile_01.ctl'
15>   set log_archive_max_processes='5'
16>   set fal_client='prod_sty'
17>   set fal_server='prod'
18>   set standby_file_management='AUTO'
19>   set log_archive_config='dg_config=(prod_sty,prod)'
20>   set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
21>   set log_archive_dest_2='service=prod NOAFFIRM ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prod'
22>   NOFILENAMECHECK;
23> }

using target database control file instead of recovery catalog
allocated channel: prmy1
channel prmy1: SID=43 device type=DISK

allocated channel: prmy2
channel prmy2: SID=46 device type=DISK

allocated channel: prmy3
channel prmy3: SID=42 device type=DISK

allocated channel: prmy4
channel prmy4: SID=44 device type=DISK

allocated channel: stby
channel stby: SID=20 device type=DISK

Starting Duplicate Db at 01-AUG-17

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwprod' auxiliary format
 '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwprod_sty'   targetfile
 '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileprod.ora' auxiliary format
 '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileprod_sty.ora'   ;
   sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileprod_sty.ora''";
}
executing Memory Script

Starting backup at 01-AUG-17
Finished backup at 01-AUG-17

sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileprod_sty.ora''

contents of Memory Script:
{
   sql clone "alter system set  audit_file_dest =
 ''/u01/app/oracle/admin/prod_sty/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_recovery_file_dest =
 ''/FRA/prod_sty'' comment=
 '''' scope=spfile";
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=prod_styXDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''prod_sty'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''/disk01'', ''/disk02'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''/FRA'', ''/FRA'', ''/disk01'', ''/disk02'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/disk02/prod/prod/controlfile_01.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_max_processes =
 5 comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_client =
 ''prod_sty'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''prod'' comment=
 '''' scope=spfile";
   sql clone "alter system set  standby_file_management =
 ''AUTO'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_config =
 ''dg_config=(prod_sty,prod)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 ''LOCATION=USE_DB_RECOVERY_FILE_DEST'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =
 ''service=prod NOAFFIRM ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prod'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  audit_file_dest =  ''/u01/app/oracle/admin/prod_sty/adump'' comment= '''' scope=spfile

sql statement: alter system set  db_recovery_file_dest =  ''/FRA/prod_sty'' comment= '''' scope=spfile

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=prod_styXDB)'' comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''prod_sty'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''/disk01'', ''/disk02'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''/FRA'', ''/FRA'', ''/disk01'', ''/disk02'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/disk02/prod/prod/controlfile_01.ctl'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''prod_sty'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''prod'' comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_config =  ''dg_config=(prod_sty,prod)'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''LOCATION=USE_DB_RECOVERY_FILE_DEST'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_2 =  ''service=prod NOAFFIRM ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prod'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1653518336 bytes

Fixed Size                     2253784 bytes
Variable Size               1006636072 bytes
Database Buffers             637534208 bytes
Redo Buffers                   7094272 bytes
allocated channel: stby
channel stby: SID=18 device type=DISK

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

Starting backup at 01-AUG-17
channel prmy1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_prod.f tag=TAG20170801T001239 RECID=6 STAMP=950832760
channel prmy1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 01-AUG-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
 "/disk02/prod/prod/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/disk02/prod/prod/system01.dbf";
   set newname for datafile  2 to
 "/disk02/prod/prod/sysaux01.dbf";
   set newname for datafile  3 to
 "/disk02/prod/prod/undotbs01.dbf";
   set newname for datafile  4 to
 "/disk02/prod/prod/users01.dbf";
   set newname for datafile  5 to
 "/disk02/prod/prod/example01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/disk02/prod/prod/system01.dbf"   datafile
 2 auxiliary format
 "/disk02/prod/prod/sysaux01.dbf"   datafile
 3 auxiliary format
 "/disk02/prod/prod/undotbs01.dbf"   datafile
 4 auxiliary format
 "/disk02/prod/prod/users01.dbf"   datafile
 5 auxiliary format
 "/disk02/prod/prod/example01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 01-AUG-17
channel prmy1: starting datafile copy
input datafile file number=00001 name=/disk01/prod/prod/system01.dbf
channel prmy2: starting datafile copy
input datafile file number=00002 name=/disk01/prod/prod/sysaux01.dbf
channel prmy3: starting datafile copy
input datafile file number=00005 name=/disk01/prod/prod/example01.dbf
channel prmy4: starting datafile copy
input datafile file number=00003 name=/disk01/prod/prod/undotbs01.dbf
output file name=/disk02/prod/prod/undotbs01.dbf tag=TAG20170801T001246
channel prmy4: datafile copy complete, elapsed time: 00:00:16
channel prmy4: starting datafile copy
input datafile file number=00004 name=/disk01/prod/prod/users01.dbf
output file name=/disk02/prod/prod/users01.dbf tag=TAG20170801T001246
channel prmy4: datafile copy complete, elapsed time: 00:00:15
output file name=/disk02/prod/prod/example01.dbf tag=TAG20170801T001246
channel prmy3: datafile copy complete, elapsed time: 00:01:21
output file name=/disk02/prod/prod/sysaux01.dbf tag=TAG20170801T001246
channel prmy2: datafile copy complete, elapsed time: 00:01:31
output file name=/disk02/prod/prod/system01.dbf tag=TAG20170801T001246
channel prmy1: datafile copy complete, elapsed time: 00:01:41
Finished backup at 01-AUG-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=6 STAMP=950832867 file name=/disk02/prod/prod/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=950832867 file name=/disk02/prod/prod/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=950832867 file name=/disk02/prod/prod/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=950832867 file name=/disk02/prod/prod/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=950832867 file name=/disk02/prod/prod/example01.dbf
Finished Duplicate Db at 01-AUG-17
released channel: prmy1
released channel: prmy2
released channel: prmy3
released channel: prmy4
released channel: stby

RMAN>


Loging to Sqlplus and create standby log, First count online redo log on primary and create standby log on primary +1, means if primary have N online redo log then @ standby you have to create N+1
*********************************************************************************


SQL> ALTER DATABASE ADD STANDBY LOGFILE '/disk02/prod/prod/standby_redo_01.log' size 52M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '/disk02/prod/prod/standby_redo_02.log' size 52M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '/disk02/prod/prod/standby_redo_03.log' size 52M;

Database altered.

SQL> ALTER DATABASE ADD STANDBY LOGFILE '/disk02/prod/prod/standby_redo_04.log' size 52M;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Database altered.


Standy Created Now check it's details:
**************************************


NAME      INSTANCE_NAME    HOST_NAME            DATABASE_ROLE        LOG_MODE        LOGINS     OPEN_MODE       STARTUP_TIME         VERSION
--------- ---------------- -------------------- -------------------- --------------- ---------- --------------- -------------------- -----------------
PROD      prod_sty         target.localdomain   PHYSICAL STANDBY     ARCHIVELOG      ALLOWED    MOUNTED         2017:08:01 00:12:37  11.2.0.4.0


Keep it in recovery:
****************

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Verifications : On Standby:

SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

On Primary :

Do some redo log switches

SQL> ALTER SYSTEM SWITCH LOGFILE;

On Standby:

  Verify that the recent archived log file is shifted to standby side and applied with the following commands.

SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

Other Useful Information:


To Cancel the Standby Recovery Mode:

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Useful commands To Troubleshoot:

select message from v$dataguard_status where dest_id = 2;
select archived_thread#, archived_seq#, applied_thread#, applied_seq# from v$archive_dest_status;
select registrar, creator, thread#, sequence#, first_change#, next_change# from v$archived_log;
select thread#, sequence#, first_change#, next_change# from v$log_history;

To Verify Recover Process On Standby:

select thread#, sequence# from v$log where status='CURRENT';  (On Primary)

select thread#, sequence#, status from v$managed_standby where process=’MRP0';  (On Standby)`