And definitely use ksh, not bash (since the original was ksh)
From: oracle-l-bounce@xxxxxxxxxxxxx <oracle-l-bounce@xxxxxxxxxxxxx> On Behalf
Of Ruan Linehan
Sent: Thursday, July 23, 2020 3:50 PM
To: sbecker6925@xxxxxxxxx
Cc: Sayan Malakshinov <xt.and.r@xxxxxxxxx>; oracle-l <oracle-l@xxxxxxxxxxxxx>
Subject: Re: Problem with shell script to duplicate a database from active
database
CAUTION: This email originated from outside of the organization. Do not follow
guidance, click links, or open attachments unless you recognize the sender and
know the content is safe.
Hi Sandra,
Can you try...
<< EOF >> $LOG_FILE
Regards,
Ruan
On Thu, Jul 23, 2020 at 11:33 PM Sandra Becker
<sbecker6925@xxxxxxxxx<mailto:sbecker6925@xxxxxxxxx>> wrote:
I tried both ways and they both fail with the same errors. I have been trying
to research the stty error, but I don't really understand what I'm reading.
Shell scripting is not my strong suit.
stty: standard input: Inappropriate ioctl for device
./sjb.ksh[11]: EOF: cannot open [No such file or directory]
./sjb.ksh[12]: run: not found [No such file or directory]
./sjb.ksh[13]: allocate: not found [No such file or directory]
./sjb.ksh[14]: allocate: not found [No such file or directory]
./sjb.ksh[15]: allocate: not found [No such file or directory]
./sjb.ksh[16]: allocate: not found [No such file or directory]
./sjb.ksh[17]: allocate: not found [No such file or directory]
./sjb.ksh[18]: allocate: not found [No such file or directory]
./sjb.ksh[19]: allocate: not found [No such file or directory]
./sjb.ksh[20]: allocate: not found [No such file or directory]
./sjb.ksh[21]: duplicate: not found [No such file or directory]
./sjb.ksh[22]: nofilenamecheck: not found [No such file or directory]
./sjb.ksh[23]: dorecover: not found [No such file or directory]
./sjb.ksh[25]: release: not found [No such file or directory]
./sjb.ksh[26]: release: not found [No such file or directory]
./sjb.ksh[27]: release: not found [No such file or directory]
./sjb.ksh[28]: release: not found [No such file or directory]
./sjb.ksh[29]: release: not found [No such file or directory]
./sjb.ksh[30]: release: not found [No such file or directory]
./sjb.ksh[31]: release: not found [No such file or directory]
./sjb.ksh[32]: release: not found [No such file or directory]
./sjb.ksh: line 32: syntax error at line 33: `}' unexpected
Sandy
On Thu, Jul 23, 2020 at 4:26 PM Sayan Malakshinov
<xt.and.r@xxxxxxxxx<mailto:xt.and.r@xxxxxxxxx>> wrote:
Though usually I specify output before input, ie
cmd... >> $LOG_FILE <EOF
...
EOF
пт, 24 июл. 2020 г., 1:23 Sayan Malakshinov
<xt.and.r@xxxxxxxxx<mailto: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<mailto: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.
--
Sandy B.