在 shell 脚本中使用 SQL*Loader 时找不到 sqlldr
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16617683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
sqlldr not found when using SQL*Loader in a shell script
提问by Angelina
I would like to create shell script, AUTOLOADthat will, when ran, execute SQL*Loader with a set of instructions. All this is in my Linux environment.
我想创建 shell 脚本AUTOLOAD,它将在运行时使用一组指令执行 SQL*Loader。所有这些都在我的 Linux 环境中。
SQL*loader will then import data to SQL developer
SQL*loader 然后将数据导入 SQL 开发人员
#!/bin/sh
#
echo -------- SQL loader --------
# @echo;
#
sqlldr username@server1/password control=/folder1/ctrl/loader.ctl log=/folder1/load/results.l
My shell script is located in root directory and this is where I will be calling other files from. But it is giving me error when I try to run it:
我的 shell 脚本位于根目录中,这是我将从中调用其他文件的地方。但是当我尝试运行它时它给了我错误:
- line 6: sqlldr: command not found
I don't know how to specify path to SQL*Loader, since I am on Linux.
我不知道如何指定 SQL*Loader 的路径,因为我在 Linux 上。
I am new to this...so Be gentle :(
我是新手...所以要温柔:(
回答by glenn Hymanman
Try
尝试
locate sqlldr
That should return something like
那应该返回类似的东西
/u01/app/oracle/product/11.2.0/xe/bin/sqlldr
Edit your ~/.profile and add at the bottom
编辑您的 ~/.profile 并在底部添加
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
PATH="$PATH:$ORACLE_HOME/bin"
Then re-load your profile with source ~/.profile
(or log out and log back in), and you should be good to go.
然后重新加载您的个人资料source ~/.profile
(或注销并重新登录),您应该很高兴。