[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Execute oracle commands with root login

I have oracle installed on a solaris system. Follwing is the problem we are facing and i couldn't find a good solution anywhere:

We need to execute some commands in oracle to take oracle database backups. For that it is required to be logged in as an oracle user. I want these backups to be automated and the most probable solution is using cron jobs. But the problem is that the oracle command which i want to execute under root login does not executed. Displays an error message for the command, because root does not have access to those commands. Is there a way to execute oracle commands without logging into oracle and without typing in password and simply execute as root. I will need a simple script file to do something like below
<All this is under root, the script file is stored under root>

foo.sh
su -oracle
<there is no prompt for password>
< backup command>
mailx -s "job done"


Does  su -oracle -c <backup command> work in this case?




0
janu_s
Asked:
janu_s
  • 2
2 Solutions
 
jlevieCommented:
As root, 'su -oracle -c <backup command>' should work, provided that the <backup command> doesn't require a password.
0
 
yuzhCommented:
It should be:
    su - oracle -c <backup command>

    Need a WHITE SPACE between - and oracle.
0
 
jlevieCommented:
True...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now