[20161230]rman checksyntax2.txt
--曾经写过一篇rman checksyntax的问题,这个问题存在10g:
http://blog.itpub.net/267265/viewspace-2130511/
--今天看了一个链接重复测试:https://jhdba.wordpress.com/2016/12/29/rman-checksyntax-function/#comment-11009
1.环境:
SYS@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
$ cat -n r.rman
1
2 run
3 {
4 allocate channel c1 device type DISK
5 allocate channel c2 device type DISK;
6
7 release channel c1;
8 release channel c2;
9 }
--//注意开头1行空行,第4行我少写一个分号,测试看看.
2.测试:
$ rlrman checksyntax
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 30 10:23:10 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BOOK (DBID=1337401710)
RMAN> @ r.rman
RMAN>
RMAN> run
2> {
3> allocate channel c1 device type DISK
4> allocate
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "allocate": expecting one of: "auxiliary, connect, format, maxopenfiles, maxpiecesize, parms, rate, send, to, ;"
RMAN-01007: at line 5 column 3 file: r.rman
--//如果你看命令输出前面4>,而应该看r.rman文件.实际上错误指向r.rman第5行第3列.如果我修改如下:
$ cat -n r.rman
1
2 run
3 {
4 allocate channel c1 device type DISK;
5 allocate channel c2 device type DISK
6
7 release channel c1;
8 release channel c2;
9 }
RMAN> @ r.rman
RMAN>
RMAN> run
2> {
3> allocate channel c1 device type DISK;
4> allocate channel c2 device type DISK
5>
6> release
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "release": expecting one of: "auxiliary, connect, format, maxopenfiles, maxpiecesize, parms, rate, send, to, ;"
RMAN-01007: at line 7 column 3 file: r.rman
--//总之要看这类错误,应该正确的看脚本文件,而不是输出的行号.