Many times we (DBAs) are in a situation
when we need to run some command or script from the command prompt on the
Linux, and during command/script execution; we face disconnection of session
and our process stops in the middle leaving a lot of mess for us to clear. To
avoid this kind of situation, it is advised to execute long running scripts or
commands in the background using Linux
“nohup” command. In the following example, I have a script “recovery.sh” that contains RMAN commands to restore and recover a huge database on a server, so I would execute this script in background as follows
“nohup” command. In the following example, I have a script “recovery.sh” that contains RMAN commands to restore and recover a huge database on a server, so I would execute this script in background as follows
$ nohup ./recovery.sh &
|
Immediately after executing this command, my
session would return to the command prompt, and my script would keep executing
in the background. A file “nohup.out” would get created in the current directory
that will contain all the output returned by the script. We can monitor the
progress by using “tail” command on this output file
$ tail –f nohup.out
|
Likewise,
if I am applying a patch using opatch, I can run command in the background as
follows
[root@myserver]# nohup opatch apply
&
|
No comments:
Post a Comment