Sponsored Content
Full Discussion: SQLPLUS calling Via Script
Top Forums UNIX for Beginners Questions & Answers SQLPLUS calling Via Script Post 303006699 by Ariean on Monday 6th of November 2017 01:54:01 PM
Old 11-06-2017
Hello All,
i am trying to extract the data file via sqlplus and i wanted to capture the output of sqlplus into a log file and check for any syntax,Connection, DB errors etc.
But for some reason my logfile is filled up with the data of sqlplus output, and also process is running a long time because of this.
Appreciate your further inputs.


Code:
#${ORACLE_HOME}/bin/sqlplus -s /nolog <<-EOF > ${LOG_DIR}/edw_extract_RDW_Partition.sh.${MP_BCH_OBJ_ID}_${partition}.sql.log
${ORACLE_HOME}/bin/sqlplus -s /nolog <<-EOF > /dev/null
conn ${APPLICATION_ID}/${DB_PASS}@${RDW_DB}
spool ${SRC_DIR}/RDW_SRVC_CONV_${MP_BCH_OBJ_ID}_${partition}.dat;
set pagesize 0
set trimspool on
set heading off
set feedback off
set linesize 500
select to_char(ACTVY_RPTNG_PER_DT,'mm/dd/yyyy hh24:mi:ss')||'|'||LN_ID||'|'||'|'||'|'||'|'||'|'||ARM_IDX_CD||'|'||'|'||'|'||'|'||'|'||'|'||'|'||RCRS_TYP_CD||'|'||'|'||'|'||LNDR_LN_ID||'|'||'|'||'|'||'|'||'${MP_BCH_OBJ_ID}'||'|'||'|'||'${MP_EDW_USR_ID}'||'|'||'${MP_BCH_STRT_DTTM}'||'|'||'|' from $RDW_Schema.LL_LN_ACTVY_3 partition(${partition});
spool off;
EXIT;
EOF

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calling sqlplus from shell

Hi All, I am executing the following code :- sqlplus -s ${DATABASE_USER} |& print -p -- 'set feed off pause off pages 0 head off veri off line 500' print -p -- 'set term off time off serveroutput on size 1000000' print -p -- "set sqlprompt ''" print -p -- "SELECT run_command from... (2 Replies)
Discussion started by: suds19
2 Replies

2. Shell Programming and Scripting

calling sqlplus from within a for loop

i'm not new to programming, but i AM new to unix scripting. here's my deal. this works: #!/bin/ksh echo "HELLO" /oracle_home/bin/sqlplus username/password@MYDB<<EOF SELECT COUNT(*) FROM EMPLOYEES; EOF exit echo "GOODBYE" this doesn't: #!/bin/ksh echo "HELLO" for x in 1 2... (4 Replies)
Discussion started by: akosz
4 Replies

3. Shell Programming and Scripting

calling sqlplus, read table return etc

I have korn shell scripts. I want to pass a variable to a script which will execute a a sql script to read a table that contains env. variables. I want to read and then somehow export at unix level variables example for every row selected from the table build export command line field1... (5 Replies)
Discussion started by: TimHortons
5 Replies

4. Shell Programming and Scripting

Error in calling store procedure using SQLPLUS in unix

Hi, I am facing the following error in calling the stored procedure from SQLPLUS in unix environment. SQL> set serveroutput on SQL> var store number; SQL> exec test_proc(:store, 200); BEGIN TEST_PROC(:store, 200); END; * ERROR at line 1: ORA-01858: a non-numeric character was found... (8 Replies)
Discussion started by: pradeep7986
8 Replies

5. Shell Programming and Scripting

Help supressing spool output from screen when calling sqlplus from script

I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want. How can I... (3 Replies)
Discussion started by: MxC
3 Replies

6. UNIX for Dummies Questions & Answers

calling a unix shell script from sqlplus

I want to execute a shell script from sqlplus prompt and get its output back to sqlplus. Is this possible? if yes just give me an example for doing that. (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

7. Shell Programming and Scripting

Control not returning from Sqlplus to calling UNIX shell script.

Hello All, I have a UNIX script which will prepare anonymous oracle pl/sql block in a temporary file in run time and passes this file to sqlplus as given below. cat > $v_Input_File 2>>$v_Log << EOF BEGIN EXECUTE IMMEDIATE 'ALTER SESSION FORCE PARALLEL DML PARALLEL 16'; EXECUTE... (1 Reply)
Discussion started by: vikas_trl
1 Replies

8. Shell Programming and Scripting

Control not returning from Sqlplus to calling UNIX shell script.

Hello All, I have exactly same issue @vikas_trl had in following link: https://www.unix.com/shell-programming-and-scripting/259854-control-not-returning-sqlplus-calling-unix-shell-script.html I wonder if he or somebody else could find the issue's cause or the solution. Any help would... (4 Replies)
Discussion started by: RicardoQ
4 Replies

9. Shell Programming and Scripting

Oracle/SQLPlus help - ksh Script calling .sql file not 'pausing' at ACCEPT, can't figure out why

Hi, I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop. The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. Shell Programming and Scripting

Avoid $ symbol while calling sqlplus in shellscript.

Hi All, we have requirement, i am created a shell script , inside i am connecting sqlplus and execute the query. below my code for your reference. get_sqlid () { sqlid=$( sqlplus -s $PBDW_USERID/$PBDW_PW@$PBDW_SID <<EOF DEFINE TBLNAME=$1 set feedback off set serverout on size... (4 Replies)
Discussion started by: KK230689
4 Replies
rt-shredder(8)						     Request Tracker Reference						    rt-shredder(8)

NAME
rt-shredder - Script which wipes out tickets from RT DB SYNOPSIS
rt-shredder --plugin list rt-shredder --plugin help-Tickets rt-shredder --plugin 'Tickets=query,Queue="general" and Status="deleted"' rt-shredder --sqldump unshred.sql --plugin ... rt-shredder --force --plugin ... DESCRIPTION
rt-shredder - is script that allow you to wipe out objects from RT DB. This script uses API that RT::Shredder module adds to RT. Script can be used as example of usage of the shredder API. USAGE
You can use several options to control which objects script should wipeout. OPTIONS
--sqldump <filename> Outputs INSERT queries into file. This dump can be used to restore data after wiping out. By default creates files <RT_home>/var/data/RT-Shredder/<ISO_date>-XXXX.sql --object (DEPRECATED) Option has been deprecated, use plugin "Objects" instead. --plugin '<plugin name>[=<arg>,<val>[;<arg>,<val>]...]' You can use plugins to select RT objects with various conditions. See also --plugin list and --plugin help options. --plugin list Output list of the available plugins. --plugin help-<plugin name> Outputs help for specified plugin. --force Script doesn't ask any questions. SEE ALSO
RT::Shredder perl v5.14.2 2013-05-22 rt-shredder(8)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy