Home » Infrastructure » Unix » solaris script for running sql statement (oracle 11 g r2 RAC of 2 nodes, solaris 10 and ASM)
solaris script for running sql statement [message #675881] Sat, 27 April 2019 03:15 Go to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
Good day to everyone
i wanted to have script which connect oracle as "oracle" user and run a sql statement and then exit the sql environment. what would be the privilages of that user who run this script as i dont want that user to have any rights in solaris other then running that script. how to acheive it
please help

Regards
Re: solaris script for running sql statement [message #675882 is a reply to message #675881] Sat, 27 April 2019 03:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

1/ "oracle" OS user is not a good name for this
2/ Apart from that there is nothing special for this user (at OS level), put it in "guest" group or the like your sysadmin defined for this kind of user.

[Updated on: Sat, 27 April 2019 03:29]

Report message to a moderator

Re: solaris script for running sql statement [message #675883 is a reply to message #675882] Sat, 27 April 2019 03:57 Go to previous messageGo to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
thank u for your time
we have this convention from last 14 yrs and it is the "Oracle" who can do all admin task on database.i.e after login as oracle user , he/she can simply connect sqlplus as "conn sqlpus / as sysdba". as i dont have root user account on this.
so how to write that script. dont know at all about this

please some more guidelines

regards
Re: solaris script for running sql statement [message #675885 is a reply to message #675883] Sat, 27 April 2019 04:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

[quote he/she can simply connect sqlplus as "conn sqlpus / as sysdba"][/quote]

Simply? It can then simply screw, drop your database or/and all your data.

Quote:
as i dont have root user account on this
Hopefully, why should one that reports or administers a database have admin privileges on the server? sysadmin <> dba

Quote:
so how to write that script
Just read the topics in this forum or simply google they are plenty of examples here and on the web.
Pick the one that more suits your needs.

Re: solaris script for running sql statement [message #675886 is a reply to message #675885] Sat, 27 April 2019 04:37 Go to previous messageGo to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
didnt really understood. let me google and find some script which can be run by other then admin and get that sql executed and see the result and then he gets out so he cant do anything adventerous and at the same time he should not read the script to find out the password for oracle..
Re: solaris script for running sql statement [message #675887 is a reply to message #675886] Sat, 27 April 2019 05:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You don't need to be OS admin to execute a script (SQL or shell).
You just need a user who can connect to the server, have the execute privilege on sqlplus binary (that is everyone if you use the default) and have an account on the database.
What is your actual problem?

Re: solaris script for running sql statement [message #675892 is a reply to message #675887] Sat, 27 April 2019 14:00 Go to previous messageGo to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
yeagh great now its making sense to me and that is what i want .
my issue is that we need to execute a sql statement to know some results like a count of values. now i am not always there to execute that statement so the management decided that who ever on duty so he should be able to execute some script which conatin that sql statement but that guy should only see the result of that query and inform someone if requrir. now i am newbie in this regard. it will be ideal that there should be some executable and that guy double click it and result shown and thats it. how can i acheive this . please share some scripts or i dont know some jar files can do it .

Regards,
Re: solaris script for running sql statement [message #675895 is a reply to message #675892] Sat, 27 April 2019 14:31 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Double-click?
You are on the server or your PC?

Re: solaris script for running sql statement [message #675897 is a reply to message #675895] Sat, 27 April 2019 14:35 Go to previous messageGo to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
i mean to execute on server please
Re: solaris script for running sql statement [message #675899 is a reply to message #675897] Sat, 27 April 2019 14:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

sqlplus user/psw @script

This is the basic.
Please read the documentation.

[Updated on: Sun, 28 April 2019 01:55]

Report message to a moderator

Re: solaris script for running sql statement [message #675904 is a reply to message #675899] Sat, 27 April 2019 15:12 Go to previous messageGo to next message
janakors
Messages: 232
Registered: September 2009
Senior Member
i already have this script . i runt it as . ./script . it has that sql statement which do the job. but i can 'more' it i.e see that script. now i want a user in solaris who can't see it but he can execute it. i am not solaris admin
Re: solaris script for running sql statement [message #675905 is a reply to message #675904] Sun, 28 April 2019 01:55 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And this is an Oracle database (and related tools) forum not a Solaris one.
So this question bears no real connection with Oracle database.
The topic is locked. /forum/fa/448/0/
If I'm wrong, please, PM me (or report this message to a moderator, explain why you think it should be unlocked and it might be done).

Previous Topic: How to Send email after script runs
Next Topic: How to use SCP Command
Goto Forum:
  


Current Time: Thu Mar 28 09:05:18 CDT 2024