Execute oracle commands with root login

Posted on 2004-11-30
Last Modified: 2013-12-27
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?

Question by:janu_s
    LVL 40

    Accepted Solution

    As root, 'su -oracle -c <backup command>' should work, provided that the <backup command> doesn't require a password.
    LVL 38

    Assisted Solution

    It should be:
        su - oracle -c <backup command>

        Need a WHITE SPACE between - and oracle.
    LVL 40

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
    This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now