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

From: Sandra Becker <sbecker6925_at_gmail.com>
Date: Thu, 23 Jul 2020 16:58:50 -0600
Message-ID: <CAJzM94CW705wD=WJ51kmU-kLNTzGQG337uWHtxB8MZGi+FPi3A_at_mail.gmail.com>



Ruan,

That got me going. Hopefully, I won't run into any other issues.

Thanks everyone,

Sandy

On Thu, Jul 23, 2020 at 4:50 PM Ruan Linehan <ruandav_at_gmail.com> wrote:

> Hi Sandra,
>
> Can you try...
> << EOF >> $LOG_FILE
>
> Regards,
> Ruan
>
> On Thu, Jul 23, 2020 at 11:33 PM Sandra Becker <sbecker6925_at_gmail.com>
> 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_at_gmail.com>
>> wrote:
>>
>>> Though usually I specify output before input, ie
>>>
>>> cmd... >> $LOG_FILE <EOF
>>> ...
>>> EOF
>>>
>>> пт, 24 июл. 2020 г., 1:23 Sayan Malakshinov <xt.and.r_at_gmail.com>:
>>>
>>>> Hi Sandra,
>>>>
>>>>
>>>> Shouldn't "<EOF> >> $LOG_FILE" be "<EOF >> $LOG_FILE", ie without
>>>> extra > after EOF?
>>>>
>>>> пт, 24 июл. 2020 г., 1:17 Sandra Becker <sbecker6925_at_gmail.com>:
>>>>
>>>>> 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_at_COMP2 auxiliary sys/pwd01_at_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_at_COMP2 auxiliary sys/pwd01_at_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.
>>
>>

-- 
Sandy B.

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Jul 24 2020 - 00:58:50 CEST

Original text of this message