jump to navigation

check syntax option in RMAN & SQLPLUS. May 9, 2009

Posted by sendtoshailesh in Uncategorized.
Tags: , ,
trackback

DBAs always have to ready for creating any script for scheduling jobs either for backups or any thing similar like that.
Due to error prone nature of human beings, it may be possible that a DBA write a script to perform the backup at a scheduled time. this it has do by writing the scripts and then schedule through scheduler. may be just a character is missed in script then whole job will be failed.

For this RMAN and sqplus both have option to check the syntax before you actually run the commands in their respective environment.

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.txtRMAN> 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**

For SQLPLUS you can do this.

SQL> explain plan for select from dual;
explain plan for select from dual
                     *
ERROR at line 1:
ORA-00936: missing expression

SQL> explain plan for select * from dual;

Explained.

Go ahead. Have fun.

Advertisements

Comments»

No comments yet — be the first.

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

%d bloggers like this: