In the case of an RMAN duplicate – whether it is for standby creation or just cloning – remember to immediately disconnect from rman. The rman syntax uses TARGET and AUXILARY in the connect syntax. What can be confusing – is TARGET is the source that you are cloning from and the database you are connected to and AUXILIARY is the database you are creating and it is NOT the database you are connected to – it is the database that gets created.
As a result, keep in mind, after a duplicate command, you are still connected to the target (and that maybe production) – so disconnect from RMAN IMMEDIATELY after a duplicate command to avoid accidentally issuing a command against the WRONG DB. I did this in a sandbox and realized how easy it is to make this mistake. If you did it in production and were not planning for an outage on the primary… that would not be good.
So – in my steps document – I remind myself…
# any commands you run – e.g. shutdown etc. will be performed against the target – DISCONNECT FROM RMAN to avoid executing commands against the wrong DB
# note the rman connect syntax can be used from either side.
rman TARGET sys/pw@ggtarget AUXILIARY sys/pw@ggstby | tee createSby.log
# note there is no spfile file clause or log_convert file name convert – all must be in the standby init.ora and an spfile created prior to running this duplicate below
DUPLICATE TARGET DATABASE
FROM ACTIVE DATABASE
EXIT; # EXIT RMAN Now!
# ****** after a successful duplicate ***** important immediately DISCONNECT from rman – as you are connected to the target db not the standby
# now start sqlplus and start the apply on the standby side
sqlplus / as sysdba
select db_unique_name, open_mode, database_role from v$database;
alter database recover managed standby database using current logfile disconnect; # not using dgmgrl
This applies whether you are just cloning or creating a data guard standby