oracle nohup 启动 sql 和日志记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9036007/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:34:28  来源:igfitidea点击:

nohup starting sql and logging

sqloracleputty

提问by Eve

I am new to nohup command but I'm not quite understanding it. I have an sql script called update_item_loc.sql i'm calling it with putty

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

I have done the following command up until now

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

login as: **username**  
[email protected]'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>

so the next command would be

所以下一个命令是

userDB@DBserver>nohup update_item_loc.sql > /fs01/app/rms04/external/logs/update_item_loc.log &

Is this correct?

这样对吗?

回答by Mark J. Bobak

Um, no.

不。

nohup is not a sqlplus command. You can use nohup at the shell prompt, to execute a binary or shell script.

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

So, if you have test.sql that looks like this:

因此,如果您有如下所示的 test.sql:

select * from dual;
exit

and you run it from a shell script, run_test.sh that looks like this:

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

export ORACLE_SID=mysid
export ORAENV_ASK=NO
. oraenv
sqlplus myuser/mypass@$ORACLE_SID @test.sql

then you should be able to nohup it with:

那么你应该可以用以下命令 nohup 它:

 $ nohup run_test.sh &

Hope that helps.

希望有帮助。

回答by pmesina

Maybe what you want to do is to avoid that the connection finishes because of no activity, you can change the putty connection settings:

也许您想要做的是避免连接因没有活动而结束,您可以更改腻子连接设置:

  • Seconds between keepalives to a number greater than 0, I set it to 360sec
  • Mark the Enable TCP Keep Alives option
  • keepalives 之间的秒数大于 0,我将其设置为 360sec
  • 标记启用 TCP Keep Alives 选项