Execute Oracle pl/sql commands in a scrit using nohup

Good afternoon:
I need your help please, Im new at Unix nd specially Unix applicationas like oracle and Ive got this problem:

I was asked to execute the next script using nohup in order to not hang up the session because it was supposed to connect to the database and then insert about 2 millions of rows to a table
and this process akes about 2 hours

I run this script with oracle user because of privilige issues previusly exporting some oracle vars

export ORACLE_SID=XYZ
export TWO_TASK=XYZ

SCEL:/oracle/oracle/PACKAGES/CXYZ/Install oracle@prosclbt00c # id
uid=1000(oracle) gid=26(dba)

nohup ./install_bd.ksh &

But after 12 hours or more this process continue writing both logs consuming so much space

-rw-------   1 oracle   dba         1.8G Dec  8 12:23 nohup.out
-rw-r-----   1 oracle   dba         1.8G Dec  8 12:23 install_1_0_SCEL.log

Sadly, we validate with our DBA if there was any session but he said there was neither session with OSUSER oracle nor any other sessions affecting the specified tables.

So it was likely the process was redirecting the output to both logs but it never connected to the DATABASE, dont know for sure:

This is the scriptinstall_bd.ksh

This is the scriptinstall_bd.ksh

 more install_bd.ksh
#!/bin/ksh
# Descripcion: ASB
# Cambio de:
#       


time sqlplus /<<EOF
set echo on verify on feedback 1 timing on time on pages 10000 lines 132 trimspool on tab off flush off
/
WHENEVER SQLERROR CONTINUE
set echo on verify on feedback 1 timing on time on pages 10000 lines 132 trimspool on tab off flush off

spool install_1_0$1_$ORACLE_SID.log

@install_1_0.sql

spool off
disconnect
EOF

resultado=$(egrep "ORA-|PLS-|SP2-" sclsql_$1_$ORACLE_SID.log |grep -v "ORA-00001" | grep -v "ORA-01430" |grep -v "ORA-01921" | grep -v "ORA-01920" |sort -u > final.log)

hay_error=`wc -l final.log | awk '{ print $1 }'` 

ls -ltr *.log
cat final.log
rm final.log
echo "ERRORES ENCONTRADOS "$hay_error
exit

The questions are:

  1. I would like to know it was something wrong executing the scrpit install_bd.ksh & using nohup?

2 if so how to control the proceses can not hang up? wouldnt it better to modify inside the script install_bd.ksh this line:

nohup time sqlplus /<<EOF ?

I'd appreciate your help in advanced

You have made the process hard to debug and to maintain.

First off spool files have limitations as to number of lines, for example.
Are you really expecting 10000 lines of output? I would consider using something like at
to run, logon as user oracle, then:

at -m now <<!
sqlplus /
set echo on verify on feedback 1 timing on time on pages 10000 lines 132 trimspool on tab off flush off
/
WHENEVER SQLERROR CONTINUE
set echo on verify on feedback 1 timing on time on pages 10000 lines 132 trimspool on tab off flush off
@install_1_0.sql
disconnect
!

Why? possibly because you have an error condition that generates tons of garbage.

But oracle user gets notified when the job ends - email - and you do not create a gigantic file except in /var/mail (or wherever mail text is stored in your system).
You may also want to edit the .sql file to remove a lot of chatty output. Otherwise your problems are lost in a sea of junk notifications.

BTW: if you are getting all of those ORA notifications (the ones you grep -v) your script or your data need to be looked at carefully. A script should throw one fatal error then abort not keep on running. Otherwise you run the risk of corrupting indexes, creating orphans and so on. Example ORA-01921 deals with junk/bogus roles in a connect string. That should never happen. Why would a process need to keep connecting to new db's if it is designed correctly? Aside from that fact, it is a huge overhead.

Run your script interactively with a small subset of a) correct b) erroneous data to see what happens.

ok thank you very much for your support. i will keep in mind your suggesttions