Exracting data from DB using normal login


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exracting data from DB using normal login
# 1  
Old 03-10-2007
Exracting data from DB using normal unix login

Hi All,

I ve a to extract data from oracle database . I already wrote code for the same

----------------------------------------------------------------------------------------
/u01/oracle/10.2/db_tst/bin/sqlplus -s $LOGIN/$PASS@$DBCONN <<-END > ${DSTDIR}/${FLNAME}
set serveroutput on;
set head off;
set feed off;
set timing off;
set pages 0;
set line 200
$QUERY
EXIT;
END
----------------------------------------------------------------------------------------

Now , the issue is to execute this from a login named tester other than oracle

iam not able to execute "/u01/oracle/10.2/db_tst/bin/sqlplus" from tester . The error coming up is "Permission Denied"

The permissions for /u01/oracle/10.2/db_tst/bin/sqlplus are as rwxr-xr-x

How to execute the command using normal login?

Thanks in Advance

Last edited by malle; 03-10-2007 at 03:45 AM..
# 2  
Old 03-10-2007
I think you can try with super user command 'su'...
You can try something like below:

su - user_to_execute -c "sqlplus username/password < inp_sql_file > result_file"
ex:

su - user1 -c "sqlplus orauser1/password < inp.sql >out.sql
# 3  
Old 03-10-2007
i tried with that. su command is interactively asking for password.

then i executed the command as below

su - oracle -c "sqlplus scott/tiger@db_tst" < a

where file 'a' contains password for oracle user.

i got the error "Standard in must be a tty"
# 4  
Old 03-10-2007
Hi malle,

You can't provide password like that...And I don't think you can set up an automatic login and execution of a command without user interaction while using "su" command .

the best bet will be going for tools such as expect
http://expect.nist.gov

It would be great and useful if there anyone having any other idea?

Thank you.
# 5  
Old 03-10-2007
what is the permission for /u01/oracle/10.2/db_tst/bin/ ?
# 6  
Old 03-10-2007
premissions for /$ORACL_HOME/bin/sqlplus : rwxr-x--x
# 7  
Old 03-10-2007
Quote:
Originally Posted by malle
premissions for /$ORACL_HOME/bin/sqlplus : rwxr-x--x
for another user to execute the sqlplus command, the 'others' permission group should have 'r' and 'x' enabled. give a read permission to sqlplus and try again.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Python FTP login and relogin with other data in one wash?

I have a short part of the script like this, which scrans ftp ips from a list and login with the data specified. login1 pssword1is it possible to try sevral login data without starting the script again with modified login data? somehow like: if (login1 pw1 or login2 pw2 or login3 pw3) {... (0 Replies)
Discussion started by: lowmaster
0 Replies

2. UNIX for Dummies Questions & Answers

Normal format and scientific combined data

hi guys, i have a data with a column of p value (normal format and scientific combined). i want to creat a subset of data which only contains p-value: data 1: p<10^7 data 2: p<0.01 how should i do it? many thanks! data looks like: rs7841347 128887490 1.695e-007 rs1241347 ... (4 Replies)
Discussion started by: forevertl
4 Replies

3. Solaris

Unable to login Solaris 10 Sparc - Data Access Error

Hello everyone, This is the first time I am installing Solaris. I have SunBlade 1500 Wrkstn. I installed Solaris 10 Sparc. The installation went successfully but I don't get the login screen. I get the following error message: Boot device: disk:a File and agrs:- Data Access Error Ok ... (4 Replies)
Discussion started by: mfsaeed
4 Replies

4. Shell Programming and Scripting

float to normal

I have a file with 2 columns . One of the line looks like the following. Is it possible to convert every float no in column 2 to integer. input NM_032881 6.03787973608527e-05 output 0.0000603787..... (2 Replies)
Discussion started by: quincyjones
2 Replies

5. Shell Programming and Scripting

mailx requirement - email body header in bold and data content in normal text

Dear all- I have a requirement to send an email via email with body content which looks something below- Email body contents -------------------- RequestType: Update DateAcctOpened: 1/5/2010 Note that header information and data content should be normal text.. Please advice on... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

6. UNIX for Dummies Questions & Answers

get the normal time

i have this script #!/bin/sh for i in Europe/Dublin Europe/Berlin US/Eastern US/Central US/Mountain US/Pacific do export TZ=$i case $1 in "") echo "`date` $i";; *) echo "`date` $i" | grep $1;; esac done how would i turn the time into the stand 12 hour time? (1 Reply)
Discussion started by: JamieMurry
1 Replies

7. AIX

Normal User Unable to Login Through AIX CDE

When we as normal user try to login, the session startup terminates and we are presented with the login screen.The root user is able to login without any problem.I can log in to the Aix server as normal user through telnet & using xmanager but not directly through server terminal .The Aix version... (1 Reply)
Discussion started by: ranadeep
1 Replies

8. Shell Programming and Scripting

unzip particular gzip files among the normal data files

Hello experts, I run Solaris 9. I have a below script which is used for gunzip the thousand files from a directory. ---- #!/usr/bin/sh cd /home/thousands/gzipfiles/ for i in `ls -1` do gunzip -c $i > /path/to/file/$i done ---- In my SAME directory there thousand of GZIP file and also... (4 Replies)
Discussion started by: thepurple
4 Replies

9. Solaris

Enable console login for normal users

Dear Frnz I have a solaris box with running 5.8 My default window manager is CDE.When i login as a normal user and try to open console it is vanishing quickly. When i check the logs the message is Wed Nov 21 19:27:03 2007 (/usr/dt/bin/dtexec) /usr/dt/bin/dtterm /dev/console: Permission... (1 Reply)
Discussion started by: sriram.s
1 Replies

10. AIX

Not able to login as normal users through console /telnet/ssh

Hi , I am having problem,users are not able to login through ssh or telnet.Only we can login as root user in console. Restarted telnet and sshd ,no luck. Any ideas. AIX -- 5.2 ML 07 Thanks, MNK (1 Reply)
Discussion started by: mnkfre
1 Replies
Login or Register to Ask a Question