Help with SQL*Plus Connection


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with SQL*Plus Connection
# 1  
Old 05-06-2010
Question Help with SQL*Plus Connection

I "inherited" these scripts which are used to access an Oracle DB on a test envoiroment. Originaly someone from our security team would add an system user and password to the otherwise finished script and encrypt the whole thing. The encrypted file (script.x) would then be scheduled with Control-M.

Recently we decided to test new ways to connect to the DB and managed the following solution:

Code:
${ORACLE_HOME}/bin/sqlplus "`decrypt -a 3des -k ${DIR_CHAVES}/key.3des.aga -i ${DIR_CHAVES}/login.aga`"@orahmp01 <<EOF

Where login.aga is an encrypted file with DB user and password, key.3des.aga the key file for decryption, ${DIR_CHAVES} stores the path to the key diractory and orahmp01 is the DB instance.

It does work, however the system user and password are visible as clear text on the job sysout in Control-M.

Does anyone know how I can hide the decrypt output (user and password) and still logon to the database?

Thanks in advance.
# 2  
Old 05-06-2010
There are examples in this current thread. We just move the connect string to the program rather than stating it in the command line.

https://www.unix.com/shell-programmin...sqlplus-4.html
# 3  
Old 05-06-2010
I am not sure , but can you try by
Code:
 
 
option 1. Redirecting the output of the command to /dev/null
             1>/dev/null
         2. connect to the SQLPLUS using sqlplus -s

Let me know if things work out?
# 4  
Old 05-07-2010
Quote:
Originally Posted by panyam
I am not sure , but can you try by
Code:
 
 
option 1. Redirecting the output of the command to /dev/null
             1>/dev/null
         2. connect to the SQLPLUS using sqlplus -s

Let me know if things work out?
Hi, Panyam, thank you for your answer.

So far using sqlplus -s had no effect and I haven't found a way to redirect the command output without causing the script to end with an error.

The Connecting to Oracle DB using sqlplus thread didn't help either.

I'm also asking about this on http://www.scheduler-usage.com and it seems that on top of things I'm having permission problems because although I can order jobs and edit the shell script through Control-M, some job definition functions aren't working.

Right now the line looks like this:
Code:
${ORACLE_HOME}/bin/sqlplus -s "`decrypt -a 3des -k ${DIR_CHAVES}/key.3des.aga -i ${DIR_CHAVES}/login.aga`"@orahmp01 2>&1 > ${SQL_LOG} <<EOF

${SQL_LOG} captures only the result of the SQL query and saves it to a log, without username/password, but that's still showing on Control-M sysout.
# 5  
Old 05-07-2010
Are you using Control-M for Databases or just the scheduler?

---------- Post updated at 08:13 AM ---------- Previous update was at 08:01 AM ----------

I can't find any documentation on the distributed product, but in the zOS version of Control-M when you set up a job and the shouts that it will perform after completion, you can select the destination. On the PostProc tab instead of the "TO" field being the console or the log, select your userid, or that of the DBA's. They will get the message, but it won't display in the log, or at least it isn't supposed to.

Maybe that will help a little. Sorry I don't know more.
# 6  
Old 05-07-2010
Did you try this:
Code:
${ORACLE_HOME}/bin/sqlplus "`decrypt -a 3des -k ${DIR_CHAVES}/key.3des.aga -i ${DIR_CHAVES}/login.aga >/dev/null`"@orahmp01 <<EOF

# 7  
Old 05-07-2010
MySQL

Thanks everyone!

So far all attempts ro redirect the output in the code prevented logon to the database and caused the job to abend. I did get an answer here: Scheduler-Usage. I'm using the delete option under sysout handling (postproc tab).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use for loop to execute multiple .sql files while using SQLPLUS for db connection.?

Hello , Im calling every single file inside my script like 1.sql,2.sql so on it looks so tedious. I want to replace with for loop where every file gets executed. When i use for loop im getting errorUnexpected EOF] , can anyone please help me out in this.. How i can use for loop to invoke my... (6 Replies)
Discussion started by: preethi87
6 Replies

2. UNIX for Dummies Questions & Answers

UNIX string connection to sql server db

Hi, i have to perform a connection from unix to sql server database, using TCP protocol. I have all connection parameters (user,pwd,server_name,port,db_name). How can i perform this connection, by unix console ? is it available a command similar to this one (for oracle): sqlplus... (1 Reply)
Discussion started by: nash83
1 Replies

3. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

4. UNIX for Dummies Questions & Answers

Test new DSN connection to sql server

I installed an odbc driver and created a DSN to connect to a sql server database on AIX 6. I want to know how to test the DSN from the command line. What syntax or commands do I use? ---------- Post updated at 11:44 AM ---------- Previous update was at 08:26 AM ---------- OK I figured out how... (9 Replies)
Discussion started by: Jdbrown239
9 Replies

5. Shell Programming and Scripting

SQL query in a loop with single sqlplus connection

Hi, I'm trying to build a shell script that reads a set of accounts from a file. For each account I need to perform a set of sql queries. So I have a loop with a set of sqlplus connections to retrieved my data. Is it possible to have a single sqlplus connection before entering the loop and... (4 Replies)
Discussion started by: lsantacana
4 Replies

6. 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

7. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

8. Shell Programming and Scripting

Connection to Microsoft SQL Server

Hi, I am using "ksh" and trying to connect to the Microsoft SQL Server but it gives an error that is: DB-LIBRARY error: Unexpected EOF from SQL Server. Can any one please help me to resolve this issue. And i am using Putty to connect to the Unix server. Thanks (3 Replies)
Discussion started by: anupdas
3 Replies

9. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

10. UNIX for Dummies Questions & Answers

SQL Connection check though Scripting

Hi Guys, I wanted to check the sql connection through scripting if it is avilable then proceed else stop the process I was trying sqlplus -L username/passwd@sid if this is not sucess it gives non-zero. but if it is success it is going into the sqlplus prompt. So how could i get out... (2 Replies)
Discussion started by: Swapna173
2 Replies
Login or Register to Ask a Question