Sponsored Content
Special Forums UNIX and Linux Applications Execute Oracle pl/sql commands in a scrit using nohup Post 303009103 by alexcol on Friday 8th of December 2017 05:01:16 PM
Old 12-08-2017
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

Code:
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

Code:
-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

Code:
 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:

Code:
nohup time sqlplus /<<EOF ?

I'd appreciate your help in advanced
 

9 More Discussions You Might Find Interesting

1. AIX

how can i install sqlplus and execute some sql commands

hi everybody, i am Talip, a begginner at unix based systems and i have a problem (actually, we may think myself as the problem, in this situation). i am not sure if this is the correct platform for my questions. if it is not please forgive me about this inappropriate mail. what i have: *... (2 Replies)
Discussion started by: talipk
2 Replies

2. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

3. Shell Programming and Scripting

using mutiple "nohup" to execute multiple commands.

I need to run multiple commands on remote server using the nohup... I have tried 2 options 1) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl ; $SCRIPTS_DIR/xyz.ksh & " & 2) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl & nohup $SCRIPTS_DIR/xyz.ksh & " & I need to know if... (2 Replies)
Discussion started by: aster007
2 Replies

4. Shell Programming and Scripting

Execute Script using nohup and &

Hi all, I have one script test.sh for which I pass two arguments. In the same script I need to submit this script in background using nohup. My script like this and it is working in HP-UX os but not Solaris. #! /bin/sh if then MTR_PID=$$ export MTR_PID echo "test.sh $1 $2... (3 Replies)
Discussion started by: sridhar_423
3 Replies

5. UNIX for Dummies Questions & Answers

Execute PL/SQL function from Unix script (.sql file)

Hi guys, I am new on here, I have a function in oracle that returns a specific value: create or replace PACKAGE BODY "CTC_ASDGET_SCHED" AS FUNCTION FN_ASDSCHEDULE_GET RETURN VARCHAR2 AS BEGIN DECLARE ASDSchedule varchar2(6); ASDComplete... (1 Reply)
Discussion started by: reptile
1 Replies

6. Shell Programming and Scripting

using nohup with set of commands

hi I want to use nohup command with set of commands .. my goofy sample : nohup while true do ; date; done and its not working . any idea ? cheers (1 Reply)
Discussion started by: kvok
1 Replies

7. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

8. UNIX for Dummies Questions & Answers

How to use 'nohup' and 'at' commands collectively?

I have a unix script named 'test1' and it can be run using parameters say a, b and c. i.e. the command would be test1 -a -b -c this script gives the output in the log file as script started start time: 10.22 pm 7 april end time: 10.30 pm 7 april script finished Now, i want to run... (3 Replies)
Discussion started by: swap21783
3 Replies

9. Linux

How to execute nohup cmd

Hi, nohup sar -u 10 $COUNT | awk 'NR>2 {$2=$4=$7="";}1' | tr -s ' ' '\t' 2>/dev/null >sar.out & i have execute above line from shell script .. but sar.out is created with ZERO bite size.. Help on that what is the problem here Thx, Mani (0 Replies)
Discussion started by: Mani_apr08
0 Replies
CHING(6)							 BSD Games Manual							  CHING(6)

NAME
ching -- the book of changes and other cookies SYNOPSIS
ching [hexagram] DESCRIPTION
The I Ching or Book of Changes is an ancient Chinese oracle that has been in use for centuries as a source of wisdom and advice. The text of the oracle (as it is sometimes known) consists of sixty-four hexagrams, each symbolized by a particular arrangement of six straight (---) and broken (- -) lines. These lines have values ranging from six through nine, with the even values indicating the broken lines. Each hexagram consists of two major sections. The Judgement relates specifically to the matter at hand (e.g., ``It furthers one to have somewhere to go.'') while the Image describes the general attributes of the hexagram and how they apply to one's own life (``Thus the superior man makes himself strong and untiring.'') When any of the lines have the values six or nine, they are moving lines; for each there is an appended judgement which becomes significant. Furthermore, the moving lines are inherently unstable and change into their opposites; a second hexagram (and thus an additional judgement) is formed. Normally, one consults the oracle by fixing the desired question firmly in mind and then casting a set of changes (lines) using yarrow-stalks or tossed coins. The resulting hexagram will be the answer to the question. Using an algorithm suggested by S. C. Johnson, the UNIX oracle simply reads a question from the standard input (up to an EOF) and hashes the individual characters in combination with the time of day, process id and any other magic numbers which happen to be lying around the system. The resulting value is used as the seed of a random number generator which drives a simulated coin-toss divination. The answer is then piped through nroff(1) for formatting and will appear on the standard output. For those who wish to remain steadfast in the old traditions, the oracle will also accept the results of a personal divination using, for example, coins. To do this, cast the change and then type the resulting line values as an argument. The impatient modern may prefer to settle for Chinese cookies; try fortune(6). DIAGNOSTICS
The great prince issues commands, Founds states, vests families with fiefs. Inferior people should not be employed. SEE ALSO
It furthers one to see the great man. BUGS
Waiting in the mud Brings about the arrival of the enemy. If one is not extremely careful, Somebody may come up from behind and strike him. Misfortune. BSD
May 31, 1993 BSD
All times are GMT -4. The time now is 10:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy