oracle - sqlcl错误日志配置

标签 oracle sqlplus sqlcl

我喜欢将 Oracle 数据库脚本设置为在出现任何数据库或操作系统问题时失败。

我一直在考虑迁移到 SQLCL,但是我用来检测和触发非数据库问题回滚的 SQL*Plus 方法在 SQLCL 中失败了,我想知道是否有人有替代解决方案(或好的解决方法) )。

我一直在使用SET ERRORLOGGING将任何SP错误定向到SPERRORLOG,我可以在提交之前检测它们并决定回滚/分支/继续/警报等。

我获取了最新的 sqlcl(2016 年 6 月 sqlcl-4.2.0.16.175.1027),希望能够修复以下问题,但它仍然存在。

当发出SET ERRORLOGGING ON时,我得到以下信息:

SQL> SET ERRORLOGGING ON 
SP2-0158: unknown SET option beginning "errorloggi..."

手动输入似乎表明 SQLCL 中此选项没有任何其他更改。

SQL> help set errorlogging 
SET ERRORLOGGING 
ERRORL[OGGING]{ON|OFF} 
[TABLE [schema.]tablename]     [TRUNCATE] [IDENTIFIER  identifier]

这只是一个错误,还是需要其他东西才能启动并运行 ERRORLOGGING?

如果这是一个错误,是否有一个好的替代方法来检测 SP(2)- 错误?

最佳答案

我们到了那里。现在支持 latest OTN release或 Oracle 数据库版本。

SQL> conn barry/oracle@localhost:1521/xe
Connected.
SQL> show errorlogging
errorlogging is OFF
SQL> set errorlogging on
SQL> show errorlogging
errorlogging is ON TABLE SPERRORLOG
SQL> select * from NOTATABLE;

Error starting at line : 1 in command -
select * from NOTATABLE
Error at Command Line : 1 Column : 15
Error report -
SQL Error: ORA-00942: table or view does not exist
00942. 00000 -  "table or view does not exist"
*Cause:
*Action:


SQL> set sqlformat ansiconsole
SQL> /

USERNAME  TIMESTAMP                     SCRIPT  IDENTIFIER  MESSAGE                                   
STATEMENT

BARRY     29-AUG-17 12.55.45.000000000                      ORA-00942: table 
or view does not exist
select * from NOTATABLE

关于oracle - sqlcl错误日志配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38678450/

相关文章:

oracle - pl/sql 存储过程 : parameter name same as column name

linux - 甲骨文查询 - ORA-01652 : unable to extend temp segment but only in some versions of sql*plus

.net - 将程序集加载到 SQL Server 2017 数据库中

java - 在maven java项目中使用SQLcl

java.sql.SQLException : ORA-01002: fetch out of sequence 异常

oracle - 接收数据库链接名称作为 Oracle PLSQL 中的变量

Oracle DBMS_PIPE 无法正常工作

oracle - 如何使用 pl/sql 循环接受用户输入?

oracle - 如何在 sqlplus 中显示错误

oracle - 显示 sqlcl 查询的完整响应