Tuesday, 24 September 2013

Install Oracle 11gr3 silent on linux


Install Oracle preinstall package

The oracle preinstall package used to be call‘”Oracle Validate” in 10g. This package would also update the kernel parameter as Oracle suggest. Before it modify the parameter, it would backup the old one to the /etc/sysctl.conf.orabackup.

yum install oracle-rdbms-server-11gR2-preinstall

or
 Make manual changes to /etc/sysctl.conf
 

Refer <http://docs.oracle.com/cd/E11882_01/install.112/e22489/manpreins.htm#BABCHAED>for the Oracle Requirement and fix kernel parameters. oracle-rdbms-server-11gR2-preinstallwould take care of the changes, just double check and adjust it if necessary.

Create Required Group and User
The oracle-rdbms-server-11gR2-preinstall would create oracle user, add oinstall and dba group. Also make the oracle user as part of member of the group.

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -c "Oracle Software Owner" -g oinstall -G dba -d /home/oracle oracle
 We also need to reset the oracle user password.
passwd oracle

Create Software installation folders
  •  /u01/app/oracle –> for $ORACLE_BASE for Oracle Database instance
  • /u01/app/oracle/product/11.2.0 –> for $ORACLE_HOME
mkdir -p /u01/app/oracle/product/11.2.0
chown -R oracle:oinstall /u01/app
chown -R oracle:oinstall /u01/app/oracle
chmod 775 /u01/app



Configure User environment

As oracle user:

Update ~oracle/.bash_profile

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=HOST01.shilpa.com; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0 export ORACLE_HOME
ORACLE_SID=oracledb1; export ORACLE_SID
ORACLE_UNQNAME=oracledb1; export ORACLE_UNQNAME
PATH=$ORACLE_HOME/bin:$PATH; export PATH

 







Creating the oraInst.loc File
As root user:
Create the /etc/oraInst.loc as below and change the permission and ownership
inventory_loc=/u01/app/oraInventory
inst_group=oinstall


chown oracle:oinstall oraInst.loc
chmod 664 oraInst.loc


Prepare the response file: Oracle Software Only
The sample response file can be found under Oracle installation media“database/response ”

  • dbca.rsp : Silent install for the Oracle database ( for DBCA)
  • db_install.rsp: silent install for the Oracle Software.
  • netca.rsp: Silent install for Oracle Net Configuration Assistant
Here is the example of db_install.rsp.

Even many of the parameters are empty, but if we don’t include in the rsp file, we would get the error like:


oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=HOST01.shilpa.com
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=
oracle.install.db.config.starterdb.globalDBName=
oracle.install.db.config.starterdb.SID=
oracle.install.db.config.starterdb.characterSet=WE8MSWIN1252
oracle.install.db.config.starterdb.memoryOption=
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=falseoracle.install.db.config.starterdb.enableSecuritySettings=trueoracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=falseoracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=falseDECLINE_SECURITY_UPDATES=truePROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=
oracle.installer.autoupdates.downloadUpdatesLoc=


Run the Installer in Silent mode: Oracle Software Only

./runInstaller -silent -responseFile /home/oracle/db_install.rsp

or

./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -noconfig -force -responseFile /home/oracle/db_install.rsp -debug

Common Problems:

1> Xlib: No Protocol

[root@HOST01 logs]# echo $DISPLAY
:0.0
[root@HOST01 logs]# xauth list $DISPLAY
HOST01.shilpa.com/unix:0  MIT-MAGIC-COOKIE-1  13bce55c5549e0dfc6844a24b8ef546e
[oracle@HOST01 ~]$ xauth add HOST01.shilpa.com:0 . 13bce55c5549e0dfc6844a24b8ef546e
xauth:  creating new authority file /home/oracle/.Xauthority

~~~~~~~~~
[oracle@HOST01 ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain HOST01.shilpa.com
::1             localhost6.localdomain6 localhost6
192.168.72.1 HOST01.shilpa.com

~~~~~~~~~
export DISPLAY=192.168.72.1:0.0

2> Exception in thread "main" java.lang.NoClassDefFoundError

--> Check if java is installed (if not installed: yum install *java* and yum install *jdk* and yum install *jar*)
--> Test for the env:

i)   which java
ii)  java -version
iii) JAVA_HOME =
  SET your JAVA_HOME to the location of your installed java and
iv)  export PATH=$JAVA_HOME/bin:$PATH
v) unset DISPLAY


3> If installation fails at email entry, please check the following two parameters in the response file as below:

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true



As a root user, execute root.sh

If faced the below error:

$ sqlplus / as sysdba
$ sqlplus: error while loading shared libraries: $ORACLE_HOME/lib/libnnz11.so: cannot restore segment prot after reloc: Permission denied


Its due to the SELINUX settings, which should have been initially disabled; But, never mind it can be fixed with the following command:

Commands, as root:
======================
getenforce (returns "Enforcing")
setenforce 0
getenforce (returns "Permissive")


 Further, check logging into sql prompt by the following command:
sqlplus / as sysdba

  Create the Listener
Create the $ORACLE_HOME/network/admin/listener.ora with below information:
LISTENER_oracledb1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = HOST01.shilpa.com)(PORT = 7001))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC7001))
    )
  )

ADR_BASE_LISTENER_oracledb1 = /u01/app/oracle
  
Then start the listener via
lsnrctl start LISTENER_ORACLEDB1

Alternatively, we can use netca to create the listener.



 

Oracle Tablespace usage

 
DBA_TABLESPACE_USAGE_METRICS

select * from DBA_TABLESPACE_USAGE_METRICS;




The size is based on the block.

DBA_HIST_TBSPC_SPACE_USAGE

DBA_HIST_TBSPC_SPACE_USAGE contains the historical usage information collect by AWR.
select TABLESPACE_ID,NAME,TABLESPACE_SIZE,TABLESPACE_USEDSIZE,RTIME from DBA_HIST_TBSPC_SPACE_USAGE,v$tablespace where TABLESPACE_ID=TS# order by RTIME,dba_hist_tbspc_space_usage.tablespace_id;



 

Oracle Client 11gr2 Install in Red Hat Linux

Oracle Client 11gr2 Install in Red Hat Linux

 

1. Unzip the files


unzip 11201_database_linux.zip
 

2. Hosts File (Check for the entry)

 
<IP-address>  <fully-qualified-machine-name>  <machine-name>
 

3. Set Kernel Parameters

a) Add the following lines to the "/etc/sysctl.conf" file.

#kernel.shmall = 2097152
#kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
#fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
                  OR
echo net.ipv4.ip_forward = 0 >> /etc/sysctl.conf
echo net.ipv4.conf.default.rp_filter = 1 >> /etc/sysctl.conf
echo net.ipv4.conf.default.accept_source_route = 0 >> /etc/sysctl.conf
echo kernel.sysrq = 0 >> /etc/sysctl.conf
echo kernel.core_uses_pid = 1 >> /etc/sysctl.conf
echo net.ipv4.tcp_syncookies = 1 >> /etc/sysctl.conf
echo kernel.msgmnb = 65536 >> /etc/sysctl.conf
echo kernel.msgmax = 65536 >> /etc/sysctl.conf
echo kernel.shmmax = 2147483648 >> /etc/sysctl.conf
echo kernel.shmall = 2097152 >> /etc/sysctl.conf
echo kernel.shmmni = 4096 >> /etc/sysctl.conf
echo kernel.sem = 250 32000 100 128 >> /etc/sysctl.conf
echo fs.file-max = 6815744 >> /etc/sysctl.conf
echo fs.aio-max-nr = 1048576 >> /etc/sysctl.conf
echo net.ipv4.ip_local_port_range = 9000 65500 >> /etc/sysctl.conf
echo net.core.rmem_default = 1048576 >> /etc/sysctl.conf
echo net.core.rmem_max = 4194304 >> /etc/sysctl.conf
echo net.core.wmem_default = 262144 >> /etc/sysctl.conf
echo net.core.wmem_max = 1048576 >> /etc/sysctl.conf

b) Add the following lines to the "/etc/security/limits.conf" file.

 
*               soft    nproc   2047
*               hard    nproc   16384
*               soft    nofile  1024
*               hard    nofile  65536
                       OR
echo oracle soft nproc 2047 >> /etc/security/limits.conf
echo oracle hard nproc 16384 >> /etc/security/limits.conf
echo oracle soft nofile 1024 >> /etc/security/limits.conf
echo oracle hard nofile 65536 >> /etc/security/limits.conf

c)  Add the following line to the "/etc/pam.d/login" file, if it does not already exist. (Can be varied as Business requirement)

session    required     pam_limits.so

d)  Disable secure linux by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows. (May vary as per Business requirement)

SELINUX=disabled

4. Setup


a) Pre-requisites:

a. Install the following packages.

rpm -Uvh setarch-2*
rpm -Uvh make-3*
rpm -Uvh glibc-2*
rpm -Uvh libaio-0*
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh gcc-4*
rpm -Uvh libXp-1*
rpm -Uvh openmotif-2*
rpm -Uvh compat-db-4* 
yum install *glibc-devel*
yum install *libaio-devel*
yum install *elfutils-libelf-devel*
yum install *libstdc++-devel*
yum install *unixODBC*
yum install *unixODBC-devel*
yum install *pdksh*
yum install gcc-c++-4.1.2*
yum install libXp gcc make setarch libaio glibc-devel

b. Create Required Group and User

/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -c "Oracle Software Owner" -g oinstall -G dba -d /home/oracle oracle
 
passwd oracle
 

c. Create Software installation folders

mkdir -p /usr/lib/oracle/xe/app/oracle/product/11.2.0/client/bin
mkdir -p /home/oracle
mkdir -p /opt/oracle/oraInventory
chown -R oracle:oinstall /usr/lib/oracle/xe/app/oracle
chown -R oracle:oinstall /usr

 d. Configure User environment

 # .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
#PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
export ORACLE_BASE
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/11.2.0/client
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin
export PATH
 

e. Creating the oraInst.loc File

Create the /etc/oraInst.loc as below and change the permission and ownership.

inventory_loc=/opt/oracle/oraInventory
inst_group=oinstall
 
chown oracle:oinstall oraInst.loc
chmod 664 oraInst.loc
 

b) Installation:

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.
 
sh /app/oracledumps/client/runInstaller -silent -responseFile /home/oracle/client.rsp -ignorePrereq
 

c) Post-Installation:

 Edit the "tnsnames.ora" file to use the database entry at the location “/usr/lib/oracle/xe/app/oracle/product/11.2.0/client/network/admin”.
Example:

DB_ALIAS =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XX)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = DBNAME)
    )
  )

 ################################################################################
 ########################sample response file - client.rsp##############################
 
###############################################################################
## Copyright(c) Oracle Corporation 1998,2008. All rights reserved.           ##
##                                                                           ##
## Specify values for the variables listed below to customize                ##
## your installation.                                                        ##
##                                                                           ##
## Each variable is associated with a comment. The comment                   ##
## can help to populate the variables with the appropriate                   ##
## values.                                              ##
##                                                                           ##
###############################################################################
 
#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_clientinstall_response_schema_v11_2_0
 
#-------------------------------------------------------------------------------
# This variable holds the hostname of the system as set by the user.
# It can be used to force the installation to use an alternative  
# hostname rather than using the first hostname found on the system
# (e.g., for systems with multiple hostnames and network interfaces).
ORACLE_HOSTNAME=gwl09072appd132
#-------------------------------------------------------------------------------
# Unix group to be set for the inventory directory. 
UNIX_GROUP_NAME=oinstall
#-------------------------------------------------------------------------------
# Inventory location.
INVENTORY_LOCATION=/opt/oracle/oraInventory
#-------------------------------------------------------------------------------
# Languages in which the components will be installed.            
#
# en   : English                  ja   : Japanese                 
# fr   : French                   ko   : Korean                   
# ar   : Arabic                   es   : Latin American Spanish   
# bn   : Bengali                  lv   : Latvian                   
# pt_BR: Brazilian Portuguese     lt   : Lithuanian               
# bg   : Bulgarian                ms   : Malay                    
# fr_CA: Canadian French          es_MX: Mexican Spanish          
# ca   : Catalan                  no   : Norwegian                
# hr   : Croatian                 pl   : Polish                   
# cs   : Czech                    pt   : Portuguese               
# da   : Danish                   ro   : Romanian                 
# nl   : Dutch                    ru   : Russian                  
# ar_EG: Egyptian                 zh_CN: Simplified Chinese       
# en_GB: English (Great Britain)  sk   : Slovak                   
# et   : Estonian                 sl   : Slovenian                
# fi   : Finnish                  es_ES: Spanish                  
# de   : German                   sv   : Swedish                  
# el   : Greek                    th   : Thai                     
# iw   : Hebrew                   zh_TW: Traditional Chinese      
# hu   : Hungarian                tr   : Turkish                  
# is   : Icelandic                uk   : Ukrainian                
# in   : Indonesian               vi   : Vietnamese               
# it   : Italian                                                   
#
# Example : SELECTED_LANGUAGES=en,fr,ja
#-------------------------------------------------------------------------------
SELECTED_LANGUAGES=en
#-------------------------------------------------------------------------------
# Complete path of the Oracle Home 
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/11.2.0/client
#-------------------------------------------------------------------------------
# Complete path of the Oracle Base.
ORACLE_BASE=/usr/lib/oracle/xe/app/oracle
#-------------------------------------------------------------------------------
#Name       : INSTALL_TYPE
#Datatype   : String
#Description: Installation type of the component.
#
#             The following choices are available. The value should contain
#             only one of these choices.
#             InstantClient : InstantClient
#             Administrator : Administrator
#             Runtime       : Runtime
#             Custom        : Custom
#
#Example    : INSTALL_TYPE = "Administrator"
#------------------------------------------------------------------------------
oracle.install.client.installType=Administrator
#-------------------------------------------------------------------------------
# Name       : oracle.install.client.customComponents
# Datatype   : StringList
#
# This property is considered only if INSTALL_TYPE is set to "Custom"
#
# Description: List of Client Components you would like to install
#
#   The following choices are available. You may specify any
#   combination of these choices.  The components you choose should
#   be specified in the form "internal-component-name:version"
#   Below is a list of components you may specify to install.
#
# oracle.sqlj:11.2.0.1.0 -- "Oracle SQLJ"
# oracle.rdbms.util:11.2.0.1.0 -- "Oracle Database Utilities"
# oracle.javavm.client:11.2.0.1.0 -- "Oracle Java Client"
# oracle.sqlplus:11.2.0.1.0 -- "SQL*Plus"
# oracle.dbjava.jdbc:11.2.0.1.0 -- "Oracle JDBC/THIN Interfaces"
# oracle.ldap.client:11.2.0.1.0 -- "Oracle Internet Directory Client"
# oracle.rdbms.oci:11.2.0.1.0 -- "Oracle Call Interface (OCI)"
# oracle.precomp:11.2.0.1.0 -- "Oracle Programmer"
# oracle.xdk:11.2.0.1.0 -- "Oracle XML Development Kit"
# oracle.network.aso:11.2.0.1.0 -- "Oracle Advanced Security"
# oracle.assistants.oemlt:11.2.0.1.0 -- "Enterprise Manager Minimal Integration"
# oracle.oraolap.mgmt:11.2.0.1.0 -- "OLAP Analytic Workspace Manager and Worksheet"
# oracle.network.client:11.2.0.1.0 -- "Oracle Net"
# oracle.network.cman:11.2.0.1.0 -- "Oracle Connection Manager"
# oracle.network.listener:11.2.0.1.0 -- "Oracle Net Listener"
# oracle.ordim.client:11.2.0.1.0 -- "Oracle Multimedia Client Option"
# oracle.ons:11.2.0.0.0 -- "Oracle Notification Service"
# oracle.odbc:11.2.0.1.0 -- "Oracle ODBC Driver"
# oracle.has.client:11.2.0.1.0 -- "Oracle Clusterware High Availability API"
# oracle.dbdev:11.2.0.1.0 -- "Oracle SQL Developer"
# oracle.rdbms.scheduler:11.2.0.1.0 -- "Oracle Scheduler Agent"
#
#-------------------------------------------------------------------------------
oracle.install.client.customComponents="oracle.sqlj:11.2.0.1.0","oracle.rdbms.util:11.2.0.1.0","oracle.javavm.client:11.2.0.1.0","oracle.sqlplus:11.2.0.1.0","oracle.dbjava.jdbc:11.2.0.1.0","oracle.ldap.client:11.2.0.1.0","oracle.rdbms.oci:11.2.0.1.0","oracle.precomp:11.2.0.1.0","oracle.xdk:11.2.0.1.0","oracle.network.aso:11.2.0.1.0","oracle.assistants.oemlt:11.2.0.1.0","oracle.oraolap.mgmt:11.2.0.1.0","oracle.network.client:11.2.0.1.0","oracle.network.cman:11.2.0.1.0","oracle.network.listener:11.2.0.1.0","oracle.ordim.client:11.2.0.1.0","oracle.ons:11.2.0.0.0","oracle.odbc:11.2.0.1.0","oracle.has.client:11.2.0.1.0","oracle.dbdev:11.2.0.1.0","oracle.rdbms.scheduler:11.2.0.1.0"
#-------------------------------------------------------------------------------
#Name       : MTS_PORT
#Datatype   : int
#Description: Port number to be used for by the Oracle MTS Recovery Service to listen
#          for requests. This needs to be entered in case oracle.ntoramts is
#          selected in the list of custom components in custom install
#
#
#Example    : MTS_PORT = 2030
#------------------------------------------------------------------------------
oracle.install.client.oramtsPortNumber=
 
#------------------------------------------------------------------------------
# Host name to be used for by the Oracle Scheduler Agent.
# This needs to be entered in case oracle.rdbms.scheduler is selected in the
# list of custom components during custom install
#
# Example    : oracle.install.client.schedulerAgentHostName = acme.domain.com
#------------------------------------------------------------------------------
oracle.install.client.schedulerAgentHostName=
 
#------------------------------------------------------------------------------
# Port number to be used for by the Oracle Scheduler Agent.
# This needs to be entered in case oracle.rdbms.scheduler is selected in the
# list of custom components during custom install
#
# Example: oracle.install.client.schedulerAgentPortNumber = 1500
#------------------------------------------------------------------------------
oracle.install.client.schedulerAgentPortNumber=
 
##################################EOF##########################################