存储oracle sqlplus查询输出shell脚本的问题
我有一个 RHEL 5 系统,一直试图获取一批 3-4 个脚本,每个脚本都在一个单独的变量中,但它们没有按预期工作。
我尝试使用以下语法,我看到该网站上有很多人使用该语法,并且应该确实有效,但由于某种原因它对我不起作用。
语法 -
testvar=`sqlplus -s foo/bar@SCHM <<EOF
set pages 0
set head off
set feed off
@test.sql
exit
EOF`
现在,我可以从 oracle bin 文件夹访问 sqlplus 命令,并且还设置了导出的 ORACLE_HOME 和 ORACLE_PATH 变量(我回显它们只是为了确保它们实际工作)。
但是,我不断收到错误消息 - “您需要为 ORACLE_HOME 设置 EXPORT”,尽管我已经向所有人确认我确实使用了正确的路径。
我的另一个问题是,一旦我获得变量中的脚本输出(以位或字节为单位的数字)值(有 4-5 个脚本,就会有 4-5 个变量),如何转换为人类可读的输出以 MB 或 GB 为单位。
请指导我,我向您保证,我会将所有内容发布在这里,以便将来有人陷入同一问题时,不会浪费时间。 (而且您的宝贵时间也不会变质...)
提前致谢, 布莱恩
I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected.
I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't work for me.
Syntax -
testvar=`sqlplus -s foo/bar@SCHM <<EOF
set pages 0
set head off
set feed off
@test.sql
exit
EOF`
Now, I have access to the sqlplus command from the oracle bin folder and have also set the ORACLE_HOME and ORACLE_PATH variables exported (I echoed them just to ensure they are actually working).
However, I keep getting the error saying - "you need to set EXPORT for ORACLE_HOME" even though I have confirmed from everyone that I am indeed using the correct path.
Another question I have is once I get the script output (which is numeric number in bits or bytes) value in a variable (There will be 4-5 variables as there are 4-5 scripts), how do I convert into human readable output in either MBs or GBs.
Please guide me on this and I assure you that I will post everything here so that someone in future if gets stuck at the same issue, doesn't have waste time. (and your precious time won't go bad either...)
Thanks in advance,
Brian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论