SSH Connection To Oracle


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SSH Connection To Oracle
# 1  
Old 04-02-2010
SSH Connection To Oracle

My problem is this....Smilie

Platform=Sun Solaris UNIX / Oracle 10g

1) I'm trying to SSH from my local system A to remote system B

2) Once connected, I need to sudo to ID that has the ability to connect to the Oracle database

3) Then run a script that connects via sqlplus and pulls data back to local machine, in directory of choice. Can this be done? Thanks in advance..

Here is the contents of my query/script i will be running..

select substr(decryptstr(cc_number,'&enc_key'),1,16), ';',
a.ACCOUNT_STATUS, ';',
substr(decryptstr(b.first_name,'&enc_key'),1,20), ';',
substr(decryptstr(b.last_name,'&enc_key'), 1,20), ';',
a.SYS_CREATION_DATE
from registration_info r, accounts a, addresses b
where r.cy_account_id=a.cy_account_id
and r.fi_id=a.fi_id
and r.CY_USER_ID = a.CY_USER_ID
and r.CY_USER_ID = b.CY_USER_ID
and r.FI_ID = b.FI_ID
and a.ADDRESS_ID = b.ADDRESS_ID
and r.fi_id = '12345.test';
# 2  
Old 04-03-2010
Oracle doesn't require an su. You might need to add the oracle path to your $PATH, but you'd connect as scott/tiger@SID. Otherwise, what's the question?

---------- Post updated at 13:08 ---------- Previous update was at 13:02 ----------

Better stated: yes. Your SSH session can use a heredoc to stream your resultset onto a redirect of your choosing. The SQL call can be local to your SSH call, or be stored in your remote machine, and echo to screen. Only downside here is that you're heavy on the network this way. Better to spool output to a file on the remote machine, and then transfer that file back locally.

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

Better stated: yes. Your SSH session can use a heredoc to stream your resultset onto a redirect of your choosing. The SQL call can be local to your SSH call, or be stored in your remote machine, and echo to screen. Only downside here is that you're heavy on the network this way. Better to spool output to a file on the remote machine, and then transfer that file back locally.
# 3  
Old 04-03-2010
yes the scenario stated is possible
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies

2. BSD

Connection SSH to remote by ssh

Hello guys! I am setting up a script to access a unix remote server. My problem is that when I put the ssh line "my host", the script does not wait for the server response asking for the password to execute the line in which I put the password, that is, I need to put a form in which script has a... (1 Reply)
Discussion started by: aroucasp
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. Programming

Help in pro*c for Oracle connection

hi, am making oracle connection through pro*c using the following command sample: exec sql connect username identified by password. but m getting the following errors frequently even though listener and db is running fine but some times code is working fine and not giving errors. ... (2 Replies)
Discussion started by: senkerth
2 Replies

5. Shell Programming and Scripting

Perl Oracle connection error

I've a Centralized Server which can connect to all Oracle Databases. When I was trying the below code it doesn't work, But tnsping was working fine. #!D:/perl5/bin/perl.exe use DBI; my $dbh = DBI->connect('dbi:Oracle:QBDIWCE', 'IDUSER', 'SECRET123#' ) || die( $DBI::errstr . "\n" ) ; ... (1 Reply)
Discussion started by: ilugopal
1 Replies

6. Shell Programming and Scripting

Oracle connection with UBUNTU

Hi all, Will I be able to connect to oracle using UBUNTU. If so, can any one provide me the steps. I want to try table archival and sql loader using control files. Please do help. Thanks, Raaga (1 Reply)
Discussion started by: Raaga
1 Replies

7. Shell Programming and Scripting

Get two variables from oracle in a single connection

Hi all In my script i am getting two variables year and month from oracle by making two connections. In the first connection i am getting varaibel year and again i am making another connection and getting month variable from oracle. Is there any way i can get two field values from oracle and... (1 Reply)
Discussion started by: vasuarjula
1 Replies

8. Windows & DOS: Issues & Discussions

Oracle 9i ODBC connection

I am attempting to access an Oracle 9i database located on a Solaris server from an XP client. The server is running Oracle 9i9.2.0.1.0 and the XP is Oracle client 9i 9.2.0.1.0. When I start a listener on the server, the listener starts but I receive a message “The listener supports no services”. I... (3 Replies)
Discussion started by: jkuchar747
3 Replies

9. UNIX for Advanced & Expert Users

Unix + oracle connection

Requirements: Using a shell script I have to check the 4 values from a table in Oracle and then store the result as "Y" in a Unix variable if the values are desired and "N" if the values are not desired. Explanation: There is a table abc in oracle which has 4 fields. if all the four values... (2 Replies)
Discussion started by: decci_7
2 Replies
Login or Register to Ask a Question