Databases Reference
In-Depth Information
Solution
To check the syntax of RMAN commands, you must start the RMAN client with the operating system command-line
argument checksyntax . You can easily check the syntax of commands prior to their execution either by entering
them at the command prompt or by reading in the commands through a command file. Here's how you check the
syntax of a single RMAN command ( run {backup database;} ) by first starting the RMAN client with the checksyntax
argument:
[oracle@virtual1 ~]$ rman checksyntax
Recovery Manager: Release 12.1.0.0.2 - Beta on Tue Jul 24 11:00:46 2012
Copyright (c) 1982, 2012, Oracle and/or its affiliates. All rights reserved.
RMAN> run {backup database;}
The command has no syntax errors
RMAN>
In this example, there were no errors in the syntax of the simple run block, and RMAN confirms that. You can
also use the checksyntax argument to check the syntax of RMAN commands that are part of a command file. Simply
specify the checksyntax argument before invoking the command file that consists of the RMAN commands. In the
following example, the file goodcmdfile contains a couple of restore and recovery commands:
$ rman checksyntax @/tmp/goodcmdfile
RMAN> # file with legal syntax
2> restore database;
3> recover database;
4>
The cmdfile has no syntax errors
Recovery Manager complete.
$
You can also open an RMAN session solely for the purpose of checking the syntax of commands that you type
interactively:
$ rman checksyntax
An important point about the checksyntax argument is that you can't use it after starting RMAN. That is,
you can't include the checksyntax argument from the RMAN command line. You must pass checksyntax as an
argument to the rman command when you start the RMAN client and without connecting to any target or recovery
catalog.
How It Works
When you either execute an RMAN command file by preceding it with the checksyntax argument or enter any
RMAN commands after starting RMAN with the checksyntax argument, RMAN won't actually execute any RMAN
commands. RMAN will check and report only on the syntax of those commands. If the RMAN commands that you
type at the command line or that you include as part of a command file have no errors, you get the “The command
 
Search WWH ::




Custom Search