There are multiple situations where you have to execute processes in your Oracle environment as a daemon or background process of your OS. This procedure describes the use of “NOHUP” to begin the execution of a background process. In this example we are executing the Oracle 12c upgrade script ‘preupgrd.sql’ on an OEL (Oracle Enterprise Linux) platform.
1. Logon to your OEL server as the oracle software owner.
root@mylinux#su – oracle
2. Change directory to the location of your script file.
3. At the OS prompt execute the NOHUP command passing in a sqlplus connection string and the script name to be executed following by a terminating ampersand sign ‘&’.
nohup sqlplus sys/password as sysdba @./preupgrd.sql &
oracle@mylinux#nohup sqlplus sys/password as sysdba @./preupgrd.sql &
oracle@mylinux#nohup: ignoring input and appending output to `nohup.out’
4. The (nohup) command will produce a log file in the local directory named nohup.out which records all terminal output from the daemon.
SQL*Plus: Release 18.104.22.168.0 Production on Sat Mar 26 17:28:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Oracle Database 11g Enterprise Edition Release 22.214.171.124.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Loading Pre-Upgrade Package…
5. You can also see the processing with the system process command (ps) as shown below.
oracle@mylinux#ps -ef|grep nohup
oracle 9707 9268 0 18:11 pts/0 00:00:00 grep nohup
+ Exit 1 nohup sqlplus sys/password as sysdba @./preupgrd.sql
6. This completes executing an Oracle script as a LINUX or UNIX background process.
Larry J. Catt, OCP