Wednesday, March 25, 2015

How to Install Oracle Database 11g on Linux

Oracle Database Software Installer Download

Oracle Database Software can be download either of the below Link
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?ssSourceSiteId=ocomen
https://edelivery.oracle.com/
Software Update or Patch can be download from below location
https://support.oracle.com
Note : Registered User required to download Oracle software or any update like 11.2.0.3 version.

  1. http://docs.oracle.com/cd/E11882_01/install.112/e24326.pdf
  2. http://oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-oracle-linux-6.php

Environment Details

1. Operating System Version : Oracle Linux 6.4 (64 Bit)
2. Database Version : Oracle Database 11.2.0.3 (64 Bit)
3. RAM : 8 GB
4. HDD : 100 GB.

Configuration Details

1. IP Address : 192.168.0.15
2. Hostname : oracledb2.spectrum-bd.com
3. Oracle SID : orcl
4. Oracle Base : /home/u01/app/oracle
5. Oracle Home : /home/u01/app/oracle/product/11.2.0/db_1
6. Software Installer Location : /home/software 

Required Tools

1. Putty : For connecting to server using remote terminal
2. File Zilla: For transfer any file from local machine to server.
3. VNC viewer: For GUI access from local machine.

Required Tools Installation and Database Software Upload

  1. Install all necessary tools.
  2. Connect to the server as a root user by using putty.
  3. Create a directory which named ‘software’ in home location.
  4. Transfer oracle 11gR2 to software from local machine to server by using filezilla.

Database Installation Prerequisites

Step :01

Perform either the Automatic Setup or the Manual Setup to complete the basic prerequisites. The Additional Setup is required for all installations.
Automatic Setup
If you plan to use the "oracle-rdbms-server-11gR2-preinstall" package to perform all your prerequisite setup, follow the instructions at http://public-yum.oracle.com to setup the yum repository for OL, then perform the following command.
yum install oracle-rdbms-server-11gR2-preinstall
All necessary prerequisites will be performed automatically. It is probably worth doing a full update as well, but this is not strictly speaking necessary.
yum update
Manual Setup
Using any text editor, create or edit the /etc/sysctl.conf file
[root@oracledb2~]# vi  /etc/sysctl.conf
And add or edit lines similar to the following
kernel.shmall = 429496726
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
:x (save and exit)
Note:
  1. Change the value of parameter if less then the above below.
  2. 'kernel.shmmax' Parameter Value should be half size of the RAM.
  3. The current values can be tested using the following command.
    [root@oracledb2 ~]# /sbin/sysctl -a | grep <param-name>
    
Enter the following command to change the current values of the kernel parameters:
[root@oracledb2 ~]#  /sbin/sysctl  -p

Step: 02

Add the following lines to the "/etc/security/limits.conf" file.
[root@oracledb2 ~]#  vi   /etc/security/limits.conf
    oracle                  soft           nproc          16384
    oracle                  hard           nproc          16384
    oracle                  soft           nofile          4096
    oracle                  hard           nofile         65536
    oracle                  soft           stack          10240
:x(save and exit)

Step: 03

Amend the "/etc/security/limits.d/90-nproc.conf" file as described below.
[root@oracledb2~]# vi   /etc/security/limits.d/90-nproc.conf
# Change this
* soft    nproc    1024
# To this
* - nproc 16384
:x(save and exit)

Step: 04

Change the setting SELINUX to disabled by editing the "/etc/selinux/config" file, making sure the SELINUX flag is set as follows.
[root@oracledb2~]# vi   /etc/selinux/config
SELINUX=disabled
:x(save and exit)

Step: 05

If you have the Linux firewall enabled, you will need to disable or configure it. The following is an example of disabling the firewall.
[root@oracledb2~]# etc/init.d/iptables stop
[root@oracledb2~]# chkconfig iptables off

Step: 06

Package Requirements
The following list of packages required for Installed for Oracle Database 11g Release 2. We can do it by two ways.
  1. Install required packages from YUM server (If yum server already configured)
  2. Install required packages manually 
Use below command to install required package from Yum Server,
yum install binutils-2*x86_64*
yum install glibc-2*x86_64* nss-softokn-freebl-3*x86_64*
yum install glibc-2*i686* nss-softokn-freebl-3*i686*
yum install compat-libstdc++-33*x86_64*
yum install glibc-common-2*x86_64*
yum install glibc-devel-2*x86_64*
yum install glibc-devel-2*i686*
yum install glibc-headers-2*x86_64*
yum install elfutils-libelf-0*x86_64*
yum install elfutils-libelf-devel-0*x86_64*
yum install gcc-4*x86_64*
yum install gcc-c++-4*x86_64*
yum install ksh-*x86_64*
yum install libaio-0*x86_64*
yum install libaio-devel-0*x86_64*
yum install libaio-0*i686*
yum install libaio-devel-0*i686*
yum install libgcc-4*x86_64*
yum install libgcc-4*i686*
yum install libstdc++-4*x86_64*
yum install libstdc++-4*i686*
yum install libstdc++-devel-4*x86_64*
yum install make-3.81*x86_64*
yum install numactl-devel-2*x86_64*
yum install sysstat-9*x86_64*
yum install compat-libstdc++-33*i686*
yum install compat-libcap*
yum install unixODBC*
yum install unixODBC-devel*
To determine whether the required packages are installed, enter commands similar to the following:
rpm -q package_name
To install required packages manually, mount the DVD and go to the location where all the package kept, after that enter commands similar to the following:
rpm -ivh package_name
For Mounting Linux Installation DVD use the below command,
mount -t iso9660 /dev/dvd /mnt
In these examples, '/mnt' is the mount point directories for the disc drive.

Step: 07

Enter the following commands to create the oinstall, dba groups and Oracle User
[root@oracledb2~]#
groupadd -g 1000 oinstall
groupadd -g 1200 dba
useradd -u 1100 -g oinstall -G dba oracle
Enter the following command to set the password of the oracle user
passwd oracle
Above Command will prompt you to give password. Enter Password twice to register it
New password: 
Retype new password:

passwd: all authentication tokens updated successfully

Step : 8

Create the directories in which the Oracle software will be installed.
mkdir  -p  /home/u01/app/oracle/product/11.2.0/db_1
set the appropriate owner, group, and permissions
chown -R oracle:oinstall /home/u01
chmod -R 775 /home/u01

Step: 9

Login as the oracle user and add the following lines at the end of the ".bash_profile" file.
[oracle@oracledb2~]# vi  /home/oracle/.bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME= oracledb2.spectrum-bd.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
ORACLE_BASE=/home/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant-launcher.jar
CLASSPATH=${CLASSPATH}:$JAVA_HOME/db/lib/derby.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
:x(save and exit)
Note : To execute bash_profile
 . .bash_profile

Step:10

The "/etc/hosts" file must contain a fully qualified name for the server.
Format :<IP-address> <fully-qualified-machine-name> <machine-name>
[root@oracledb2~]# vi   /etc/hosts
For example.
127.0.0.1          localhost.localdomain           localhost
192.168.0.15       oracledb2.spectrum-bd.com       oracledb2

Step: 11

Connect to server by using vnc viewer and open a new terminal
Now to enable X applications, run the following command as root user
[root@oracledb2~]# xhost  +

Step : 12

Unzip Oracle Installer which we uploaded earlier.
[root@oracledb2~]# cd   /home/software/
[root@oracledb2 software]#  unzip p10404530_112030_Linux-x86-64_1of7.zip 
[root@oracledb2 software]#  unzip p10404530_112030_Linux-x86-64_2of7.zip
You should now have a single directory called "database" containing installation file

Step :13

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory. Start Installation
[root@oracledb2 software]# su - oracle
[oracle@oracledb2 software]$ cd
[oracle@oracledb2 ~]$ cd /home/software/database/
[oracle@oracledb2 database]$ ./runInstaller 

Starting Installation with GUI wizard

After executing runinstaller command, it will show below lines:
Checking Temp space: must be greater than 120 MB.   Actual 40875 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 7903 MB    Passed
Checking monitor: must be configured to display at least 256 colors  passed   
'''Some requirement checks failed. You must fulfill these requirements before
continuing with the installation.'''
Continue? (y/n) [n]
Write:''' y'''

You can see the screen of each stage of installation

