RMAN script gives error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting RMAN script gives error
# 1  
Old 12-18-2013
RMAN script gives error

Hi,

I have the following RMAN incremental shell script:

Code:
# !/bin/bash

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=$PATH:${ORACLE_HOME}/bin

rman target=/ << EOF
run {
allocate channel d1 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
allocate channel d2 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
allocate channel d3 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';

backup incremental level 1 tag Daily_Diff_Backup
    format '/u01/app/oracle/backup/Daily_%T_L1_%db_df_%U_%t';

sql 'alter system archive log current';
sql 'alter system archive log current';
backup tag ORCL_ARCHIVE
       archivelog all 
       format '/u01/app/oracle/backup/al_%t_%s_p_ARCHIVE' 
       delete all input;

backup tag ORCL_CONTROL
           current controlfile 
           format '/u01/app/oracle/backup/cf_%t_%s_p_CONTROL';

crosscheck archivelog all;
delete noprompt expired archivelog all;
crosscheck backup;
delete noprompt expired backup;

release channel d1;
release channel d2;
release channel d3;
}
EXIT
EOF

And, when I run it, I am getting errors like:
Code:
$ ./rman.sh
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Dec 17 12:17:20 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: CTSDEV (DBID=1899476973)
RMAN>
RMAN> 2> 3> 4> 5> 6> 7> 8> 9>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found ";": expecting one of: "archivelog, as, auxiliary, backupset, backup, 
RMAN-01007: at line 10 column 61 file: standard input

 
RMAN>
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: ";"
RMAN-01008: the bad identifier was: d1
RMAN-01007: at line 2 column 17 file: standard input
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: ";"
RMAN-01008: the bad identifier was: d2
RMAN-01007: at line 1 column 17 file: standard input
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: ";"
RMAN-01008: the bad identifier was: d3
RMAN-01007: at line 1 column 17 file: standard input
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "}": expecting one 
RMAN-01007: at line 1 column 1 file: standard input

Could anyone tell me what error I have made in the script?

Last edited by royalibrahim; 12-18-2013 at 12:12 PM..
# 2  
Old 12-20-2013
The following statement is incomplete:
Code:
backup incremental level 1 tag Daily_Diff_Backup
    format '/u01/app/oracle/backup/Daily_%T_L1_%db_df_%U_%t';

Backup what Smilie? Database?
(in the example below "s" is your script name)
Code:
bash-3.00$ rman checksyntax @s

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Dec 20 14:34:22 2013

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

RMAN> run {
2> allocate channel d1 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
3> allocate channel d2 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
4> allocate channel d3 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
5>
6> backup incremental level 1 tag 'Daily_Diff_Backup'
7>     format '/u01/app/oracle/backup/Daily_%T_L1_%db_df_%U_%t';
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found ";": expecting one of: "archivelog, as, backup, backupset, blocks, channel, check, comma, copy, copies, controlfilecopy, cumulative, current, database, datafile, datafilecopy, device, diskratio, db_recovery_file_dest, db_file_name_convert, duration, filesperset, for, format, full, force, incremental, keep, (, maxsetsize, nochecksum, noexclude, nokeep, not, proxy, pool, reuse, recovery, skip, spfile, setsize, tablespace, tag, to, validate"
RMAN-01007: at line 7 column 57 file: s

Added the keyword database:

Code:
bash-3.00$ rman checksyntax @s

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Dec 20 14:34:52 2013

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

RMAN> run {
2> allocate channel d1 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
3> allocate channel d2 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
4> allocate channel d3 type disk FORMAT '/u01/app/oracle/backup/Daily_%U_%t';
5>
6> backup incremental level 1 tag Daily_Diff_Backup
7>   database
8>     format '/u01/app/oracle/backup/Daily_%T_L1_%db_df_%U_%t';
9>
10> sql 'alter system archive log current';
11> sql 'alter system archive log current';
12> backup tag ORCL_ARCHIVE
13>        archivelog all
14>        format '/u01/app/oracle/backup/al_%t_%s_p_ARCHIVE'
15>        delete all input;
16>
17> backup tag ORCL_CONTROL
18>            current controlfile
19>            format '/u01/app/oracle/backup/cf_%t_%s_p_CONTROL';
20>
21> crosscheck archivelog all;
22> delete noprompt expired archivelog all;
23> crosscheck backup;
24> delete noprompt expired backup;
25>
26> release channel d1;
27> release channel d2;
28> release channel d3;
29> }
30>
The cmdfile has no syntax errors

Recovery Manager complete.

This User Gave Thanks to radoulov For This Post:
# 3  
Old 12-24-2013
Awesome radoulov Smilie for pointing out the glitch.

By the way, the following query is repeated in the script
Code:
sql 'alter system archive log current';

Is that by mistake again? Is just calling one time enough?
# 4  
Old 12-24-2013
One should be sufficient, more do not harm.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help on parsing Oracle RMAN output for string and print sections of a file

Hi, I need some advise on how to print 'sections' of the attached file. I am searching for some that says Marked Corrupt and print some lines after it. At the moment I am running the command below: sed -n -e '/Marked Corrupt/{N;N;p;}' rman_list_validate.txtThis gives me the following... (1 Reply)
Discussion started by: newbie_01
1 Replies

2. Shell Programming and Scripting

Usage of disc group to kick off Oracle RMAN backup

Hi guys, i need a small help. I was writing an automation script for import utility of oracle datapump. I am getting stuck in one part of the shell script where i am doing a grep on one of the filesystem and if it is above threshold then it would kick off an oracle RMAN backup. Fyi. i am grepping... (3 Replies)
Discussion started by: sub
3 Replies

3. Shell Programming and Scripting

RMAN commands inside crontab shell script

Hello I'm trying to write simple script to delete archive logs for RMAN, unfortunately it's not working, I tried two way to do that: #!/bin/ksh echo "Start ....." rman target=/ << EOF RUN { delete force noprompt archivelog until time 'sysdate-10'; } EXIT; EOF echo "END ..." echo... (6 Replies)
Discussion started by: samer.odeh
6 Replies

4. Shell Programming and Scripting

rman script

Hi, Can anyone provide me with RMAN script for taking backup to tape and restoring the same from tape. Thanks (0 Replies)
Discussion started by: chetansingh23
0 Replies

5. UNIX and Linux Applications

Running RMAN backups from grid control but using oracle account with rsa keys vs a password ?

I'm a sysadmin trying to help out one of our DBA's setup the RMAN backups (Oracle 11g on rhel5 ) so they can schedule and control them from the OEM grid control. But we want the oracle user to use ssh keys instead of a password. I have the working rsa keys in place for the user but the GUI seems to... (0 Replies)
Discussion started by: samael00
0 Replies

6. Windows & DOS: Issues & Discussions

Error opening script file - location error

Hello, I know nothing about UNIX, ftp, etc. I am building an excel VBA macro which calls a .bat file. I've taken a pre-existing batch file and am trying to modify it to fit my purposes. I would be very grateful for some assistance. Here is my .bat file: echo off set... (9 Replies)
Discussion started by: starcraftbud
9 Replies

7. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

8. Shell Programming and Scripting

Shell Script for RMAN Backup

Hi Experts, Can anyone help me to write shell script for taking backup with RMAN in oracle 9i or suggests me any site which has this kind of scripts Thanks shaan (1 Reply)
Discussion started by: shaan_dmp
1 Replies
Login or Register to Ask a Question