Professional Documents
Culture Documents
Oracle 10g on Oracle Enterprise Linux 4 This document prepared just for informative and learning purposes for beginners. This is based on a server installation with a minimum of 2G swap. #
SELINUX = disabled i.e secure Linux disabled. Oracle 10g Installation minimum Requirements Following Package and Groups should be Installed X Window System GNOME Desktop Environment Editors Graphical Internet Text-based Internet Server Configuration Tools Development Tools Administration Tools System Tools (sysstat) Should add the package 'sysstat' by clicking on the Details link and selecting "sysstat. When installing linux all above package must be installed.
Alternative installations may require more packages to be loaded. Before installing just check what is in this file So before installing oracle , just check following command. # vi /etc/redhat-release or # cat /etc/issue Oracle Enterprise Linux is a distribution based on Redhat Enterprise Linux. Successful People in life seem to like LINUX
Page 1 of 29
Double size of the RAM Equal to the size of the RAM .75 times the size of the ram
Configuring the Linux Kernel Parameters To see all kernel parameters # sysctl -a , # sysctl -p Successful People in life seem to like LINUX
Page 2 of 29
Add the line below in /etc/pam.d/login file: session required pam_limits.so Successful People in life seem to like LINUX
Page 3 of 29
Page 9 of 29
Parameters for Shared Memory SHMALL : Controls maximum no of shared memory segments ,in pages.
SHMMAX : Controls the maximum shared segment size , in bytes. SHMMNI : Maximum number of shared memory segments, system wide. To verify Shared Memory Kernel Parameters SHMALL To verify , execute : # cat /proc/sys/kernel/shmall
SHMMAX To verify , execute : # cat /proc/sys/kernel/shmmax SHMMNI To verify , execute : # cat /proc/sys/kernel/shmmni SHMMIN To verify , execute : # ipcs -lm |grep "min seg size" To determine all Shared Memory limits, Run : $ ipcs -lm or $ ipcs -m -l Successful People in life seem to like LINUX
Page 10 of 29
These values represent SEMMSL, SEMMNS, SEMOPM, and SEMMNI. To determine all Shared Memory limits, Run : $ ipcs -ls or $ ipcs -s -l $ ipcs -ls ------ Semaphore Limits -------max number of arrays = 128 max semaphores per array = 250 max semaphores system wide = 32000 max ops per semop call = 100 semaphore max value = 32767
Page 11 of 29
Ex: Message queue, Semaphore arrays and Shared memory segments . ipcs -s Shows only semaphores. ipcs -m Shows only shared memory. ipcs -q Shows only message queues. By default, three types of objects are shown. (without options ipcs) prints short format for message queues, shared memory, and semaphores). $ ipcs ------ Shared Memory Segments -------shmid owner perms bytes nattch status
SHARED MEMORY and SEMAPHORES Shared memory and semaphores are two important resources for an Oracle instance on Unix/Linux systems.
SHARED MEMORY shmall, shmmax, shmmni SEMAPHORES semmsl, semmns, semopm, semmni
Page 12 of 29
SHARED MEMORY :Oracle uses shared memory in UNIX/LINUX to hold (SGA). Shared memory is exactly that - a memory region that can shared between different processes. Oracle uses shared memory for implementing the SGA, which needs to be visible to all database sessions. Oracle uses shared memory segments for the SHARED GLOBAL AREA (SGA) which is an area of memory that is shared by Oracle processes. $ ipcs lm shows all shared memory settings. Processes can exchange values in the shared memory. One process will create a portion of memory which other process can access. SHARED MEMORY required by the Oracle Instance : When Instance startup , that the instance does , Read the "init<SID>.ora" Start the background processes Allocate the shared memory and semphores required SGA is broken into following Sections Fixed Portion , which is constant in size, Variable Portion, which varies in size depending on "init.ora" parameters, Redo block buffer, which has its size controlled by log_buffers, DB block buffer, which has its size controlled by db_block_buffers. Successful People in life seem to like LINUX
Page 13 of 29
Oracle 10g Installation on Oracle Enterprise Linux - 4 Shared Memory Kernel Parameters
The size of the SGA should fit within one shared memory segment. SHMMAX should be slightly larger than the SGA size. Ex : SHMMAX = 2147483648 and SGA SIZE= 285212672 bytes If SHMMAX is too small, we can get error message similar to following error. ORA-27123: unable to attach to shared memory segment. For 64-bit Servers : Oracle Global Customer Support officially recommends a "maximum" for SHMMAX of " 1/2 of physical RAM " for 64-bit Servers. Half the RAM " 1/2 of physical RAM " on the server. Server has 128
GIGABYTES of
GIGABYTES.
Shmmax : This parameter is used to define the max size for a shared memory
segment it's enough for largest SGA size. Max size (in bytes) for a shared memory segment. Linux process can allocate in its virtual address space. Shmall : This parameter controls the total amount of shared memory (in pages) that can be used system wide. SHMALL should always be at least ceil(shmmax/PAGE_SIZE). The default PAGE_SIZE is on Linux system is 4096. Memory available on the system is bytes (shmall*PAGE_SIZE) 2097152*4096 which is 8 GB. To determine value of page_size is : $ getconf PAGE_SIZE. Shmmni : This parameter is used to set the maximum number of shared memory segments system wide. Oracle recommends SHMMNI to be 4096. The
default value is 4096 This value is sufficient doesnt need to be changed.
Page 15 of 29
Shmmin : This parameter controls the minimum size (in bytes) for a shared memory segment. The default value for shmmin is 1. To determine the value of shmmin : execute , # ipcs -lm | grep "min seg size"
Oracle recommends SEMMSL to be at least 250 for 10g R1/R2 database. If SEMMSL is not equal to PROCESSES, the total # of semaphores required (sum of PROCESSES) doesnt exceed the maximum (SEMMSL*SEMMNI : SEMMNS). For ex: If SEMMSL=25 and SEMMNI=10, total # of semaphores required (sum of PROCESSES)must not exceed 250 (10 semaphore sets * 25 semaphores/set). Semmni : This parameter defines the maximum number of semaphore sets for the entire Linux system. Oracle recommends SEMMNI to be at least 128 for 9i R2 and 10g R1/R2 databases on X86 platforms. Semmns : This parameter defines the total no of semaphores (not semaphore
sets ) for the entire Linux system.
Page 16 of 29
The maximum no of semaphores that can be allocated on a Linux system will be the lesser of: SEMMNS or (SEMMSL * SEMMNI). It's recommended to set to at least 32000 for 9i and 10g databases.
Semopm : This kernel parameter is used to control the number of semaphore
operations that can be performed per semop system call. Oracle recommends to set SEMOPM to a minimum value of 100 for 10g R1/R2 databases. The SEMOP system call (function) provides the ability to do operations for multiple semaphores with one semop system call. To see current kernel settings. # /sbin/sysctl -a | grep file-max # /sbin/sysctl -a | grep ip_local_port_range # /sbin/sysctl -a | grep rmem_default # /sbin/sysctl -a | grep shm : for shmall, shmmax, shmmni # /sbin/sysctl -a | grep sem : for semmsl, semmns, semopm, semmni Why "oracle" user and Directories Creating the UNIX groups (oinstall, dba, and oper) and user (oracle) that will be used to install the Oracle Database 10g software. The oinstall group (the Oracle Inventory group). The dba group (the OSDBA group). The oper group (the OSOPER group). Successful People in life seem to like LINUX
Page 17 of 29
dir can contain many ORACLE_HOME directories i.e. can have multiple Oracle versions with different
under ORACLE_BASE.
ORACLE_HOME Path will be /u01/app/oracle/product/10.2.0/db_1
$ cd $ORACLE_HOME bin rdbms sqlplus , etc .. If install ORACLE , bin , sqlplus , network/admin/ etc .. and all comes under
ORACLE_HOME directory.
Page 18 of 29
$ ORACLE_BASE=/u01/oracle/app $ export ORACLE_BASE $ ORACLE_HOME=$ORACLE_BASE/product/10.2.0 $ export ORACLE_HOME ORACLE_BASE and ORACLE_HOME are directory locations defined by the Oracle Flexible Architecture (OFA). $ echo $ORACLE_BASE displays ORACLE_BASE path. $ echo $ORACLE_HOME displays ORACLE_HOME path. bash_profile and its purpose bash_profile is a environment file and it exists for every user. For oracle user : we can find /home/oracle path , should issue $ ls -la The file .bash_profile is a hidden file that resides in $HOME directory. .bash_profile main purpose to set oracle env variables permanently once we run [. .bash_profile] all environment variables are set. Next time whenever we login , we can connect with sqlplus tool directly. Purpose of root.sh and rootInst.sh As part of oracle installation steps , we have to execute two scripts. After we have successfully installed oracle , OUI prompts to run orainstRoot.sh and root.sh. user root # should execute both scripts. Check following screen shot. Oracle suggests to backup the root.sh scripts end of oracle installation. Successful People in life seem to like LINUX
Page 19 of 29
In General, root.sh and orainstRoot.sh scripts create the additional directories and sets appropriate ownership and permissions on files for root user. Importance of running orainstRoot.sh The script 'orainstRoot.sh' which is located in $ORACLE_BASE/oraInventory. The script should be run as (root #) user. orainstRoot.sh needs to be run to change the Permissions and groupname to 770 and to oinstall. # /u01/app/oracle/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oracle/oraInventory to 770. Changing groupname of /u01/app/oracle/oraInventory to oinstall. The execution of the script is complete
Page 20 of 29
It creates the inventory pointer file (/etc/oraInst.loc),This file shows the inventory location and group. It changes groupname of the oraInventory directory to oinstall group . Importance of running root.sh The script 'root.sh' which is located in $ORACLE_HOME path. We can find the file here (/u01/app/oracle/product/10.2.0/db_1). root.sh script does , root.sh also creates /etc/oratab file. ( linux , aix ). i.e. root.sh, which is a shell script, creates an ORATAB file. It correctly sets oracle base and home environments. To copy few files into /usr/local/bin. They are dbhome, oraenv, coraenv etc ..
root.sh script needs to run the first time , when any oracle product is installed on the server. root.sh does privileged operations required to run Oracle. The script should be run as (root #) user. When installing Oracle, some actions, which need to be performed as (root #), are recorded in a shell script called root.sh. This script is written in the orainst directory. we should run root.sh towards end of installation.
POINTS TO NOTE :
root.sh primarily it adjusts ownership and permissions. root.sh will do different things with different products and product versions. If there are special processes that need to be initiated. If there are new files (/usr/local/bin/oraenv) in root-only accessible parent dirs. Successful People in life seem to like LINUX
Page 21 of 29
Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. Successful People in life seem to like LINUX
Page 22 of 29
Oracle recommends
to backup
after complete an
installation. If we install other products in the same Oracle home directory, then Oracle Universal Installer updates the contents of the existing root.sh script during the installation. Basically Oracle Installer updates root.sh file whenever it does an installation or patch so advisable to take a backup of the existing root.sh. Oraenv/Coraenv (Utilities) Both are utility to change ORACLE_HOME. Oraenv and Coraenv are UNIX/LINUX command line utilities. Coraenv utility is appropriate for the UNIX C Shell. Oraenv using a Bourne ,Korn or Bash shells. Both utilities do the same thing in the different UNIX shells. Both utilities are shell scripts and created during oracle installation. Main purpose is to set the required environment variables (ORACLE_SID,
ORACLE_HOME and PATH) to allow a user to connect to the DB instance. i.e.
(($ORACLE_HOME/bin) directory in the PATH environment variable setting). When switching between databases, users can run the oraenv or coraenv script to set these environment variables. If these environment variables are not set, commands such as SQL*PLUS, IMP, EXP, or any other utility will not work (or not be found). Oraenv command will prompt for the SID of the database that we wish .. Syntax is : {period} {space} oraenv. $ . oraenv Successful People in life seem to like LINUX
Page 23 of 29
when creating a database. It is mainly used to list the databases and software versions installed on a server. If we create a database manually , we have to put the entry in ORATAB file. If we create database using DBCA , then automatically that database entry will be updated in ORATAB file. $ vi etc/oratab Entries are of the form:
$ORACLE_SID:$ORACLE_HOME:<N|Y>: orcldb:/u01/app/oracle/product/10.2.0/db_1:N testdb:/u01/app/oracle/product/10.2.0/db_1:Y
The first and second fields are the system identifier and $orcle_home directory of the database respectively. : used as the field terminator. The first field is (database_sid) the system identifier (SID) of an Oracle instance. The second field is the oracle_home directory associated with this instance. The 3rd field Y|N flags indicate if the instance should automatically start at boot time (Y=YES , N=NO). We can check oratab file here , $ vi /etc/oratab or $ cat /etc/oratab Oracles dbstart and dbshut scripts use this file to figure out which instances are to be startup or shutdown (using the third field, Y or N). Successful People in life seem to like LINUX
Page 24 of 29
perform some other tasks also. The oraenv utility uses ORATAB to set the correct environment variables. OUI OUI stands for Oracle Universal Installer. Run the OUI as the oracle user; $ ./runInstaller.
ORACLE UNIVERSAL INSTALLER
some files in the directory where the runInstaller (UNIX/LINUX) is running. OUI creates the oraInventory dir the first time it is run on a computer.
The oraInventory directory keeps an inventory of products that Oracle Universal Installer installs on the system. OUI is a Java-based graphical user interface application that enables to install Oracle software components. OUI is the installer used for installing Enterprise Manager Grid Control (Grid Control). OUI automatically checks prerequisite (prior to oracle installation) to verify that the system meets operational requirement. They are following below ; Successful People in life seem to like LINUX
Page 25 of 29
Page 26 of 29
Oracle Inventory :
ORACLE_HOME
According to this oraInventory comes under the $ORACLE_ BASE directory. The first time installing Oracle software on a system, Oracle Universal Installer prompts to specify the path to orainventory directory. Oracle recommends to choose oracle_base/oraInventory then OUI creates the directory and sets the correct owner, group, and permissions for it. NOTE : Do not delete this directory unless we have completely removed all Oracle software from the system. Successful People in life seem to like LINUX
Page 27 of 29
Device: 805h/2053d
Inode: 1439025
Access: (0770/drwxrwx---) Uid: ( 502/ oracle) Gid: ( 502/oinstall) # stat oraInst.loc File: `oraInst.loc' Size: 63 Blocks: 8 IO Block: 4096 regular file Links: 1
Device: 805h/2053d
Inode: 1439027
Page 28 of 29
During installation , OUI uses a temporary directory for swap space. OUI uses the "oraInst.loc" file to find the location of the oraInventory dir. As part of installation, we need to specify a dir for installer files (orainventory). During the installation of Oracle software, the scripts oraenv/coraenv are installed in <ORACLE_HOME>/bin and are copied to the local bin directory /usr/local/bin by root.sh. dbhome utility can be used to verify the
Page 29 of 29