Yesterday I have started RMAN restore and recovery session of my 70 GB Oracle Apps 12.1.3 RAC database in the run block and went to sleep.
When I saw it in the morning, the script got terminated because of some syntax error in the run block. So the whole night has been wasted because of a simple syntax error.
I was checking for any tools in RMAN which can do a syntax check and fortunately I was able to locate the "checksyntax" command which is available from 10g onwards.
One of the powerful commands in RMAN which can be used to check the syntax of big rman scripts which runs for a long time, before start the script we can check the syntax of the script and run it without worrying of the termination of scripts with syntax errors.
Eg:
$ rman checksyntax
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Dec 23 15:21:32 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
RMAN>
RMAN> recover data;
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: "copy, clone, database, datafile, datafilecopy, device, standby, tablespace"
RMAN-01008: the bad identifier was: data
RMAN-01007: at line 1 column 9 file: standard input
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: "allocate, alter, backup, beginline, blockrecover, catalog, change, connect, copy, convert, create, cross check, configure, duplicate, debug, delete, drop, exit, endinline, flashback, ho st, {, library, list, mount, open, print, quit, recover, register, release, replace, report, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, switch, spool, startup, shutdown, send, show, test, transport, upgrade , unregister, validate"
RMAN-01007: at line 1 column 13 file: standard input
RMAN>
RMAN> recover database
2> ;
The command has no syntax errors