Install Oracle 11G R2 on CentOS 5.10

Source: Internet
Author: User

Install Oracle 11G R2 on CentOS 5.10

Operating System: CentOS 5.10 64-bit

Database: Oracle 11G R2 (version 11.02)

When installing the operating system, note that the swap partition size cannot be less than 2G

1. synchronize clock and modify/etc/hosts
Yum-y install ntp
Ntpdate time.nist.gov
Echo "**/2 ***/sbin/ntpdate time.nist.gov>/dev/null 2> & 1">/etc/crontab

Modify/etc/hosts

Add the machine name. If node1.

Echo "127.0.0.1 $ HOSTNAME">/etc/hosts

2. Close the service:
Iptables
Selinux
Portmap
Rpc. statd
Cupsd
Avahi-daemon
Sendmail

Killall iptables
Chkconfig -- level 2345 iptables off
Killall portmap
Chkconfig -- level 2345 portmap off
Killall avahi-daemon
Chkconfig -- level 2345 avahi-daemon off
Killall sendmail
Chkconfig -- level 2345 sendmail off

3. Install the component package on which oracle 11gR2 depends

Yum-y install binutils compat-libstdc ++-33 elfutils-libelf-devel glibc-common glibc-devel gcc-c ++ libaio-devel libaliblibgcc gcc stdc + + libstdc ++-devel make sysstat unixODBC-devel pdksh numactl-devel glibc-headers libaio-devel libaio

/Sbin/ldconfig

4. Adjust Kernel Parameters
Vi/etc/sysctl. conf
Fs. file-max = 6815744
Kernel. shmall = 2097152
Kernel. shmmax = 536870912
Kernel. shmmni = 4096
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 = 1048576
Fs. aio-max-nr = 1048576

# Make kernel parameters take effect
Sysctl-p

5. Modify limits. conf
Vi/etc/security/limits. conf
# Oracle settings
Oracle soft nproc 2047
Hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536

6. Modify/etc/pam. d/login.
# Add the following content:
Session required/lib64/security/pam_limits.so
Session required pam_limits.so

Note: If you are using a 32-bit operating system, you must write

Session required/lib/security/pam_limits.so
Session required pam_limits.so

7. Modify/etc/profile
Vi/etc/profile
# Add the following content:
If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi

8. Modify/etc/csh. login
Vi/etc/csh. login
# Add the following content:
If ($ USER = "oracle") then
Limit maxproc 16384
Limit deors 65536
Endif

9. Create an oracle user
Groupadd oinstall
Groupadd dba
Useradd-g oinstall-G dba oracle
Passwd oracle

Mkdir-p/opt/oracle
Mkdir-p/opt/oraInventory
Mkdir-p/opt/software
Chown-R oracle: oinstall/opt/oracle
Chown-R oracle: oinstall/opt/software
Chown-R oracle: oinstall/opt/oraInventory

10. Set User Environment Variables
# Su-oracle


$ Vi. bash_profile

# Add the following content:
ORACLE_SID = luke; export ORACLE_SID
ORACLE_BASE =/opt/oracle; export ORACLE_BASE
ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/bin; export PATH

Stty erase ^ H

Stty kill ^ U

Note:

Admin and product under ORACLE_BASE
ORACLE commands, database connection, installation assistant, listener, and so on in ORACLE_HOME.
This is just the definition of ORACLE. ORACLE_HOME is deeper than the ORACLE_BASE directory. That is, ORACLE_HOME = $ ORACLE_BASE/product/version

ORACLE_BASE is the root directory of oracle and ORACLE_HOME is the directory of oracle products.
Simply put, if you have two versions of oracle, ORACLE_BASE can be one, but ORACLE_HOME can be two.

The global database name is used to differentiate instances on different machines of a distributed database.
SID is used to distinguish different instances on the same machine,
That is, one is used for external differentiation.
One is used for internal differentiation.

$ Source. bash_profile

11. Install oracle
# Use winscp to upload the oracle Installation File to the/data/software Directory and decompress the package


Cd/data/software
Unzip linux_11gR2_database_1of2.zip
Unzip linux_11gr2_database204 f2.zip
Xhost +)
Xhost + localhost
Su-oralce
Cd/opt/software/database
$./RunInstaller # (run this command in the directory where the oracle Installation File is located)

Installation Process omitted

12. Boot startup settings
# Automatically start and disable database instances and listeners
Vi/opt/oracle/product/11.2.0/db_1/bin/dbstart
ORACLE_HOME_LISTNER = $1
# Change:
ORACLE_HOME_LISTNER = $ ORACLE_HOME

Vi/opt/oracle/product/11.2.0/db_1/bin/dbshut
ORACLE_HOME_LISTNER = $1
# Change:
ORACLE_HOME_LISTNER = $ ORACLE_HOME

Vi/etc/init. d/oracle
#! /Bin/sh
# Chkconfig: 345 61 61
# Description: Oracle 11g AutoRun Services
#/Etc/init. d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

Export ORACLE_BASE =/opt/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
Export ORACLE_SID = luke
Export PATH = $ PATH: $ ORACLE_HOME/bin
ORA_OWNR = "oracle"

# If the executables do not exist -- display error


If [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi

# Depending on parameter -- startup, shutdown, restart
# Of the instance and listener or usage display

Case "$1" in
Start)
# Oracle listener and instance startup
Su $ ORA_OWNR-lc $ ORACLE_HOME/bin/dbstart
Echo "Oracle Start Succesful! OK ."
;;
Stop)
# Oracle listener and instance shutdown
Su $ ORA_OWNR-lc $ ORACLE_HOME/bin/dbshut
Echo "Oracle Stop Succesful! OK ."
;;
Reload | restart)
$0 stop
$0 start
;;
*)
Echo $ "Usage: 'basename $ 0' {start | stop | reload }"
Exit 1
Esac
Exit 0

Chmod 750/etc/init. d/oracle

Chkconfig -- level 345 oracle on
Chkconfig -- add oracle

# Start oracle
Service oracle start

Auto Start and disable EM
Vi/etc/init. d/oraemctl
#! /Bin/sh
# Chkconfig: 345 61 61
# Description: Oracle 11g AutoRun Services
#/Etc/init. d/oraemctl
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface

Export ORACLE_BASE =/opt/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
Export ORACLE_SID = luke
Export PATH = $ PATH: $ ORACLE_HOME/bin
ORA_OWNR = "oracle"

Case "$1" in
Start)
Echo-n $ "Starting Oracle em db Console :"
Su-$ ORA_OWNR-c "$ ORACLE_HOME/bin/emctl start dbconsole"
Echo "OK"
;;
Stop)
Echo-n $ "Stopping Oracle em db Console :"
Su-$ ORA_OWNR-c "$ ORACLE_HOME/bin/emctl stop dbconsole"
Echo "OK"
;;
*)
Echo $ "Usage: $0 {start | stop }"
Esac

Chmod 750/etc/init. d/oraemctl
# Start EM
Service oraemctl start

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.