1.Configure Security Updates: We can unchecked if we won't receive security updates via my oracle support.source:Shelf/Wiki/OracleDB/images/01.ConfigureSecurityUpdates.png
2.Warning Message: This warning message show when if you unchecked for receive security updates.Click the 'Yes' button to skip this stage.
source:Shelf/Wiki/OracleDB/images/02.WarningMassageForCriticalSecuityIssu.PNG3.Download Software Updates: Generally we select in this stage Skip software updates.
source:Shelf/Wiki/OracleDB/images/03.DownloadSoftwarUpdates.PNG
4.Select Install Option: We can select Create and configure a database option for full installation with database configuration. Or We can select install database software only, which needed to configuration database later.
source:Shelf/Wiki/OracleDB/images/04.InstallationOption.PNG
5.System Class: In this stage, we generally choose Desktop class for general use, Or Choose Server class for Production purpose.
source:Shelf/Wiki/OracleDB/images/05.SystemClass.PNG
6.Typical Install Configuration: In this stage we have to provide, Proper 'Oracle Base', 'Oracle Home' as 'Software Location' which we configure before in bash_profile. Also need to provide Administrative password.
source:Shelf/Wiki/OracleDB/images/06.TypicalInstallationConfiguaration.PNG
7.Password Confirmation: In this stage, if you use a password that didn't fulfill oracle recommended standard password, then you will see below warning message. But you can click 'Yes' and continue with the installation.
source:Shelf/Wiki/OracleDB/images/07.PasswordConfirmation.PNG8.Summary: In this stage review the information and click on 'install' to start Installation.
source:Shelf/Wiki/OracleDB/images/08.Summary.PNG
9.Install Product: In this stage we can see the installation progress.....
source:Shelf/Wiki/OracleDB/images/09.InstallatonProduct.PNG
10.Database Configuar Assistant: In this stage oracle automatically configure and create the database.
source:Shelf/Wiki/OracleDB/images/10.DatabaseConfiguarAssistant.PNG
11.Password Management: In this stage, we can unlock and provide password for some user by clicking password management button. But this step is optional. We can just keep the record Global Database Name, SID, Database Control URL(EM) and click 'OK' to continue.
source:Shelf/Wiki/OracleDB/images/11.PasswordManagement.PNG
12.Execute Configuration Scripts: In this stage, we need to execute 'root.sh' script as a root user.
source:Shelf/Wiki/OracleDB/images/12.ExecuteConfigurationScripts.PNG
Open a new terminal as root user and follow the steps,
[root@oracledb02 ~]# cd /home/u01/app/oracle/product/11.2.0/db_1/
[root@oracledb02 db_1]# ./root.sh
It will display the below message and prompt for pathname, We need to just press 'Enter' to continue,
Running Oracle 11g root.sh script...

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/u01/app/oracle/product/11.2.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
After successful execution it will display the below message,
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.

Finished product-specific root actions.
13.Finish: In this stage, installer will show Enterprise Manager Login URL, click 'close' to finish the Installation.
source:Shelf/Wiki/OracleDB/images/13.Finish.PNG

Connecting to Oracle Database from SQL*Plus

Login as Oracle user
[root@oracledb02 ~]# su - oracle
Check the Listener Status
[oracle@oracledb02 ~]$ lsnrctl  status
Use the below command to UP the Listener if Listener found Down,
[oracle@oracledb02 ~]$ lsnrctl  start
Use the below command to connect with the database as 'sys' user
[root@oracledb02 ~]# sqlplus sys/sys_password@orcl as sysdba
After successful connection it will display the below message,
SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 21 21:05:46 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

Login to Enterprise Manager

Check the Enterprise Manager Status
[oracle@oracledb02 ~]$ emctl status dbconsole
If Enterprise Manager running properly then it will display the below message
Copyright (c) 1996, 2011 Oracle Corporation.  All rights reserved.
https://oracledb02.spectrum-bd.com:1158/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /home/u01/app/oracle/product/11.2.0/db_1/oracledb02.spectrum-bd.com_orcl2/sysman/log
Start the Enterprise Manager using below command if its not running,
[oracle@oracledb02 ~]$ emctl start dbconsole
Check the Enterprise Manager Login from Browser
https://oracledb02.spectrum-bd.com:1158/em/console/aboutApplication

At this Point we can Say Oracle Database Installation Completed Successfully.

How to Install Oracle 12c Enterprise Manager cloud control on Linux


Oracle 12c Enterprise Manager cloud control Software Installer Download

Oracle 12c Enterprise Manager cloud control Software can be download the below Link
http://www.oracle.com/technetwork/oem/grid-control/downloads/index.html
Note. Previous versions of the database can be used to hold the repository, but anything earlier than 11.2.0.2 will require additional patches.
  1. http://docs.oracle.com/cd/E24628_01/install.121/e22624/toc.htm
  2. http://oracle-base.com/articles/12c/cloud-control-12cr4-installation-on-oracle-linux-5-and-6.php

Environment Details

1. Operating System Version : Oracle Linux 6.4 (64 Bit)
2. Database Version : Oracle Database 11.2.0.3 (64 Bit)
3. Enterprise Manager version :Oracle Enterprise Manager Cloud Control 12c Release 4 (12.1.0.4)
4. RAM : 8 GB
5. HDD : 100 GB.

Configuration Details

1. IP Address : 192.168.0.15
2. Hostname : oracledb2.spectrum-bd.com
3. Oracle SID : orcl
4. Oracle Base : /u01/app/oracle
5. Oracle Home : /u01/app/oracle/product/11.2.0/db_1
6. Middleware Home Location: /u01/app/oracle/oms12cr4
7. Agent Base Directory: /u01/app/oracle/agent12cr4
8. Software Installer Location : /u01/software

Required Tools

1. Putty : For connecting to server using remote terminal
2. File Zilla: For transfer any file from local machine to server.
3. VNC viewer: For GUI access from local machine.

Required Tools Installation and Database Software Upload

  1. Install all necessary tools.
  2. Connect to the server as a root user by using putty.
  3. Create a directory which named ‘software’ in u01 location.
  4. Transfer oracle em12cr4 to software from local machine to server by using filezilla.

Database Installation Prerequisites

Database Installation: If you don't have a installed Database.Then Use one of the following link to install the 11.2.0.3 or 11.1.0.2 database.
If you already have a database then start form here....

Step :01

The installation documentation says the following packages are necessary for the cloud control installation.
yum install make -y
yum install binutils -y
yum install gcc -y
yum install libaio -y
yum install glibc-common -y
yum install libstdc++ -y
yum install libXtst -y
yum install sysstat -y
yum install glibc-devel -y
yum install glibc -y
yum install libaio -y
yum install glibc-devel.i686 -y

Step: 02

If you have performed a default 11g database installation you will need to deconfigure Enterprise Manager Database Control. Run the following command as the "oracle" user.
$ emca -deconfig dbcontrol db -repos drop -SYS_PWD <sys pasword> -SYSMAN_PWD <sysman password>

Step: 03

Make the following initialization parameter changes and restart the instance.
sqlplus / AS SYSDBA

ALTER SYSTEM SET processes=300 SCOPE=SPFILE;
ALTER SYSTEM SET session_cached_cursors=200 SCOPE=SPFILE;
ALTER SYSTEM SET sga_target=2G SCOPE=SPFILE;
ALTER SYSTEM SET shared_pool_size=600M SCOPE=SPFILE;
ALTER SYSTEM SET pga_aggregate_target=1G SCOPE=SPFILE;
ALTER SYSTEM SET job_queue_processes=20 SCOPE=SPFILE;

-- May be required if using older versions of DB.
--ALTER SYSTEM SET log_buffer=10485760 SCOPE=SPFILE;
--ALTER SYSTEM SET open_cursors=300 SCOPE=SPFILE;

-- Restart the instance.
SHUTDOWN IMMEDIATE
STARTUP
Note:If you have done a default installation as described here, the UNDO tablespace will be autoextensible. If you have done a custom installation make sure the UNDO tablespace is at least 200M in size. Also, make sure you have 3 redo logs of at least 300M to prevent a warning during the installation.

Step: 04

Edit the "/etc/security/limits.conf" file, increasing the following entry to 4096 if it is less than that. You will need to reboot after this.
oracle   soft   nofile    4096
The database installation is now complete.

Cloud Control 12c Installation

Step: 05

Make the following directories to hold the management server and agent.
$ mkdir -p /u01/app/oracle/oms12cr4
$ mkdir -p /u01/app/oracle/agent12cr4

Step: 06

[root@oracledb2~]# xhost  +

Step: 07

