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

  • 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>

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

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

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

    Need a WHITE SPACE between - and oracle.

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