When you install an Oracle database in a Unix server, the Unix user id you use for the installation becomes the OWNER of the database. What is the most reliable and general way of determining in a shell script which Unix user is the owner of an Oracle installation? I mean, can you perform a grep on a file created by the installation to find this information or shall I resort to use the ls command on a specific file on a specific directory. If the name of the file to be checked is also variable, I would need to have a way of determining the name and path to the file.

  • Is there a way to know the oracle owner when the database instance was not created using oracle installer so there is no oratab file? May 5, 2010 at 20:35

3 Answers 3


Look for the file named "oratab", usually found in either /etc or /var/opt/oracle. In there you will find for each database the name of the home directory for that database. The owner of that directory should be the owner of the installation and of all databases running from the home.

This might be of some use, assuming the oratab file is in /var/opt/oracle:

ls -ld `grep 'your_db_name' /var/opt/oracle/oratab|cut -d":" -f2`|cut -d" " -f4

The other solutions offered here that examine the owner of the process should work as well, but require the database to be running. This solution offers the advantage that it does not require the instance to be up.

  • My understanding is that the oratab file has data when you install the database using the Oracle installer, so this solution won't work whenever the database instance is not created with the installer. However, this solution is good enough for me. Thanks a lot. May 5, 2010 at 20:16
  • Good practice is to maintain this file as you add databases. For one thing, it controls whether or not to start the database automatically when the system starts. See orafaq.com/faq/what_is_oratab_and_what_is_it_used_for for a brief overview.
    – DCookie
    May 5, 2010 at 20:49

I'm not a professional Oracle DBA, but it has been my experience that the owner of the database is the owner of the Oracle processes. A reliable process to check would probably be ora_pmon.

  • Thank you for complementing solefald's solution with the necessary piece: the name of the process to look for. May 5, 2010 at 20:34
ps -ef | grep <process name or id> | awk '{print $1}'

this should give you the name of the user process is running as.

  • In conjunction with Gary Chambers' suggestion, the command you provide can be used to look for the pmon process. What happens when there are many oracle instances on the same machine, will the command display several pmon rows, one for each user? May 5, 2010 at 20:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .