Question

I am running a script to install Oracle DB 11g with silent option and response file.

I noticed the shell after executing the command

$ /directory_path/runInstaller -silent -responseFile responsefilename

The install session just closes just giving me a log file location.

The installation process is active in the background. But for me no way to no about the progress and what is going on... till the prompt to run root scripts come. What if I close the putty windows etc?

Any way to keep the installer session active till finished ? and show some sort of progress on-screen ?

Was it helpful?

Solution

Any way to keep the installer session active till finished ?

Yes, you can wait for oracle silent install to finish on linux eg in a shell script as follows.

(Below was with oracle 11g release 2 for Redhat Enterprise Linux.)

You can wait for it to finish by doing:

$ /directory_path/runInstaller -silent -responseFile responsefilename | 
while read l ; 
do 
  echo "$l" ; 
done

(this relies on the fact that even though the java universal installer runs in the background it keeps using stdout, so "read l" keeps succeeding until the background universal installer process exits)

and show some sort of progress on-screen ?

A bit more tricky but we can do it by figuring out the name of the logfile from the output of runInstaller before it exits. The output contains a line like:

Preparing to launch Oracle Universal Installer from /tmp/xxxxOraInstallTTT. ...

... where the TTT is a timestamp which leads us to the correct log file, /opt/oraInventory/logs/installActionsTTT.log.

Something like (I have not tested this because in my install I do not need progress output):

$ /directory_path/runInstaller -silent -responseFile responsefilename | 
(
while read l ; 
do 
  echo "$l" &&
  if expr "$l" : "Preparing to launch Oracle Universal Installer from " >/dev/null
  then
    t=$(expr "$1" : ".*OraInstall\([^.]*\)") &&
    log="/opt/oraInventory/logs/installActions${t}.log" &&
    tail -f "$log" &
    tpid=$!
  fi
done
if [ -n "$tpid" ]
then
  kill $tpid
fi
#[1]
)

... we can also tell if the install succeeded, because the universal installer always puts its exit status into the log via the two lines:

INFO: Exit Status is 0
INFO: Shutdown Oracle Database 11g Release 2 Installer

... so by adding to the above at #[1] ...

exitStatus=$(expr $(grep -B1 "$log" | head -1) : "INFO: Exit Status is\(.*\)") &&
exit $exitStatus

... the above "script" will exit with 0 status only if the oracle instal completes successfully.

(Note that including the space in the status captured by expr just above is deliberate, because bizarrely expr exits with status 1 if the matched substring is literally "0")

It is astounding that oracle would go to so much trouble to "background" the universal installer on linux/unix because:

  • it is trivial for the customer to generically run a script in the background:

    runInstaller x y z & ... or... setsid runInstaller x y z

  • it is very difficult (as we can see above) to wait for a "buried" background process to finish, and it cannot be done generically

Oracle would have saved themselves and everyone else lots of effort by just running the universal installer syncronously from runInstaller/.oui.

OTHER TIPS

One useful option I found is -waitforcompletion and -nowait for windows. setup.exe will wait for completion instead of spawning the java engine and exiting.

But still trying to figure out a way to tail that log file automatically when running the runInstaller.

UPDATE: Finally this is the only solution that worked for me.

LOGFILE=$(echo /path/oraInventory/logs/$(ls -t /path/oraInventory/logs | head -n 1))

./runInstaller -silent -responseFile /path/db.rsp -ignorePrereq 

grep -q 'INFO: Shutdown Oracle Database' $LOGFILE
while [[ $? -ne 0 ]] ; do
    tail -1 $LOGFILE
    grep -q 'INFO: Shutdown Oracle Database' $LOGFILE
done

Instead of tailing the latest log in oraInventory, kept the process active till the last message is written to the log file. Old school but works.

It's been a while since I did an installation, but I don't think you can make it stay in the foreground; it just launches the JVM and that doesn't (AFAIK) produce any console output until the end, and you see that anyway, so it wouldn't help you much.

You should have plenty to look at though, in the logs directory under your oraInventory directory, which is identified in the oraInst.loc file you either created for the installation or already had, and might have specified on the command line. You mentioned it told you where the log file is when it started, so that would seem a good place to start. The installActions log in that directory will give you more detail than you probably want.

If you do close the terminal, the silentInstall and oraInstall logs tell you when the root scripts need to be run, and the latter even gives you the progress as a percentage - though I'm not sure how reliable that is.

Tailing the oraInstall or installActions files is probably the only way you can show some sort of progress on screen. 'Silent' works both ways, I suppose.

You probably want to "tail" the most up to date logs(ls -t would give that) generated under /tmp/OraInstallXXX directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top