Unzip the Cloud Control media, the start the installation by running the "runInstller" script.
$ mkdir em12cr4
$ unzip -d em12cr4 em12104_linux64_disk1.zip
$ unzip -d em12cr4 em12104_linux64_disk2.zip
$ unzip -d em12cr4 em12104_linux64_disk3.zip
$ cd em12cr4

$ ./runInstaller

Starting Installation with GUI wizard

After executing runinstaller command, it will show below lines:
Checking Temp space: must be greater than 120 MB.   Actual 40875 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 7903 MB    Passed
Checking monitor: must be configured to display at least 256 colors  passed   
'''Some requirement checks failed. You must fulfill these requirements before
continuing with the installation.'''
Continue? (y/n) [n]
Write:''' y'''
If you wish to receive support information, enter the required details, or uncheck the security updates checkbox and click the "Next" button. Click the "Yes" button the subsequent warning dialog.
source:Shelf/Wiki/OracleEM12c/01-em12cr4-my-oracle-support-details.PNG
If you wish to check for updates, enter the required details, or check the "Skip" option and click the "Next" button.
source:Shelf/Wiki/OracleEM12c/02-em12cr4-software-updates.PNG
If you have performed the prerequisites as described, the installation should pass all prerequisite checks. Click the "Next" button.
source:Shelf/Wiki/OracleEM12c/03-em12cr4-prerequisite-checks.PNG
Select the "Create a new Enterprise Manager System" and "Simple" options, then click the "Next" button.
source:Shelf/Wiki/OracleEM12c/04-em12cr4-install-types.PNG
Enter the middleware and agent locations, then click the "Next" button.
source:Shelf/Wiki/OracleEM12c/05-em12cr4-installation-details.PNG
Enter the administrator password and database repository details, then click the "Next" button.
source:Shelf/Wiki/OracleEM12c/06-em12cr4-configuration-details.PNGOn the first warning dialog, click the "Yes" button.
source:Shelf/Wiki/OracleEM12c/07-em12cr4-repository-warning1.PNG
If you have any additional warnings, check they don't look like show-stoppers, then click the "OK" button to continue.
If you are happy with the review information, click the "Install" button.
source:Shelf/Wiki/OracleEM12c/08-em12cr4-review.PNG
Wait while the installation and configuration take place.
source:Shelf/Wiki/OracleEM12c/09-em12cr4-installation-progress-details.PNG
When prompted, run the root scripts, then click the "OK" button.
source:Shelf/Wiki/OracleEM12c/10-em12cr4-root-scripts.PNG
Make note of the URLs, then click the "Close" button to exit the installer. A copy of this information is available in the "/u01/app/oracle/oms12cr4/oms/install/setupinfo.txt" file.
source:Shelf/Wiki/OracleEM12c/11-em12cr4-finish.PNG
The login screen is available from a browser using the URL provided in the previous screen ("https://oracledb02.spectrum-bd.com:7802/em"). Log in with the username "sysman" and the password you specified during your installation.
source:Shelf/Wiki/OracleEM12c/12-em12cr4-login.PNG
Once logged in, you are presented with a with the "Accessibility Preference" screen. Click the "Save and Continue" button and you are presented with the the "License Agreement" screen. Click the "I Accept" button and you are presented with the homepage selector screen. On the right side of the screen it lists the post-installation setup tasks you need to work through.Select the desired homepage (I chose Summary).
source:Shelf/Wiki/OracleEM12c/13-em12cr4-homepage-selector.PNGYou are presented with the selected screen as the console homepage.
source:Shelf/Wiki/OracleEM12c/14-em12cr4-console.png

Startup/shutdown

Use the following commands to turn on all components installed by this article.
#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1
export OMS_HOME=/u01/app/oracle/oms12cr4/oms
export AGENT_HOME=/u01/app/oracle/agent12cr4/core/12.1.0.4.0

# Start everything
$ORACLE_HOME/bin/dbstart $ORACLE_HOME
$OMS_HOME/bin/emctl start oms
$AGENT_HOME/bin/emctl start agent
Use the following commands to turn off all components installed by this article.
#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1
export OMS_HOME=/u01/app/oracle/oms12cr4/oms
export AGENT_HOME=/u01/app/oracle/agent12cr4/core/12.1.0.4.0

# Stop everything
$OMS_HOME/bin/emctl stop oms -all
$AGENT_HOME/bin/emctl stop agent
$ORACLE_HOME/bin/dbshut $ORACLE_HOME