Coskan’s Approach to Oracle

July 30, 2007

Nice RMAN command for double checkers or careless ones

Filed under: Backup/Recovery — coskan @ 2:38 pm

Suppose that, you have a RMAN command file and you are sure about the syntax of the commands you wrote. You scheduled it to run at midnight ( without testing on any test server) on production system, and when you came to office next day you saw that the script failed due to a syntax error. To avoid this kind of errors RMAN of 10G R2 has a new feature to check the syntax before you run them. The command is CHECKSYNTAX, what it does is only check the syntax of the commands you give as an input, also you do not need any target connection to run this command. Lets see how it works

Usage is simple

C:\Documents and Settings\cgundogar>rman checksyntax
Recovery Manager: Release 10.2.0.1.0 – Production on Pzt Tem 30 17:28:29 2007Copyright (c) 1982, 2005, Oracle. All rights reserved.RMAN> backup database;The command has no syntax errors

RMAN> backup datafile;

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: “double-quoted-string, integer, single-quoted-string”

RMAN-01007: at line 1 column 16 file: standard input

for command files you only give the input file and take the result set;

suppose that your command file is like below

run {
allocate channel ch1 type disk;
restore archivelog ;
}

C:\Documents and Settings\cgundogar>rman checksyntax
Recovery Manager: Release 10.2.0.1.0 – Production on Pzt Tem 30 17:28:29 2007Copyright (c) 1982, 2005, Oracle. All rights reserved.RMAN> @rman.txt

RMAN> run {

2> allocate channel ch1 type disk;

3> restore archivelog ;

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: “all, from, high, like, logseq, low, scn, sequence, time, until”

RMAN-01007: at line 3 column 20 file: rman.txt

When you give the correct command the output will be like below

C:\Documents and Settings\cgundogar>rman checksyntax
Recovery Manager: Release 10.2.0.1.0 – Production on Pzt Tem 30 17:28:29 2007Copyright (c) 1982, 2005, Oracle. All rights reserved.RMAN> @rman.txt

RMAN> run {

2> allocate channel ch1 type disk;

3> restore archivelog all;

4> }

The cmdfile has no syntax errors

RMAN>

RMAN> **end-of-file**

References Used:

10G R2 Documentation – Backup and Recovery Basics

About these ads

3 Comments »

  1. Nice tip!

    Comment by Steeve — July 30, 2007 @ 6:36 pm

  2. I wish it could parse the SQL commands too. It would be more nice then.

    Comment by coskan — July 31, 2007 @ 6:54 am

  3. [...] Coskans Approach to Oracle on Nice RMAN command for double checkers or careless ones [...]

    Pingback by Log Buffer #56: a Carnival of the Vanities for DBAs « H.Tonguç YILMAZ Oracle Blog — August 3, 2007 @ 11:56 am


RSS feed for comments on this post. TrackBack URI

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

The Silver is the New Black Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 193 other followers

%d bloggers like this: