sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 故障案例 >

【案例】Oracle在执行SQL时报错SP2-0734原因和stty kill U解决办法

时间:2016-11-20 15:08   来源:Oracle研究中心   作者:网络   点击:

天萃荷净 Oracle研究中心案例分析:运维DBA反映在Oracle数据库中执行SQL语句时遇到报错SP2-0734,分析原因为SQL语句中含有@导致,使用stty kill临时解决。

本站文章除注明转载外,均为本站原创: 转载自love wife & love life —Roger 的Oracle技术博客
本文链接地址: 遭遇SP2-0734的尴尬

在执行 healthcheck.sql 以及 dba_snapshot_database_9i.sql的时候,发现执行报错 sp2-0734,该报错无法识别,怪了。当时我怀疑可能是跟环境变量或shell有关系,经过测试,我发现手工 vi test.sh 加入如下信息:

sqlplus "/as sysdba"
@  /rdbms/admin/spreport.sql 后,发现 @ 是无法显示的,这是何解?

当时使用了如下方式暂时解决了此问题:

stty kill ^U

然后再次执行脚本即正常了。

晚上回家查了下MOS,发现了几个相关的文档,其中一个文档就提到了 stty kill ^U 的方法

下面是相关的几个MOS文档:
文档1:

SP2-0734 and/or SP2-0042 Error Immediately When Attempting To Run catpatch.sql [ID 336920.1]

Symptoms

After applying a patchset, the post install documentation instructs you to run the
$ORACLE_HOME/rdbms/admin/catpatch.sql script. The script does not run and instead
produces the error below:

SQL> @catpatch.sql

SP2-0734: unknown command begining "catpatch.s..." ....

Cause

This is due to the display terminal keyboard configuration of the kill character.

Solution

The problem is with the display terminal keyboard settings. The sqlplus session had trouble
interpreting the "@" sign, because it was assigned in the terminal to the "kill" setting.
The catpatch.sql script was supposed to be run as "@catpatch.sql" and since the "@" sign had
a completely different meaning for this OS session, sqlplus only saw "catpatch.sql".

The solution is to change the display terminal keyboard setting of the kill character to something else. 
For example:

# stty kill ^u

After making this change the script is interpreted correctly and runs as it should.
文档2:

Error SP2-0734 "Unknown Command Beginning ..." When Using SQL*Plus to Connect to Database [ID 823374.1]

Symptoms

Trying to connect to database with SQL*Plus fails with the following error:

Error

SP2-0734: unknown command beginning "yyy..." rest of line ignored.
Even the command "sqlplus /nolog" fails with same error.

Changes

This error may occur if there are:

* Recent changes to glogin.sql script.
* Any corruption of this glogin.sql file.

Cause

Any invalid entries in glogin.sql file causes this issue. The glogin.sql script gets executed
when users invoke Oracleоsqlplus, even with nolog option.

Solution

Check if there any invalid commands defined in glogin.sql (which usually resides in $ORACLE_HOME/sqlplus/admin).

If not, then check if there is any issue with this file itself.  To do that, rename this file to bkp_glogin.sql
and try invoking sqlplus again.
文档3:

SP2-0734 Calling PL/SQL Procedure from SQL*Plus [ID 119299.1]

Problem Description
-------------------

You are trying to call a PL/SQL stored procedure from SQL*Plus but you get the following error:

SP2-0734: unknown command beginning "..." - rest of line ignored

Your call looks something like:

SQL> myprocedure ('some literal parameter');

Solution Description
--------------------

When calling a PL/SQL stored procedure from SQL*plus you must call it using the EXECUTE
(or EXEC) command or via a PL/SQL BEGIN-END block as follows:

1) EXEC myprocedure ('some literal parameter');

or

2) BEGIN
     myprocedure('some literal parameter');
   END;
   /

Explanation
-----------

EXECUTE is a SQL*plus command and is used for the following purpose:

Executes a single PL/SQL statement. The EXECUTE command is often useful when you want to execute
a PL/SQL statement that references a stored procedure.

Additional Search Words
-----------------------
SP2-734

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【案例】Oracle在执行SQL时报错SP2-0734原因和stty kill U解决办法

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1300.html

Oracle研究中心

关键词:

SP2-0734

stty kill ^U使用方法