Unix Oracle Create a Data Guard Standby with nohup and a here document

Unix Oracle Create a Data Guard Standby with nohup and a here document.
So why do a nohup and here doc with rman?
Answer: If you get disconnected from your session (SSH, Telnet whatever) the man duplicate continues to run – the “nohup” and “&” do that.
The here doc (<<EOF and EOF) just feeds the “nohup” the input.

# rman create standby nohup with here document
nohup rman log createsby.log <<EOF &
#
# no connect on command line option
connect TARGET sys/pw@ggtarget;
connect AUXILIARY sys/pw@ggtargetsby;
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER
NOFILENAMECHECK;
exit;
EOF

By the way, while I was testing this I got an ora-19909 because when I was testing I did not clean up old archivelog from a previous test – a completely un-related error but an error / show stopper none the less.
So, lesson learned, when you retest a create DG duplicate for standby.  Do the following general steps:

  1. drop the old standby DB (hint: startup mount restrict; drop database;)
  2. cd to the FRA/archivelogs and rm -R * 

I missed the 2nd step and there was old archivelogs & and standby logs (it’s going to be a snapshot standby – they can generate both).
Once I cleaned up / deleted that old standby, I re-ran the nohup with the here doc above and it worked like a charm – with no risk of dying in the middle of the job because of a lost SSH connection.

Scroll to Top