RMAN – checksyntax

Starting RMAN with check syntax will check syntax of RMAN command, it will report errors if the syntax is incorrect.

Example:
-- Start RMAN with check syntax option
$ $ORACLE_HOME/bin/rman checksyntax

Recovery Manager: Release 10.2.0.1.0 – Production on Sat Jan 22 19:49:42 2011

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

-- Valid RMAN command, RMAN validates syntax and prints if syntax is correct, it doesn’t run the command
RMAN> run { backup database; }

The command has no syntax errors

-- Invalid RMAN command shows the command has syntax error
RMAN> run {backup databaase; }

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: “archivelog, as,
backup, backupset, blocks, channel, check, copy, copies, controlfilecopy, cumul
ative, 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-01008: the bad identifier was: databaase
RMAN-01007: at line 1 column 13 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, crosscheck, configure, duplicate, debug, delete, drop, exit, endinline, flashback, host, {, 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 22 file: standard input

To check the syntax of a RMAN cmdfile or script file
$ cat /tmp/rmanbackup.cmdfile
run {
backup database;
}

$ $ORACLE_HOME/bin/rman checksyntax @/tmp/rmanbackup.cmdfile

Recovery Manager: Release 10.2.0.1.0 – Production on Sat Jan 22 19:57:08 2011

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

RMAN> run {
2> backup database;
3> }
4>
The cmdfile has no syntax errors

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.