Thursday, April 05, 2007

Oracle: Install Oracle On Linxu Using A Response File

Install Oracle Enterprise Database Using Silent Mode On Linux


Oracle provides an installer utility, called Oracle Universal Installer (OUI), which can be run in Interactive, Suppressed and Silent modes.

Use OUI's silent installation mode to bypass the graphical user interface and supply the necessary information in a response file. This method is most useful when installing the same product multiple times on multiple machines. By using a response file, you can automate the installation of a product for which you know the installation parameters. It also helpful when x-window is not available.

Here is an example of Oracle 10g installation.

1. Prequists
1.1 Set kernel parameters
Oracle Database 10g Release 2 requires the kernel parameter settings shown below. The values given are minimums, so if your system uses a larger value, don't change it.
kernel.shmall = 4294967296
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=2621
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144

1.2. Check Packages:
Oracle requires the following package versions (or later):
• binutils-2.15.92.0.2-10.EL4
• compat-db-4.1.25-9
• control-center-2.8.0-12
• gcc-3.4.3-9.EL4
• gcc-c++-3.4.3-9.EL4
• glibc-2.3.4-2
• glibc-common-2.3.4-2
• gnome-libs-1.4.1.2.90-44.1
• libstdc++-3.4.3-9.EL4
• libstdc++-devel-3.4.3-9.EL4
• make-3.80-5
• pdksh-5.2.14-30
• sysstat-5.0.5-1
• xscreensaver-4.18-5.rhel4.2
• libaio-0.3.96
• openmotif21-2.1.30-11.RHEL4.2 (Required only to install Oracle demos)
Please note that if you install 64 bits version of Oracle server or client, you need the 64 bits libraries. If you are installing 32 bits version, then you will need the 32 bits libraries. 

1.3 Create An Oracle Group and User In Linus

The oracle sever needs to be owned by user oracle.
• Create a group:
  #>groupadd oracle
• Create a user
  #>useradd –s /bin/bash –m –d /home/oracle –c “Oracle User” -g oracle oracle

1.4   Create Oracle Directory
There are a few different files such as datafiles, redo log files, undo log files and control files which Oracle uses to store data, logs and system configuration variables and status. Each group of files needs to be placed in different directories properly.
• Create the base directory for oracle product.
   #>mkdir –p /u0/app/oracle
  Make sure that the oracle directory is owned by the oracle user. To change the ownership, do the   following:
   #>chown -R oracle:oracle oracle/
 The Oracle installation utility, runInstaller, will create the subdirectories base on the parameter values   provide in the response file
·    Create other directories that are used for data and logs
      Oracle supports various storage options. In any case, you also need to create the storage file structure to store the data.       
Part IV of this article has exaplems on configure storage for Oracle rather than using single file system storage.

2. Install Oracle Using Response File
2.1 Edit Response File
Response files are used for silent and suppressed installation. The response file contains the pre-defined set of installation options. The document here describes response file in details:
http://www.stanford.edu/dept/itss/docs/oracle/10g/em.101/b12140/4_oui_response_files.htm

2.2   Run Installation Script
Make sure use –silent for silent mode and include the path for the response file.
Login or sudo to became oracle user. Then, change to the Oracle software directory:
 #>cd /tmp/database
From the command line, start the installer in silent mode.
#>./runInstaller -silent -responseFile /tmp/enterprise.rsp
Note the meesage which said where the log was. Make sure to check the log for error after installation is completed
      “ You can find a log of this install session at:
         /home/oracle/oraInventory/logs/installActions2010-09-09_11-52-01AM.log”

3.Create the instance and database
3.1 Set Oracle Environment Variables
• Edit the oracle user profile to include Oracle server related variables, For example, put the following variables into the .bash_profile


# for oracle
ORACLE_BASE=/u0/app/oracle/product/10.2.0
ORACLE_SID=ovi
export ORACLE_BASE ORACLE_SID
ORACLE_HOME=$ORACLE_BASE/db_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
LD_LIBRARY_PATH=/usr/lib:/usr/X11R6/lib
export LD_LIBRARY_PATH
NLS_LANG=.UTF8
export NLS_LANG

• Source the .bash_profile file to update the environment variables
#>source .bash_profile
• Login to oracle using sqlplus as sysdba and create the instance
#>Sqlplus /nolog
SQL> connect sys/password as sysdba;
      Connected to an idle instance.
SQL>
 • Create database by running the create database scripts.

3.2 Create Tablespaces
Run the create tablesapce scripts.

4. Run Oracle PL/SQL Packages To Complete The Database Creation

In order to complete the db creation, the following scripts must be run as sys to create Oracle system objects:
• catalog.sql creates the data dictionary. catproc.sql creates all structures required for PL/SQL. The script is located in $ORACLE_HOME/rdbms/admin
• catalog.sql calls, for example, catexp.sql which is a requirement for exp, or dbmsstdx.sql which is a requirement to create triggers. The script is located in $ORACLE_HOME/rdbms/admin
SQL*Plus provides a shortcut to refer to the ORACLE_HOME directory: the question mark (?). Therefore, these scripts can be called in the following manan:

SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
After compeling the above scripts, login to sqlplus as system user and run the $ORACLE_HOMT/sqlplus/admin/pupbld.sql script. The pupbld.sql script creates a table that allows to block someone from using sqlplus.
SQL>connect system/password
SQL>@?/sqlplus/admin/pupbld

5.Create spfile.
spfile is a compiled version of the pfile, ie, initovi.ora.
SQL>connect sys/password as sysdba;
SQL>startup mount pfile=/u0/app/oracle/product/10.2.0/@?/network/admin/initovi.ora';
SQL>create spfile from pfile=/u0/app/oracle/product/10.2.0/@?/network/admin/initovi.ora';
  File created.

6. Start Oracle
Connect to oracle as sysdba
#>sqlplus /nolog
SQL>connect sys/password as sysdba;
Connected.
SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>startup mount;
   ORACLE instance started.
   Total System Global Area 1.2583E+10 bytes
   Fixed Size 2042128 bytes
   Variable Size 1728055024 bytes
   Database Buffers 1.0838E+10 bytes
   Redo Buffers 14733312 bytes
   Database mounted.
SQL>alter database open;
   Database altered.
SQL>

7. Start Listener
Configure Oracle Net, i.e create a tnsnames.ora file
#>lnsrctl start
 
Now the database is ready for user connections.

8. Summary
As you can see, all the above steps can be put into a script and run automatically.  These installation method is useful when you need to install Oracle in different enviroments with same configurations. For example, develoment and QA Or Oracle database is packaged with an application.

Related Notes:
References:


No comments: