RMAN Checksyntax Only Check Syntax

Today a coworker ask me about a problem in a rman script. He told me checksyntax option from rman command doesn’t work fine, because checsyntax replied “The cmdfile has no syntax errors” and when execute the cmdfile failed by syntax error.

Of course, the first of all Check Syntax refering to “tokens” or characteres, by example BEGIN is correct, BegIN too but BeGIM is incorrect as syntax. On the other hand we have the semantic, “SELECT COUNT (*) V$SESSION” is correct from syntax but incorrecto from semantic, before “V$SESSION” need “FROM” clause.

Checksyntax only validate the words;

Let me see a example with syntax and semantic ok;

 
thunder@:$PWD> cat restore_one_datafile_syntax_ok_semantic_ok
connect rcvcat rman/secret@catalog12c;
set dbid 1030983521
connect target sys/sys
run {
  allocate channel t1 type 'SBT_TAPE'
        parms 'ENV=(NSR_DATA_VOLUME_POOL=daily,
                NSR_CLIENT=thunder.local.com,
                NSR_SERVER=serverbck.local.com)';
      set until time "to_date( ''''''AUG 29 2016 00:00:00'''''', ''MON DD RRRR HH24:MI:SS'')";
set newname for datafile 4   to '/tmp/anr/work.dbs';
restore datafile
'/tmp/anr/work.dbs';
}

Now other example with syntax ok but semantic wrong, don’t close double quotation marks;

 
thunder@:$PWD>
thunder@:$PWD> cat restore_one_datafile_syntax_ok_semantic_ko
connect rcvcat rman/secret@catalog12c;
set dbid 1030983521
connect target sys/sys
run {
  allocate channel t1 type 'SBT_TAPE'
        parms 'ENV=(NSR_DATA_VOLUME_POOL=daily,
                NSR_CLIENT=thunder.local.com,
                NSR_SERVER=serverbck.local.com)';
      set until time "to_date( ''''''AUG 29 2016 00:00:00, ''MON DD RRRR HH24:MI:SS'')";
set newname for datafile 4   to '/tmp/anr/work.dbs';
restore datafile
'/tmp/anr/work.dbs';
}

Check the first example;

 
thunder@:$PWD> rman checksyntax @restore_one_datafile_syntax_ok_semantic_ok

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 1 16:31:45 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect rcvcat *
2> set dbid 1030983521
3> connect target *
4> run {
5>   allocate channel t1 type 'SBT_TAPE'
6>         parms 'ENV=(NSR_DATA_VOLUME_POOL=daily,
7>                 NSR_CLIENT=thunder.local.com,
8>                 NSR_SERVER=serverbck.local.com)';
9>       set until time "to_date( ''''''AUG 29 2016 00:00:00'''''', ''MON DD RRRR HH24:MI:SS'')";
10> set newname for datafile 4   to '/tmp/anr/work.dbs';
11> restore datafile
12> '/tmp/anr/work.dbs';
13> }
14>
15>
16>
The cmdfile has no syntax errors

Recovery Manager complete.

All is okay, then check the second example;

 
thunder@:$PWD> rman checksyntax @restore_one_datafile_syntax_ok_semantic_ko

Recovery Manager: Release 11.2.0.3.0 - Production on Thu Sep 1 16:32:05 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect rcvcat *
2> set dbid 1030983521
3> connect target *
4> run {
5>   allocate channel t1 type 'SBT_TAPE'
6>         parms 'ENV=(NSR_DATA_VOLUME_POOL=daily,
7>                 NSR_CLIENT=thunder.local.com,
8>                 NSR_SERVER=serverbck.local.com)';
9>       set until time "to_date( ''''''AUG 29 2016 00:00:00, ''MON DD RRRR HH24:MI:SS'')";
10> set newname for datafile 4   to '/tmp/anr/work.dbs';
11> restore datafile
12> '/tmp/anr/work.dbs';
13> }
14>
15>
16>
The cmdfile has no syntax errors

Recovery Manager complete.

Rman says is OK but when you execute it get a error.

HTH – Antonio NAVARRO

 

Advertisements

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