woensdag 29 februari 2012

Setup the Oracle account and the directory structure.

Create the Oracle inventory group:
When you install Oracle software on the system for the first time, Oracle Universal Installer creates the oraInst.loc file. This file identifies the name of the Oracle Inventory group (typically, oinstall) and the path of the Oracle Inventory directory.
  • Determine if the oraInst.loc file exists:  more /etc/oraInst.loc
    If the oraInst.loc file exists, then the output from this command is similar to the following: inventory_loc=/u01/app/oraInventory
    inst_group=oinstall
  • Determine if the Oracle Inventory group exists: grep oinstall /etc/group
  • If the oraInst.loc file does not exist, then create the Oracle Inventory group:
    /usr/sbin/groupadd oinstall
 
Create the OSDBA group:
/usr/sbin/groupadd -g 502 dba 

Create the OSOPER group (optional):
/usr/sbin/groupadd -g 503 oper

Create the OSASM, OSDBA and OSOPER groups for ASM:If you intend to use ASM, then also create the following groups:

/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 505 asmoper
 
Create the Oracle software owner user: 

 
/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba,[oper] oracle 
 
Set the password of the oracle user:
passwd oracle 

Modifying an Existing Oracle Software Owner User

If the oracle user exists, but its primary group is not oinstall, or it is not a member of the appropriate OSDBA or OSOPER groups, then modify it as follows:

/usr/sbin/usermod -g oinstall -G dba,asmdba[,oper] oracle

Checking Resource Limits for the Oracle Software Installation Users:

Resource Shell Limit Resource Soft Limit Hard Limit
Open file descriptors nofile at least 1024 at least 65536
Number of processes available to a single user nproc at least 2047 at least 16384
Size of the stack segment of the process stack at least 10240 KB at least 10240 KB, and at most 32768 KB
  1. Log in as the Oracle software iowner user (typically: oracle)
  2. Check the soft and hard limits for the file descriptor setting.
    $ ulimit -Sn
    1024
    $ ulimit -Hn
    65536
    
  3. Check the soft and hard limits for the number of processes available to a user.
    $ ulimit -Su
    2047
    $ ulimit -Hu
    16384
    
    
  4. Check the soft limit for the stack setting.
    $ ulimit -Ss
    10240
    $ ulimit -Hs
    32768
    
    If necessary, update the resource limits in the /etc/security/limits.conf configuration file for the installation owner. 
    For example, add the following lines to the /etc/security/limits.conf file:
    oracle soft nproc 2047
    oracle hard nproc 16384
    oracle soft nofile 1024
    oracle hard nofile 65536
    oracle soft stack 10240 
When the limits.conf file is changed, these changes take effect immediately.
But logged on users will not see the change yet => log off all connections as user oracle.

ORACLE_BASE:
The Oracle base directory is a top-level directory for Oracle software installations.
The Optimal Flexible Architecture (OFA) guidelines recommend that you use a path similar to the following for the Oracle base directory:
/mount_point/app/software_owner

E.g: /u01/app/oracle

If different operating system users install Oracle software on the same system, then each user must create a separate Oracle base directory.

Example of a second ORACLE_BASE that exists on the same system: /u01/app/orauser

Indentifying an existing ORACLE_BASE directory:
After you locate the Oracle home directory (see next paragraph), run a similar command to confirm the location of Oracle base:
cat /u01/app/oraInventory/ContentsXML/inventory.xml

Before deciding to use an existing Oracle base directory for this installation, ensure that it meets the following conditions:
  • It is not on the same file system as the operating system.
  • It has sufficient free disk space, as follows:
    Requirement Free Disk Space
    The Oracle base directory contains only software files. Up to 4 GB
    The Oracle base directory contains both software and database files (not recommended for production databases). Up to 6 GB
 
Create the ORACLE_BASE directory, and set the correct permissions: 
 
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/app/oracle

ORACLE_HOME:

The directory that you specify must be a subdirectory of the Oracle base directory. Oracle recommends that you specify a path similar to the following for the Oracle home directory
$ORACLE_BASE/product/11.2.0/dbhome_1

Oracle Universal Installer creates the directory path that you specify under the Oracle base directory.
It also sets the correct owner, group, and permissions on it. You do not have to create this directory (better not, you can run into issues if you set the wrong permissions).

Identifying an existing Oracle home directory


Enter the following command to display the contents of the oratab file:
# more /etc/oratab

If the oratab file exists, then it contains lines of code similar to the following:
*:/u03/app/oracle/product/11.2.0/dbhome_1:N
*:/opt/orauser/infra_904:N
*:/oracle/9.2.0:N

Oracle inventory directory:
Oracle recommends that you do not put the oraInventory directory under the Oracle base directory for a new installation (which is teh default if you set the ORACLE_BASE environment variable...).

/u01/app/orainventory


All Oracle software installations rely on the Oracle Inventory directory. Ensure that you back it up regularly.


Database file structure:
Database file directory:
# mkdir /mount_point/oradata
# chown oracle:oinstall /mount_point/oradata
# chmod 775 /mount_point/oradata




Recovery file directory (fast recovery area):
# mkdir /mount_point/fast_recovery_area
# chown oracle:oinstall /mount_point/fast_recovery_area
# chmod 775 /mount_point/fast_recovery_area

The fast recovery area (this was called the flash recovery area in 10g) should be on different physical disks than the datafiles (for recovery purposes).

Redo logs:
The members of the redo log groups should be spread over 2 different oradata directories, which are on 2 different physical disks.

Control files:
The 3 control files should be spread over at least 2 different disks (if possible over 3).

Creating a Udev Permissions File for Oracle Database:

With the 2. 6 kernel or later for Red Hat Enterprise Linux, Oracle Linux, and SUSE Linux Enterprise Server, you must create a permissions file to maintain permissions on Oracle database files.

If you do not create this permissions file, then permissions on disk devices revert to their default values, root:disk, and Oracle Database fails to start. Use the following steps to set the permissions file number:
  • On Red Hat Enterprise Linux 4 and Oracle Linux 4, you must create a permissions file number that is lower than 50.
  • On Asianux Server 3, Red Hat Enterprise Linux 5, Oracle Linux 5, SUSE Linux Enterprise Server 10, or SUSE Linux Enterprise Server 11, you must create a permissions file number that is higher than 50.
Create or modify the rules file in /etc/udev/rules.d to change the permissions of the data files from the default root ownership.

Ensure that the file you create is appropriate for your distribution. For example, name this file 99-oracle.rules on Asianux, Red Hat Enterprise Linux, Oracle Linux, and SUSE Linux Enterprise Server systems.

 Example 2-1 Example of a Rules File with User oracle
/etc/udev/rules.d/99-oracle.rules
#
# ASM disks
KERNEL=="sdb[6-9]", OWNER="oracle", GROUP="dba", MODE="0660"
KERNEL=="sdb10", OWNER="oracle", GROUP="dba", MODE="0660"
 
Example 2-2 Example of a Rules File with User grid
/etc/udev/rules.d/99-oracle.rules
#
# ASM disks
KERNEL=="sdb[6-9]", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdb10", OWNER="grid", GROUP="asmadmin", MODE="0660" 
 
Configuring the Oracle user's environment. 

Contents of /home/oracle/.profile: 
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH 
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:$LIBPATH
...
 
(I will copy over a .profile file of a working environment soon)
 
Before you run Oracle Universal Installer, make sure to unset the ORACLE_HOME:
unset $ORACLE_HOME
 
Set the DISPLAY variable: 
export DISPLAY=local_host:0.0 
 
Verify that X applications display properly. The following command should display a clock:
xclock
 

Geen opmerkingen:

Een reactie posten