nohup启动sql和日志记录

Eve*_*Eve 0 sql oracle putty

我是nohup命令的新手,但我不太了解它.我有一个名为update_item_loc.sql的sql脚本,我用putty调用它

到目前为止,我已完成以下命令

login as: **username**  
sprusr13@servername.server.com's password:**xx**

username@servername:~> cd  /fs01/app/rms04/external/scripts
username@servername:/fs01/app/rms04/external/scripts> sqlplus $UP

SQL*Plus: Release 11.1.0.7.0 - Production on Fri Jan 27 16:16:50 2012    Copyright (c) 1982, 2008, Oracle.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 
- 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

userDB@DBserver>
Run Code Online (Sandbox Code Playgroud)

所以下一个命令就是

userDB@DBserver>nohup update_item_loc.sql > /fs01/app/rms04/external/logs/update_item_loc.log &
Run Code Online (Sandbox Code Playgroud)

它是否正确?

Mar*_*bak 5

不.

nohup不是sqlplus命令.您可以在shell提示符下使用nohup来执行二进制或shell脚本.

所以,如果你有test.sql看起来像这样:

select * from dual;
exit
Run Code Online (Sandbox Code Playgroud)

然后从shell脚本run_test.sh运行它,如下所示:

export ORACLE_SID=mysid
export ORAENV_ASK=NO
. oraenv
sqlplus myuser/mypass@$ORACLE_SID @test.sql
Run Code Online (Sandbox Code Playgroud)

然后你应该能够通过以下方式来解决它:

 $ nohup run_test.sh &
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.