I was looking at the RMAN DEBUG options and came across the CHECKSYNTAX function which I had not used before.
Firstly a quick recap on the DEBUG option.
This can be called using the following syntax
rman target / catalog rman12g1/xxxx@rmancat debug trace=rmantrace.log cmdfile=backup.rcv
or
rman target / catalog rman12g1/xxxx@rmancat debug trace=rmantrace.log then run RMAN> @backup.rcv (or just type in your run block of commands)
There are a number of options to DEBUG and one of the error messages lists them out quite neatly
RMAN-01009: syntax error: found "integer": expecting one of: "all, duplicate, recover, restore, resync, sql"
To be honest if I was tracing I would just stick with the DEBUG=ALL format. The DEBUG=SQL gives all the internal commands that RMAN calls and could be interesting if you were doing a deep dive into RMAN functionality
Anyway, back to the CHECKSYNTAX option.
I run it against the edited version of the command file used above
rman target / catalog rman12g1/xxxx@rmancat checksyntax cmdfile=backup.rcv Recovery Manager: Release 12.1.0.2.0 - Production on Wed Dec 28 10:22:20 2016 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: T12TEST (DBID=1543168240) connected to recovery catalog database
RMAN> run { 2> sql "alter session set nls_date_format=''YYYY-MM-DD:HH24:MI:SS''"; 3> allocate channel c1 device type disk format '/app/oracle/backup/backup_db_%d_S_%s_P_%p_T_%t'; 4> allocate channel c2 device type disk format '/app/oracle/backup/backup_db_%d_S_%s_P_%p_T_%t'; 5> backup database INCLUDE CURRENT CONTROLFILEs; 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: "controlfile" RMAN-01008: the bad identifier was: CONTROLFILEs RMAN-01007: at line 6 column 33 file: backup.rcv
Note the file backup.rcv has a blank line as the first line which confuses the line numbering
Pretty neat. I edit the file and put a different error in, a much more common missing semi-colon
RMAN> run { 2> sql "alter session set nls_date_format=''YYYY-MM-DD:HH24:MI:SS''"; 3> allocate channel c1 device type disk format '/app/oracle/backup/backup_db_%d_S_%s_P_%p_T_%t'; 4> allocate channel c2 device type disk format '/app/oracle/backup/backup_db_%d_S_%s_P_%p_T_%t' 5> backup RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-00558: error encountered while parsing input commands RMAN-01009: syntax error: found "backup": expecting one of: "auxiliary, connect, format, maxopenfiles, maxpiecesize, parms, rate, send, to, comma, ;" RMAN-01007: at line 6 column 1 file: backup.rcv
Overall not a mind-shatteringly exciting find but something that might be of use one day
