简体   繁体   English

从 SQLPlus 运行 SQL 脚本失败时如何查看错误?

[英]How to see the error when running an SQL script from SQLPlus fails?

I have been able to run an SQL script script.sql from within SQL Plus as follows:我已经能够从 SQL Plus 中运行 SQL 脚本script.sql ,如下所示:

SQL>@script.sql

I did that after starting SQL Plus and logging from within Powershell in as follows:在启动 SQL Plus 并从 Powershell 内部登录后,我这样做了,如下所示:

C:\projects\temp> sqlplus myuser/mypassword@my.tns.address

Now what I'd like to do is run the script above directly from Powershell.现在我想做的是直接从 Powershell 运行上面的脚本。 It is my understanding that I should be able to do that like this:据我了解,我应该能够这样做:

C:\projects\temp> sqlplus myuser/mypassword@my.tns.address script.sql

I expected this to work fine, especially considering I'm using the same user and password, the same TNS, and calling the same script.我希望这能正常工作,特别是考虑到我使用相同的用户和密码、相同的 TNS 并调用相同的脚本。

Instead of running the script however, all this command does is output the Help-text for SQL Plus, ie the same text that is shown when running sqlplus -H .然而,这个命令不是运行脚本,而是 output SQL Plus 的帮助文本,即运行sqlplus -H时显示的相同文本。

I'm assuming there is some syntax error, or something else wrong with the command above, but the problem is finding out what that error is.我假设上面的命令有一些语法错误或其他错误,但问题是找出那个错误是什么。

Is there something obviously wrong with the last command above?上面的最后一个命令有明显的问题吗? Or is there some way for me to turn up the verbosity, so that I can get a hint about what could be wrong?或者有什么方法可以让我提高详细程度,以便我可以提示可能出现什么问题?

The "@" is missing to invoke the script.缺少“@”来调用脚本。 Try this instead试试这个

C:\projects\temp> sqlplus myuser/mypassword@my.tns.address @script.sql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM