Re: Problem with shell script to duplicate a database from active database

  • From: Sayan Malakshinov <xt.and.r@xxxxxxxxx>
  • To: sbecker6925@xxxxxxxxx
  • Date: Fri, 24 Jul 2020 01:26:09 +0300

Though usually I specify output before input, ie

cmd... >> $LOG_FILE <EOF
...
EOF

пт, 24 июл. 2020 г., 1:23 Sayan Malakshinov <xt.and.r@xxxxxxxxx>:

Hi Sandra,


Shouldn't "<EOF> >> $LOG_FILE" be "<EOF >> $LOG_FILE", ie without extra >
after EOF?

пт, 24 июл. 2020 г., 1:17 Sandra Becker <sbecker6925@xxxxxxxxx>:

I need to create standby databases for several of our existing
databases.  We did this last year for another database and I copied that
lshell script, but it's throwing an error and I can't seem to figure out
what is wrong with it.  This is a RHEL6 OS with Oracle 12.1.0.2.  It tells
me there is an error on the line "rman target..."  It doesn't like the
">>".   These are large databases and my session would time out long before
the script completed, so I need a shell script I can run with nohup.  I
would appreciate any help you can provide.

Error:
line 11: syntax error near unexpected token `>>'
line 11:`rman target sys/pwd01@COMP2 auxiliary sys/pwd01@UCOMP_DB1 <EOF>
$LOG_FILE'

Script:

#!/bin/bash
#set -x
. /home/orcl/db_stdby_db1.ksh

ts=`date +'%Y%m%d%H%M'`
LOG_FILE='/LOGS/COMP/dumps/build_standby_COMP_DB1.log_'${ts}
HOSTNAME=`hostname`
STARTTIME=`date -u '+%Y_%m_%d.%H%M%S'`
echo $STARTTIME > $LOG_FILE

rman target sys/pwd01@COMP2 auxiliary sys/pwd01@COMP_DB1 <EOF> >>
$LOG_FILE
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
allocate auxiliary channel a1 type disk;
allocate auxiliary channel a2 type disk;
allocate auxiliary channel a3 type disk;
allocate auxiliary channel a4 type disk;
duplicate target database for standby from active database
nofilenamecheck
dorecover;

release channel t1;
release channel t2;
release channel t3;
release channel t4;
release channel a1;
release channel a2;
release channel a3;
release channel a4;
}
EOF
exit

-
Sandy B.


Other related posts: