You are on page 1of 2

3/14/2015

Create "oracle" User & .bash_profile file

Create "oracle" User &


.bash_profile file
Create "oracle" User and Directories
This section covers the steps required to create the UNIX groups (oinstall, dba, and oper) and user (oracle) that will be used to install
the Oracle Database 11g software.The following O/S groups will be created:
Description

Oracle Privilege Oracle Group Name UNIX Group name

Oracle Inventory and Software Owner


Database Administrator

oinstall
SYSDBA

OSDBA

dba

Database Operator

SYSOPER

OSOPER

oper

ASM Administrator

SYSASM

OSASM

OSDBA Group for ASM

asm
asmdba

Note that members of the UNIX group oinstallare considered the "owners" of the Oracle software. Members of the dbagroup can
administer Oracle databases, for example starting up and shutting down databases. New to Oracle 11g is the SYSASM privilege that is
specifically intended for performing ASM administration tasks. Using the SYSASM privilege instead of the SYSDBA privilege provides a
clearer division of responsibility between ASM administration and database administration. OSASMis a new operating system group that is
used exclusively for ASM. Members of theOSASMgroup can connect as SYSASM using operating system authentication and have full
access to ASM. The final group (asmdba) is the OSDBAGroup for ASM. You must create an OSDBAgroup for ASM to provide access to the
ASM instance. This is necessary if OSASMand OSDBAare different groups. In this article, we are creating the oracleuser account to have
all responsibilities!

Note that although we will be creating the ASM O/S group and granting it to
the oracleuser account, this article does not make use of ASM. Any mention
of ASM in this article is for documentation purposes only!
The UNIX group oinstallis used by organizations that have separate teams responsible for maintaining the Oracle software and the
database(s). In situations like this, the group membership prevents unauthorized access to the database by personal who only maintain
the Oracle software. At the same time, it also prevents database administrators from making modifications to the database software and
the installation's Inventory directory.
If you intend to use the oinstallgroup during the installation process, then you must set the default group to the one that will be
maintaining the database before creating the database or permission problems will arise. In this article, we will be taking care of this issue
when we install the database software.
The thing to keep in mind is that the UNIX oinstallgroup (as well as oper, and asm) is completely optional and is not required if the
same individuals will be maintaining the Oracle software, database, and ASM (if used). Some consider it unnecessary work which adds
another layer of complexity to the maintenance of the installation. In this type of scenario, all that would be required is the UNIX
group dba(and assigning dbaas the primary UNIX group for the "oracle" user account).
This article (along with other Oracle installation guides on this site) adhere to the Optimal Flexible Architecture (OFA) and create both
the oinstalland dbaUNIX groups.

This guide adheres to the Optimal Flexible Architecture (OFA) for naming
conventions used in creating the directory structure.

Create Group and User for Oracle


Lets start this section by creating the UNIX O/S groups and oracleuser account:
# groupadd -g 501 oinstall
# groupadd -g 502 dba
# groupadd -g 503 oper
# groupadd -g 504 asm
# groupadd -g 506 asmdba
# useradd -m -u 501 -g oinstall -G dba,oper,asm -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asm)
Set the password for the oracleaccount:
# passwd oracle
Changing password for user oracle.
New UNIX password: xxxxxxxxxxx
Retype new UNIX password: xxxxxxxxxxx
passwd: all authentication tokens updated successfully.

Verify That the User nobody Exists


Before installing the Oracle software, complete the following procedure to verify that the user nobody exists on the system:
1. To determine if the user exists, enter the following command:
# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
If this command displays information about the nobody user, then you do not have to create that user.
2. If the user nobodydoes not exist, then enter the following command to create it:
# /usr/sbin/useradd nobody
data:text/html;charset=utf-8,%3Cdiv%20class%3D%22article-header%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20padding

1/2

3/14/2015

Create "oracle" User & .bash_profile file

Create the Oracle Base Directory


The next step is to create a new directory that will be used to store the Oracle Database software. When configuring
the oracleuser's environment (later in this section) we will be assigning the location of this directory to
the $ORACLE_BASEenvironment variable.After the directory is created, you must then specify the correct owner, group, and
permissions for it.
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app
# chmod -R 775 /u01/app
At the end of this procedure, you will have the following:
/u01owned by root.
/u01/appowned by oracle:oinstallwith 775 permissions. This ownership and permissions enable the OUI to create
theoraInventorydirectory, in the path /u01/app/oraInventory.
/u01/app/oracleowned by oracle:oinstallwith 775 permissions.

Create Directory for Database Files


Let's now create the directory that will be used to store the Oracle database files and backup files (on the /u02file system):
# mkdir -p /u02/oradata
# chown oracle:oinstall /u02/oradata
# chmod 775 /u02/oradata
# mkdir -p /u02/flash_recovery_area
# chown oracle:oinstall /u02/flash_recovery_area
# chmod 775 /u02/flash_recovery_area

Create Login Script for oracle User Account


To ensure that the environment is setup correctly for the "oracle" UNIX user account, use the
following .bash_profile:Login to the database server as the oracleuser account:
# su - oracle
.bash_profilefor Oracle

User

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
alias ls="ls -FA"
alias s="screen -DRRS iPad -t iPad"
export JAVA_HOME=/usr/local/java
# User specific environment and startup programs
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_PATH=$ORACLE_BASE/dba_scripts/common/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=TESTDB
export PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/dba_scripts/common/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp

Posted 30th December 2011 by esadba

data:text/html;charset=utf-8,%3Cdiv%20class%3D%22article-header%22%20style%3D%22margin%3A%200px%3B%20outline%3A%20none%3B%20padding

2/2

You might also like