Sponsored Content
Top Forums Shell Programming and Scripting Passing filename dynamically in SPOOL of SQL*PLUS in shell script Post 302518513 by palanisvr on Saturday 30th of April 2011 12:47:41 AM
Old 04-30-2011
Try this...

Code:
Script :

$cat myscript.ksh

file_name=$1

sqlplus -s  scott/tiger@oracle<<EOF
spool $file_name;
begin
do_something;
end;
/
spool off;
exit;
EOF


You may call the script with the filename as a parameter , this should do the trick

Code:
$sh myscript.ksh  "/home/user/data/file.txt"

 

10 More Discussions You Might Find Interesting

1. Linux

Passing variables to sql from batch shell in linux

Hi, I need to put this command in a batch shell. sqlplus -s user/password @test.sql and in the test.sql I have this command select * from pbempl where pebempl_id = $1; How I can pass the variable $1 from the batch shell??? Thanks (2 Replies)
Discussion started by: rama71
2 Replies

2. Shell Programming and Scripting

Passing PL/SQL variable value to Shell Varible

Hi my UNIX Friends, Im calling some SQL scripts through Unix Shell scripting. How do I export the value of PL/SQL variable value into a Unix shell script variable? Also could any one inform me about the 'search' and 'cut' utility of PL/SQL (like 'grep' and 'cut' in Shell scripting). ... (10 Replies)
Discussion started by: ganapati
10 Replies

3. Shell Programming and Scripting

passing parameter from Shell-script to Sql-script

Dear Friends, Please help me to achieve the following: I want to pass one parameter from Shell-script to Sql-script. Example: My ShellScript.sh is calling report.sql like this: /bin/sqlplus /reports.sql And My report.sql is calling many Stored-Procedures like this: exec... (0 Replies)
Discussion started by: subodhbansal
0 Replies

4. Shell Programming and Scripting

Passing argumnets from shell script to sql

hi I all , I have sql statment in my shell script , I pass two argument to the script I need to pass the this two arguments to the sql statment example : runsql.sh "1" "2" sql : updat tables_x set y=0 where A=:x should subsituted by "1" and B=:y shuold subsituted bt "2"... (1 Reply)
Discussion started by: habuzahra
1 Replies

5. Shell Programming and Scripting

passing values from sql to shell script

Hi guyz, Posting a thread after a long time. I want to pass two variables to unix shell script from sql script. Note: I am calling sql script from unix script. sql script has 2 variables one is the return code for status of program run and second one email flag. I don't know how to capture... (3 Replies)
Discussion started by: sachin.gangadha
3 Replies

6. Shell Programming and Scripting

Passing Filename as a Parameter to Another script

Hi, I have a requirement to write a script file(script1.sh) to read the file from the folder say /usr1/profiles/active and pass the file name as a parameter to another script file say (script2.sh) which would subsitute this parameter. The script2.sh will have a line like the one below ... (1 Reply)
Discussion started by: ravisg
1 Replies

7. Shell Programming and Scripting

Help required in passing multiple arguments from a shell script to a pl/sql block

Hi, hope everyone are fine. Please find my issue below, and I request your help in the same In a configuration file, i have a variable defined as below TEST = 'One','Two','Three' I am trying to pass this variable in to a sql script which is define in a pl/sql block as follows, In the... (1 Reply)
Discussion started by: ramakanth_burra
1 Replies

8. Programming

create a spool file based on values passed from korn shell to sql script

this is my issue. 4 parameters are passed from korn shell to sql script. parameter_1= varchar2 datatype or no value entered my user. parameter_2= number datatype or no value entered my user. parameter_3= number datatype or no value entered my user. parameter_4= number datatype or no... (5 Replies)
Discussion started by: megha2525
5 Replies

9. Shell Programming and Scripting

Passing the result of an anonymous pl/sql block to a shell script

Hello, Here is the code i have written to get the count of a plsql query back to the unix. function checkforCOIDs { countcheck=`sqlplus -s $1/$2@$3 whenever oserror exit sql.oscode rollback whenever sqlerror exit sql.sqlcode rollback set serverout on size 2000; set head off feedback off... (2 Replies)
Discussion started by: santosh2eee
2 Replies

10. Shell Programming and Scripting

Append date to sql*plus spool (log) file in shell script

SQL*Plus version : 11.2.0.4 OS : Oracle Linux 6.5 SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below. I am trying to append date ( $dateString ) to spool file as shown below. $ cat test2.sh #!/bin/bash... (4 Replies)
Discussion started by: kraljic
4 Replies
TIGERCRON(8)						      Administrator Commands						      TIGERCRON(8)

NAME
tigercron - Cron utility for Tiger UNIX Security Checker SYNOPSIS
tigercron [controlfile] [-B basedir] [tigeroptions...] DESCRIPTION
Tigercron is used to run periodically checks from the Tiger UNIX Security Checker. Tigercron reads a control file which is usually located in '/etc/tiger/cronrc' although it can also be specificied as the first argument when calling the program. The format of this control file is the same as for the cron program, each line indicates when different checks from Tiger will be run. The user can indicate where Tiger is installed through the -B basedir parameter, any other additional options provided in the command line will be passed on to configure to configure Tiger based on them (as described in tiger (8)). Tigercron runs the specified checks and compares their reports with previous stored reports (under /var/log/tiger). It will then mail the user defined in '/etc/tiger/tigerrc' (Tiger_Mail_RCPT) the results. When a module is run, tigercron checks: o If Tiger_Cron_Template is set to Y in tigerrc. If it is, it checks if there is a template stating which are the expected results. o If Tiger_Cron_CheckPrev is set to Y in tigerrc. If it is, it checks if there is a previous run of the module it can check against. A differential report is generated depending on the module reports and previous run and is sent through e-mail. These reports provide an easy way to detect intrusions even if no configuration of templates has been done. In the event of an intrusion a Tiger check might detect something specific (file changes, new processes, new users, etc.) and this alert mechanism provides a way to turn Tiger into a Host Intru- sion Detection System (HIDS). The ability of it to work as a proper HIDS is based on a good customization of the cronrc file. Modules that check events to which the host is most exposed to should be run often in order to detect deviations from normal behaviour. OPTIONS
Tigercron uses the same options as Tiger. A controlfile can be defined also to override the default. FILES
/etc/tiger/tigerrc Configuration file for the Tiger tool. /etc/tiger/cronrc Configuration file for the Tigercron tool. /var/log/tiger Location of the log messages generated by Tiger when run through cron /var/lib/tiger/work Working directory used by Tiger scripts to create temporary files. SEE ALSO
tigexp(8),tiger(8),cron(8),crontab(5) The deficiencies of using tigercron as a HIDS are described in the file README.hostids which is provided with the package. In Debian GNU/Linux you will find this (and other related) documentation at /usr/share/doc/tiger/ BUGS
Currently Tigercron has only one alert mechanism (mail) and signatures are not supported. Thus, alerts could be faked. Also, it is depen- dant on cron and will not work if cron is not working. AUTHOR
This manpage was written by Javier Fernandez-Sanguino. Security 19 September 2003 TIGERCRON(8)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy