Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 


Go to solution
Jennifer Chiarelli
Regular Advisor


During startup I have a script I created in /sbin/rc3.d that will start a database. The database starts with root as the owner and this is not acceptable. How can I change the ownership during a system startup script?
None of my shell script books talk about this.
It's a binary world!
Honored Contributor

Re: Ownership


Because your startup script run as root, you can use the 'su' command to 'substitute user'.

Your startup script could contain for example following line:

su - oracle -c
See the su manpage for more details.

Hope this helps,
Deshpande Prashant
Honored Contributor

Re: Ownership

Add following lines in your start up script.
su - oracle -c 'lsnrctl start'
su - oracle -c 'dbstart'

similar for shutdown

su - oracle -c 'lsnrctl stop'
su - oracle -c 'dbshut'


Take it as it comes.
Jim Mulshine
Frequent Advisor

Re: Ownership

I find it useful to also modify the $ORACLE_HOME/bin/dbshut script to perform "shutdown immediate" instead of only "shutdown". Otherwise you may be waiting a long time for all your database users to log out.