11-11-2008
put value of multiple sql statements into unix variables
i want to use multple sql count statements and store these count values in unix variable but in one connection only i.e. in only 1 time database should be hit ,which is the main requirement.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to close of multiple users in an Oracle database. Each users has records in multiple tables what I need to do is use a script that call each SQL seperately passing either CLI arguments or gathered arguments from the users during run time.
## Accept variable(s) from the command line... (1 Reply)
Discussion started by: jagannatha
1 Replies
2. Shell Programming and Scripting
How to write multiple echo statements in unix?
echo "************************************************************************************************************";
echo This Script do the following functions
echo 1. Point 1
echo 2. Point 2
echo 3. Point 3
echo... (2 Replies)
Discussion started by: Shrutiduggal
2 Replies
3. Solaris
Hello,
On unix side, I have written below script for taking oracle db backup. But when I tried to execute it - i could not execute the sql statements from unix.
Please suggest
------------------------
$ more bkp.sh
#!/bin/ksh
# make sure database is shutdown cleanly
sqlplus '/ as sysdba'... (3 Replies)
Discussion started by: panchpan
3 Replies
4. Shell Programming and Scripting
I've got:
isql -U $USERID -S $SERVER -D $DATABASE -i inputfile.sql -o outputfile.txt
in inputfile I have:
go
sql#1
go
sql#2
go
sql#3
go
I also tried without "go" and with";" instead which did not work
SQL statements will work if I paste them directly into the script and use EOF
... (0 Replies)
Discussion started by: Cailet
0 Replies
5. Shell Programming and Scripting
How do I dynamically assign the below output to unix shell variables
so I can build a menu in a shell script?
Example:
var1 = 1 var2= SYSTEM
var3 = 2 var4= UNDOTBS1
and so on, then in the shell script I can use the variables to build a menu.
set serveroutput on
declare... (2 Replies)
Discussion started by: djehres
2 Replies
6. Shell Programming and Scripting
This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Discussion started by: lmu
2 Replies
7. Shell Programming and Scripting
Hi,
I have a script where I make a sqlplus connection. In the script I have multiple sql queries within that sqlplus connection. I want the result of the queries to be stored in shell variables declared earlier. I dont want to use procedures. Is there anyway else.
Thanks in advance..
Cheers (6 Replies)
Discussion started by: gonchusirsa
6 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have connected to oracle database with sqlplus -s / <<EOF
select ename, age from emp where empid=1234;
EOF
I want to save the values of ename and age in unix shell variables. Any pointers would be welcome..
Thanks in advance!!1
Cheers :):):):) (1 Reply)
Discussion started by: gonchusirsa
1 Replies
9. Shell Programming and Scripting
Dear All,
I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File.
The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files.
Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies
10. Shell Programming and Scripting
Hi All,
I need to read values of 10 columns from oracle query and assign the same to 10 unix variables. The query will return only one record(row).
I tried to append all these columns using a delimiter(;) in the select query and assign the same to a single variable(V) in unix. I thought I... (3 Replies)
Discussion started by: hkrishnan91
3 Replies
LEARN ABOUT CENTOS
rlm_sql_log
rlm_sql_log(5) FreeRADIUS Module rlm_sql_log(5)
NAME
rlm_sql_log - FreeRADIUS Module
DESCRIPTION
The rlm_sql_log module appends the SQL queries in a log file which is read later by the scripts/radsqlrelay Perl program.
The purpose of this module is to de-couple the storage of long-term accounting data in SQL from "live" information needed by the RADIUS
server as it's running. If you are not using SQL for simultaneous login restrictions (i.e. "sql" is not listed in the "session" section of
"radiusd.conf"), then this module allows you to log SQL queries to a file, and then process them at your leisure.
The benefit of this approach is that for a busy server, the overhead of performing SQL qeuries may be significant. Also, if the SQL data-
bases are large (as is typical for ones storing months of data), the INSERTs and UPDATEs may take a relatively long time. Rather than
slowing down the RADIUS server by having it interact with a database, you can just log the queries to a file, and then run those queries on
another machine, or at a time when the RADIUS server is typically lightly loaded.
If the "sql" module is listed in the "session" section of "radiusd.conf", then a similar system can still be used. In that case, one data-
base would be used to maintain "live" session information. That database would be small, fast, and information would be deleted from it
when a user logs out. A second database would store long-term accounting information, as described above.
LIMITATIONS
This module only performs the dynamic expansion of the variables found in the SQL statements. No operation is executed on the database
server. (this would be done later by an external program) That means the module is useful only with non-"SELECT" statements.
CONFIGURATION
The main configuration items to be aware of are the path of the log file and the different SQL queries.
path An entry named "path" sets the full path of the file where the SQL queries are recorded. (this variable is run through dynamic
string expansion, and can include FreeRADIUS variables to create a dynamic filename)
Accounting queries
When a accounting record is processed, the module searches a config entry keyed by the Acct-Status-Type attribute present in the
packet. For example, the SQL to be run on an accounting start must be named "Start" in the configuration for the module. Other usual
values for Acct-Status-Type are "Stop", "Alive", "Accounting-On", etc. See the VALUEs for Acct-Status-Type in the dictio-
nary.rfc2866 file.
Post-Auth query
An entry named "Post-Auth" sets the query to run during the post-authentication stage. This query is mainly used to log sessions
where there may not be a later accounting packet.
modules {
...
sql_log {
path = "${radacctdir}/sql-relay"
acct_table = "radacct"
postauth_table = "radpostauth"
sql_user_name = "%{%{User-Name}:-DEFAULT}"
Start = "INSERT INTO ${acct_table} ..."
Stop = "UPDATE ${acct_table} SET ..."
Alive = "UPDATE ${acct_table} SET ..."
Post-Auth = "INSERT INTO ${postauth_table} ..."
}
...
}
accounting {
...
sql_log
...
}
post-auth {
...
sql_log
...
}
SECTIONS
accounting, post-auth
FILES
/etc/raddb/radiusd.conf
SEE ALSO
radsqlrelay(8), radiusd(8), radiusd.conf(5)
AUTHOR
Nicolas Baradakis <nicolas.baradakis@cegetel.net>
28 May 2005 rlm_sql_log(5)