Tuesday 30 July 2019

Recover archive gaps in standby database

Using 2 MethodsManually Log Shipping (when the missing logs are very less approx 100)
  1. Performing Incremental Backup (When there is a very huge gap)
 METHOD 1:When the logs missing or corrupt is less in number (say below 15), we can ship the logs which were missing in the standby site from the primary site (scp/sftp/ftp) and then we can register the log file in the standby so that the gap can be resolved.This is easy process if you have missing or corrupt logs in lesser number.Otherwise we can use the incremental backup strategy, and perform the recovery at standby site.Lets go through the Archive log Shipping processFirst, Find the archives which are missing by issuing the following command. This would give the gap sequencesSQL> select * from v$archive_gapOr you can use the v$managed_standby view to find where the log apply stuck.SQL> select sequence#,process,status from v$managed_standby; Now, Copy the logs to the standby site from the primary siteUsing the below command$ scp log_file_name_n.arc oracle@standby:/log/file/location/log_file_name_n.arc At standby site, Do the log file registration at the standby site until all the missing log files are registered, Use this below command.SQL> alter database register logfile '/log/file/location/log_file_name_n.arc'; Now apply would take place and your standby will become sync with the primary.METHOD 2 :when the difference is huge (say around 500 logs) the above method is very time consuming and not a proper approach. Else you have to rebuild the standby database from scratch.As an enhancement from 10g, an incremental backup created with BACKUP INCREMENTAL... FROM SCN can be used to refresh the standby database with changes at the primary database since the last SCN at Standby and then managed recovery can resume. Step 1:Use this below command to find the SCN difference, on both the database – Primary DB & Standby DBSQL> select current_scn from v$database;Step 2 :Stop the managed standby apply process:SQL> alter database recover managed standby database cancel;Step 3:Now Shutdown the standby databaseSQL> shut immediateStep 4:On the primary, take an incremental backup from the SCN number where the standby has been stuck:RMAN> run {allocate channel c1 type disk format '/u01/backup/%U.bkp';backup incremental from scn ********* database;}Step 5: On the primary, create a new standby controlfile and copy this file to standby side:SQL> alter database create standby controlfile as '/u01/backup/for_standby.ctl';$ scp * oracle@dataguard : /u01/backupStep 6 :Bring up the Standby instance in nomount mode:SQL> startup nomountStep 7Now, replace the previous controlfile with this new one created at primary , and Bring the database to MOUNT state.(Because, this Primary Side control file has the information of the SCN and we have to perform the recovery using this controlfile)SQL> alter database mount standby database;Step 8 :Open the RMAN prompt and Catalog the backup piece.(Because , RMAN does not know about these files yet; so you must let it know – by a process called cataloging)$ rman target=/RMAN> catalog start with '/u01/backup'; Step 9 :Recover these files:RMAN> recover database;Step 10 :After performing the recovery , exit RMAN and start managed recovery process:SQL> alter database recover managed standby database disconnect from session;Step 11 :Again Check the SCN’s in primary and standby to make sure that both are in SYNc:SQL> select current_scn from v$database;ThanksSrini

Sunday 28 July 2019

Awk (Aho, Weinberger, Kernighan) ans Sed (stream editor) commands


Unix Sed And Awk Text Processing Utilities

Unix provides sed and awk as two text processing utilities that work on a line-by-line basis. The sed program (stream editor) works well with character-based processing, and the awk program (Aho, Weinberger, Kernighan) works well with delimited field processing.
Both use regular expressions to find patterns and support commands to process the matches.
Commandawk – this command is a useful and powerful command used for pattern matching as well as for text processing.
Common Syntaxawk [options] ‘program text’ file
Example$ls -l | awk ‘{print $3}’
This command will display only the third column from the long listing of files and directories.
Commandsed – this is a powerful command for editing a ‘stream’ of text. It can read input from a text file or from piped input, and process the input in one pass..
Common Syntaxsed[OPTION]…..[-f][file]
Example1sed -n ‘/hello/p’ file1
This command will display all the lines which contains hello
Example2sed ‘s/hello/HELLO/’ file1
This command will substitute hello with HELLO everywhere in the file.
Example3sed ‘/hello/,+2d’ file1
This command will delete the two lines starting with the first match of ‘hello’





Awk is a scripting language used for manipulating data and generating reports.The awk command programming language requires no compiling, and allows the user to use variables, numeric functions, string functions, and logical operators.
Awk is a utility that enables a programmer to write tiny but effective programs in the form of statements that define text patterns that are to be searched for in each line of a document and the action that is to be taken when a match is found within a line. Awk is mostly used for pattern scanning and processing. It searches one or more files to see if they contain lines that matches with the specified patterns and then performs the associated actions.
Awk is abbreviated from the names of the developers – Aho, Weinberger, and Kernighan.
WHAT CAN WE DO WITH AWK ?
1. AWK Operations:
(a) Scans a file line by line
(b) Splits each input line into fields
(c) Compares input line/fields to pattern
(d) Performs action(s) on matched lines
2. Useful For:
(a) Transform data files
(b) Produce formatted reports
3. Programming Constructs:
(a) Format output lines
(b) Arithmetic and string operations
(c) Conditionals and loops
Syntax:
awk options 'selection _criteria {action }' input-file > output-file
Options:
-f program-file : Reads the AWK program source from the file 
                  program-file, instead of from the 
                  first command line argument.
-F fs            : Use fs for the input field separator
Sample Commands
Example:
Consider the following text file as the input file for all cases below.
$cat > employee.txt 
ajay manager account 45000
sunil clerk account 25000
varun manager sales 50000
amit manager account 47000
tarun peon sales 15000
deepak clerk sales 23000
sunil peon sales 13000
satvik director purchase 80000 
1. Default behavior of Awk : By default Awk prints every line of data from the specified file.
$ awk '{print}' employee.txt
Output:
ajay manager account 45000
sunil clerk account 25000
varun manager sales 50000
amit manager account 47000
tarun peon sales 15000
deepak clerk sales 23000
sunil peon sales 13000
satvik director purchase 80000 
In the above example, no pattern is given. So the actions are applicable to all the lines. Action print without any argument prints the whole line by default, so it prints all the lines of the file without failure.
2. Print the lines which matches with the given pattern.
$ awk '/manager/ {print}' employee.txt 
Output:
ajay manager account 45000
varun manager sales 50000
amit manager account 47000 
In the above example, the awk command prints all the line which matches with the ‘manager’.
3. Spliting a Line Into Fields : For each record i.e line, the awk command splits the record delimited by whitespace character by default and stores it in the $n variables. If the line has 4 words, it will be stored in $1, $2, $3 and $4 respectively. Also, $0 represents the whole line.
$ awk '{print $1,$4}' employee.txt 
Output:
ajay 45000
sunil 25000
varun 50000
amit 47000
tarun 15000
deepak 23000
sunil 13000
satvik 80000 
In the above example, $1 and $4 represents Name and Salary fields respectively.
Built In Variables In Awk
Awk’s built-in variables include the field variables—$1, $2, $3, and so on ($0 is the entire line) — that break a line of text into individual words or pieces called fields.
NR: NR command keeps a current count of the number of input records. Remember that records are usually lines. Awk command performs the pattern/action statements once for each record in a file.
NF: NF command keeps a count of the number of fields within the current input record.
FS: FS command contains the field separator character which is used to divide fields on the input line. The default is “white space”, meaning space and tab characters. FS can be reassigned to another character (typically in BEGIN) to change the field separator.
RS: RS command stores the current record separator character. Since, by default, an input line is the input record, the default record separator character is a newline.
OFS: OFS command stores the output field separator, which separates the fields when Awk prints them. The default is a blank space. Whenever print has several parameters separated with commas, it will print the value of OFS in between each parameter.
ORS: ORS command stores the output record separator, which separates the output lines when Awk prints them. The default is a newline character. print automatically outputs the contents of ORS at the end of whatever it is given to print.
Examples:
Use of NR built-in variables (Display Line Number)
$ awk '{print NR,$0}' employee.txt 
Output:
1 ajay manager account 45000
2 sunil clerk account 25000
3 varun manager sales 50000
4 amit manager account 47000
5 tarun peon sales 15000
6 deepak clerk sales 23000
7 sunil peon sales 13000
8 satvik director purchase 80000 
In the above example, the awk command with NR prints all the lines along with the line number.
Use of NF built-in variables (Display Last Field)
$ awk '{print $1,$NF}' employee.txt 
Output:
ajay 45000
sunil 25000
varun 50000
amit 47000
tarun 15000
deepak 23000
sunil 13000
satvik 80000 
In the above example $1 represents Name and $NF represents Salary. We can get the Salary using $NF , where $NF represents last field.
Another use of NR built-in variables (Display Line From 3 to 6)
$ awk 'NR==3, NR==6 {print NR,$0}' employee.txt 
Output:
3 varun manager sales 50000
4 amit manager account 47000
5 tarun peon sales 15000
6 deepak clerk sales 23000 
More Examples
For the given text file:
$cat > geeksforgeeks.txt

A    B    C
Tarun    A12    1
Man    B6    2
Praveen    M42    3
1) To print the first item along with the row number(NR) separated with ” – “ from each line in geeksforgeeks.txt:
$ awk '{print NR "- " $1 }' geeksforgeeks.txt
1 - Tarun
2 – Manav    
3 - Praveen
2) To return the second row/item from geeksforgeeks.txt:
$ awk '{print $2}' geeksforgeeks.txt
A12
B6
M42
3) To print any non empty line if present
$ awk 'NF > 0' geeksforgeeks.txt
0
4) To find the length of the longest line present in the file:
$ awk '{ if (length($0) > max) max = length($0) } END { print max }' geeksforgeeks.txt
13
5) To count the lines in a file:
$ awk 'END { print NR }' geeksforgeeks.txt
3
6) Printing lines with more than 10 characters:
$ awk 'length($0) > 10' geeksforgeeks.txt
Tarun    A12    1
Praveen    M42    3
7) To find/check for any string in any column:
$ awk '{ if($3 == "B6") print $0;}' geeksforgeeks.txt
8) To print the squares of first numbers from 1 to n say 6:
$ awk 'BEGIN { for(i=1;i<=6;i++) print "square of", i, "is",i*i; }'
square of 1 is 1
square of 2 is 4
square of 3 is 9
square of 4 is 16
square of 5 is 25
square of 6 is 36

Thanks
Srini

Thursday 25 July 2019

SSO on EBS R12.1.3 Post clone Steps


EBS R12.1.3 Post clone SSO setup..

Description ::

Login to application Server :

1. Remove all references to Prod SSO using txkrun.pl script.

Ex: $FND_TOP/bin/txkrun.pl \ -script=SetSSOReg \ -removereferances=yes \ -appspass=*** \

2. set the user_guid to null in FND_USER table.

Ex: sql> update fnd_user set user_guid=null;

sql> commit;

3. Register the External Node and Generate the Desktop DBC File:

cd $FND_SECURE,  Verify the .dbc file exists or not.

cd $JAVA_TOP

run the below command :
--------------------------

java oracle.apps.fnd.security.AdminDesktop apps/$Apps_pass \  CREATE \ NODE_NAME=**** \ DBC=$FND_SECURE/***.dbc

note: copy the generated dbc file from $JAVA_TOP to $FND_SECURE


4. Register OID with EBS :

for this process we need to register instance first then register the OID with EBS..

a) Register Instance :

$FND_TOP/bin/txkrun.pl \ -script=SetSSOReg \ -registerinstance=yes \ -infradbhost=***** \ -ldapport=*** \ -ldapportssl=***1 \ -ladphost=**** \ -oidadminuser=cn=orcladmin \ -oidadminuserpas=***  \ -appspass=*** \

b) Register OID :

$FND_TOP/bin/txkrun.pl \ -script=SetSSOReg \ -registeroid=yes \ ldapport=*** \  -ladphost=**** \ -oidadminuser=cn=orcladmin \ -oidadminuserpas=***  \ -appspass=*** \ -instpass=**** \ -provisiontype=2\


5. Profile options update ...

Application authenticate agent   :  hostname ( default null )

Application SSO Type :  SSWA w/SSO    ( Default SSWA )

Application SSO Login Type : both ( default local )

Link Application user with OID user with the same user : Enable ( Default Null)

Application SSO auto link user : enable ( default null)

Application SSO LDAP Synchronization : Enabled ( default Enabled ).

Application single sign on Hint Cookie Name : blank  ( default ORASSO_AUTG_HIT)..



post these steps  check the users and groups status and do the network level checks.


Thanks
Srini


Oracle 19c Data Guard Physical Standby Step by Step configuration details.



Description:-
In this is the article we are going to see step-by-step to create a physical standby  database using RMAN in Oracle Database 19c.

Parameters needs to configure both side for Dataguard,
PRIMARY :
[oracle@trichy ~]$ . oraenv

ORACLE_SID = [cdb1] ? prod

The Oracle base remains unchanged with value /u01/app/oracle

[oracle@trichy ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jun 15 09:14:12 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup

ORACLE instance started.
Total System Global Area 2415917880 bytes
Fixed Size      8899384 bytes
Variable Size    520093696 bytes
Database Buffers  1879048192 bytes
Redo Buffers      7876608 bytes
Database mounted.
Database opened.
Make sure primary is in archivelog mode
SQL> archive log list

Database log mode             Archive Mode
Automatic archival            Enabled
Archive destination           USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     4
Next log sequence to archive   6
Current log sequence           6

Primary side:
Check FORCE LOGGING is enabled,
SQL> select force_logging from v$database;

FORCE_LOGGING
----------------
NO

SQL> alter database force logging;
Database altered.

SQL> select force_logging from v$database;

FORCE_LOGGING
----------------
YES

SQL> alter system set log_archive_config='dg_config=(PROD,STANDBY)';
System altered.

SQL> alter system set log_archive_dest_1='location=/u01/archive valid_for=(all_logfiles,primary_role)';
System altered.

SQL> alter system set log_archive_dest_2='service=STANDBY lgwr async noaffirm valid_for=(all_logfiles,primary_role) db_unique_name=STANDBY';
System altered.

SQL> alter system set log_archive_dest_state_2=enable;
System altered.
SQL> alter system set log_archive_dest_state_1=enable;
System altered.

SQL> alter system set remote_login_passwordfile=exclusive scope=spfile;
System altered.

SQL> alter system set standby_file_management=auto;
System altered.

SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
System altered.

SQL> alter system set log_archive_max_processes=10;
System altered.

SQL> alter system set db_unique_name=PROD scope=spfile;
System altered.

SQL> alter system set fal_client=PROD;
System altered.

SQL> alter system set fal_server=STANDBY;
System altered.

SQL> shut immediate

Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup

SQL> create pfile='/home/oracle/initprod.ora' from spfile;

File created.

*.db_unique_name='STANDBY'
*.fal_client='STANDBY'
*.fal_server='PROD'
*.log_archive_config='dg_config=(PROD,STANDBY)'
*.log_archive_dest_1='location=/u01/archive valid_for=(all_logfiles,primary_role)'
*.log_archive_dest_2='service=PROD lgwr async noaffirm valid_for=(all_logfiles,primary_role) db_unique_name=PROD'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=10
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'

[oracle@trichy ~]$ scp -r initprod.ora oracle@192.168.1.14:/u01/app/oracle/product/19.0.0/dbhome_1/dbs

The authenticity of host '192.168.1.14 (192.168.1.14)' can't be established.

ECDSA key fingerprint is SHA256:jU17jN8XF6AHRAi6HsDXnoQdDYXOlScWvmZWxXK+kw8.

ECDSA key fingerprint is MD5:e9:ac:84:59:86:d4:47:ab:e5:ac:89:23:b1:1c:1e:8c.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.1.14' (ECDSA) to the list of known hosts.

oracle@192.168.1.14's password:

initprod.ora                                                                                 100% 1566     1.1MB/s   00:00

[oracle@trichy ~]$ cd /u01/app/oracle/product/19.0.0/dbhome_1/dbs

[oracle@trichy dbs]$ ls

hc_prod.dat  init.ora  lkPROD  orapwprod  spfileprod.ora
Copy password file from primary to standby server,
[oracle@trichy dbs]$ scp -r orapwprod oracle@192.168.1.14:/u01/app/oracle/product/19.0.0/dbhome_1/dbs

oracle@192.168.1.14's password:

orapwprod
Listener and TNS Configuration :-
LISTENER_CONFIG
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD)
(ORACLE_HOME =/u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = prod)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.15 )(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
TNS_CONFIG
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.15)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)

STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.14)(PORT = 1521))

)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
Make the respective directories for standby database,
STANDBY :
[oracle@trichy ~]$ mkdir -p /u01/app/oracle/admin/prod/adump

[oracle@trichy ~]$ mkdir -p /u01/app/oracle/oradata/PROD/

[oracle@trichy ~]$ mkdir -p /u01/app/oracle/fast_recovery_area/PROD/

Edit the parameters in pfile for standby
*.db_unique_name='STANDBY'
*.fal_client='STANDBY'
*.fal_server='PROD'
*.log_archive_config='dg_config=(PROD,STANDBY)'
*.log_archive_dest_1='location=/u01/archive valid_for=(all_logfiles,primary_role)'
*.log_archive_dest_2='service=PROD lgwr async noaffirm valid_for=(all_logfiles,primary_role) db_unique_name=PROD'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=10
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
Listener and TNS Configuration :-
STANDBY_LISTENER_CONFIG
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD)
(ORACLE_HOME =/u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = prod)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.1.14 )(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
STANDBY_TNS_CONFIG
PROD =
DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.15)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
STANDBY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.14)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)
Keep the database in NOMOUNT stage to create standby database,
[oracle@trichy ~]$ . oraenv

ORACLE_SID = [cdb1] ? prod

The Oracle base remains unchanged with value /u01/app/oracle

[oracle@trichy ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jun 15 09:14:12 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.
Total System Global Area 2415917880 bytes
Fixed Size     8899384 bytes
Variable Size   520093696 bytes
Database Buffers  1879048192 bytes
Redo Buffers     7876608 bytes

SQL>
In standby side,check RMAN connection.Connect primary database as TARGET and standby database as AUXILIARY(creating new instance)   

[oracle@trichy dbs]$ rman target sys/oracle@PROD

Recovery Manager: Release 19.0.0.0.0 - Production on Sat Jun 15 10:42:32 2019
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.
connected to target database: PROD (DBID=422602599)

RMAN> connect auxiliary sys/oracle@STANDBY

connected to auxiliary database: PROD (not mounted) 

RMAN> duplicate target database for standby from active database dorecover nofilenamecheck;
Starting Duplicate Db at 15-JUN-19
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=36 device type=DISK
current log archived
contents of Memory Script:
{
backup as copy reuse
passwordfile auxiliary format  '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwprod'   ;
}
executing Memory Script
Starting backup at 15-JUN-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
Finished backup at 15-JUN-19
duplicating Online logs to Oracle Managed File (OMF) location
contents of Memory Script:
{
restore clone from service  'PROD' standby controlfile;
}
executing Memory Script
Starting restore at 15-JUN-19
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
output file name=/u01/app/oracle/oradata/PROD/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/PROD/control02.ctl
Finished restore at 15-JUN-19
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/app/oracle/oradata/PROD/temp01.dbf";
switch clone tempfile all;
set newname for datafile  1 to
"/u01/app/oracle/oradata/PROD/system01.dbf";
set newname for datafile  3 to
"/u01/app/oracle/oradata/PROD/sysaux01.dbf";
set newname for datafile  4 to
"/u01/app/oracle/oradata/PROD/undotbs01.dbf";
set newname for datafile  7 to
"/u01/app/oracle/oradata/PROD/users01.dbf";
restore
from  nonsparse   from service
'PROD'   clone database
;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/PROD/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 15-JUN-19
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:08:04
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:11:23
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:59
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/PROD/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 15-JUN-19
sql statement: alter system archive log current
current log archived
contents of Memory Script:
{
restore clone force from service  'PROD'
archivelog from scn  2187262;
switch clone datafile all;
}
executing Memory Script
Starting restore at 15-JUN-19
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=9
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:09
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: using network backup set from service PROD
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=10
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-JUN-19
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=1011006513 file name=/u01/app/oracle/oradata/PROD/system01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1011006513 file name=/u01/app/oracle/oradata/PROD/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1011006513 file name=/u01/app/oracle/oradata/PROD/undotbs01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=1011006513 file name=/u01/app/oracle/oradata/PROD/users01.dbf
contents of Memory Script:
{
set until scn  2190007;
recover standby
clone database
delete archivelog
;
}

executing Memory Script
executing command: SET until clause
Starting recover at 15-JUN-19
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_9_1010764267.arc
archived log for thread 1 with sequence 10 is already on disk as file /u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_10_1010764267.arc
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_9_1010764267.arc thread=1 sequence=9
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_10_1010764267.arc thread=1 sequence=10
media recovery complete, elapsed time: 00:00:04
Finished recover at 15-JUN-19
contents of Memory Script:
{
delete clone force archivelog all;
}
executing Memory Script
released channel: ORA_DISK_1
released channel: ORA_AUX_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
deleted archived log
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_9_1010764267.arc RECID=1 STAMP=1011006509
deleted archived log
archived log file name=/u01/app/oracle/product/19.0.0/dbhome_1/dbs/arch1_10_1010764267.arc RECID=2 STAMP=1011006510
Deleted 2 objects
Finished Duplicate Db at 15-JUN-19.

Post check status for Standby database,
1.   SQL> select name,database_role,open_mode from v$database;
2.    
3.   NAME DATABASE_ROLE OPEN_MODE
4.   ——— ————-------- ——————–
5.   PROD PHYSICAL STANDBY MOUNTED
6.    
7.    
8.   Enable the recovery:
9.    
10.  SQL> alter database recover managed standby database disconnect from session;
11.   
12.  Database altered.
13.   
14.   
15.  Check the Standby database sync status with primary:
16.   
17.  SELECT ARCH.THREAD# “Thread”, ARCH.SEQUENCE# “Last Sequence Received”, APPL.SEQUENCE# “Last Sequence Applied”, (ARCH.SEQUENCE# – APPL.SEQUENCE#) “Difference” FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;
18.   
19.  Thread Last Sequence Received Last Sequence Applied Difference
20.  ———— ———————————— ———–------------------- ---------------
21.  1 10 10 0



Thanks
Srini