Oracle11.2.0.1 install script in Linux-X64-

Source: Internet
Author: User

Before installing Oracle on linux, You need to perform a series of configurations. Manual execution of each environment is slow;
Two scripts are written here for automatic configuration and installation. Currently, the installation is successful on your CentOS6.3 linux template;
It is not tested on other systems. before using it, you must first understand the script, configure a static IP address for the NIC, and modify the IP address before performing the operation;
Scripts are composed of a series of functions in sequence;

#! /Bin/bash
# Set-x
Echo "Start Configure Oracle Environment For Install ........................."
Time = 'date + % Y % m % d _ % H % M % s'
Flag = "##################################### ###############################"


# It is easy to back up the configuration file. just copy the system configuration file to be modified and copy the two files to facilitate recovery.
Backup_config (){
# Echo "$ flag"
Echo "######################## Step 1: backup system config that will be modified ###########################"
Cp/etc/sysconfig/network. bak $ {time}
Cp/etc/sysctl. conf/etc/sysctl. conf. bak $ {time}
Cp/etc/security/limits. conf/etc/security/limits. conf. bak $ {time}
Cp/etc/pam. d/login/etc/pam. d/login. bak $ {time}
Cp/etc/profile. bak $ {time}
Cp/home/oracle/. bash_profile/home/oracle/. bash_profile.bak $ {time}
Cp/etc/selinux/config. bak $ {time}

Cp/etc/sysconfig/network. bak
Cp/etc/sysctl. conf/etc/sysctl. conf. bak
Cp/etc/security/limits. conf/etc/security/limits. conf. bak
Cp/etc/pam. d/login/etc/pam. d/login. bak
Cp/etc/profile. bak
Cp/home/oracle/. bash_profile/home/oracle/. bash_profile.bak
Cp/etc/selinux/config. bak
}


# Obtain the current system information, configure hostname, and disable selinux
Sys_info ()
{
# Echo "$ flag"
Echo "check system space and version ";
Echo "######################## Step 2: check system space and versio ################################### ######"
Uname-
Cat/etc/* release
Df-h
Hostname
Ip_add = 'ifconfig | grep' inet addr: '| grep-v '2017. 0.0.1' | cut-d:-f2 | awk '{print $1 }''
Ip_code = 'ifconfig | grep' inet addr: '| grep-V' 127. 0.0.1 '| cut-d:-f2 | awk' {print $1} '| cut-d. -f4'
Echo "$ ip_add oraserver $ {ip_code}">/etc/hosts
Sed-I '/HOSTNAME =/s/localhost. localdomain/oraserver' "$ {ip_code}" '/etc/sysconfig/network
Sed-I '/SELINUX =/s/enforcing/disabled/'/etc/selinux/config
Hostname oraserver $ {ip_code}
}


# Install the required dependent packages. The customized RPM varies with different systems. You can manually check this step.
Rpm_info ()
{
Echo "######################## Step 2: install oracle rpms ##################################### ##############"
Rpm-q binutils compat-libstdc ++ elfutils-libelf kernel-libelf-devel gcc-c ++ glibc-common glibc-devel glibc-headers ksh libaio-devlibel gcc stlibdc ++ make numactl-devel sysstat unixODBC-devel elfutils-libelf-devel-static kernel-headers libgomp
Rpm-ivh/root/rpm-centos/lrzsz-0.12.20-27.1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/compat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/unixODBC *
Rpm-ivh/root/rpm-centos/libaio *
Rpm-ivh/root/rpm-centos/numactl *
Rpm-ivh/root/rpm-centos/sysstat *
Rpm-ivh/root/rpm-centos/unzip-6.0-1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/ksh-20100621-16.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/elfutils-libs-0.152-1.el6.x86_64.rpm
Rpm-ivh/root/rpm-centos/elfutils-libelf-devel *
Echo "######### After Install essential rpms"
Rpm-q binutils compat-libstdc ++ elfutils-libelf kernel-libelf-devel gcc-c ++ glibc-common glibc-devel glibc-headers ksh libaio-devlibel gcc stlibdc ++ make numactl-devel sysstat unixODBC-devel elfutils-libelf-devel-static kernel-headers libgomp
}


# Create oracle users, related directories, and allow oracle to execute scripts as root users using sudo
Oracle_user ()
{
Echo "######################## Step 3: add oracle user and group, create directory #############################"
Groupadd oinstall
Groupadd dba
Useradd-g oinstall-G dba-d/home/oracle-m-s/bin/bash-c "ORACLE" oracle
Echo "oracle: oracle">/root/oracle_pass
Chpasswd </root/oracle_pass
Rm-rf/root/oracle_pass
Id oracle;
Id nobody;
Echo "";
Echo "######### create oracle directory"
Mkdir-p/oracle;
Mkdir-p/oracle/oraInventory;
Chown-R oracle: oinstall/oracle;
Chmod-R 775/oracle /;
Echo "######### Add Oracle to sudu user"
Chmod u + w/etc/sudoers
Echo "oracle ALL = (ALL) ALL">/etc/sudoers
Chmod u-w/etc/sudoers
}


# Configure Kernel Parameters
Sysctl_config ()
{
Echo "######################## Step 4: configure system kernal args #################################### ########"
Cat>/etc/sysctl. conf <EOF
Fs. aio-max-nr = 1048576
Fs. file-max = 6815744
Kernel. shmall = 2097152
Kernel. shmmax = 4294967295
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
EOF
Sysctl-p
Echo "Have sourced the nernel args"
}


# Configure Security Restriction Parameters
Security_config ()
{
Echo "";
Echo "######################## Step 5: configure security limits args #################################### #######"
Cat>/etc/security/limits. conf <EOF
Oracle soft nproc 2047
Hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
EOF
Echo "######### set security login args ";
Cat>/etc/pam. d/login <EOF
Session required/lib64/security/pam_limits.so
Session required pam_limits.so
EOF
}


# Here, an SQLPLUS enhancement file for rlwrap is installed, which enables sqlplus to use the direction keys for convenient operations
Rlwrap_config ()
{
Echo "######################## Step 6: install rlwrap for sqlplus ction ################################### ##"
Rpm-ivh/root/rpm-centos/readline-devel-6.0-4.el6.x86_64.rpm
Tar-zxvf/root/rpm-centos/rlwrap-0.37-x86_64.tar.gz-C/root>/dev/null
Cd/root/rlwrap-0.37
Echo "processing ing rlwrap ......"
./Configure>/dev/null
Echo "making rlwrap ......"
Make>/dev/null
Echo "make installing rlwrap ......"
Make install>/dev/null
Echo "rlwrap installed finished! "
}


# Configure Environment Variables
Environment_config (){


Echo "######################## Step 7: config etc profile environment #################################### ##########"
Echo "set oracle profile environment ------------------------"
Cat>/etc/profile <EOF
If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
EOF


Echo "######################## Step 8: config oracle install environment #################################### ########"
Echo "set El path and environment -----------------------"
Echo "";
Ora_profile = "/home/oracle/. bash_profile"
Cat>/home/oracle/. bash_profile <EOF
ORACLE_BASE =/oracle
ORACLE_HOME =\$ ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID = SDK
PATH = \ $ ORACLE_HOME/bin: PATH = \ $ PATH: \ $ HOME/bin
LD_LIBRARY_PATH = \ $ ORACLE_HOME/lib:/usr/lib
Export ORACLE_BASE
Export ORACLE_HOME
Export NLS_LANG = "SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
Export ORACLE_SID
Export PATH
Export LD_LIBRARY_PATH
EOF


Source $ ora_profile
Echo "alias sqlplus = '/usr/local/bin/rlwrap sqlplus'">/home/oracle/. bashrc
Echo "alias rman = '/usr/local/bin/rlwrap rman'">/home/oracle/. bashrc


Chmod 775/home/oracle/. bash *
Chown oracle: oinstall/home/oracle/. bash *
}


# Restore the configuration file if necessary. Do not call this function before running.
Restore_config ()
{
Echo "$ flag"
Cp-r/etc/sysctl. conf. bak/etc/sysctl. conf
Cp-r/etc/security/limits. conf. bak/etc/security/limits. conf
Cp-r/etc/pam. d/login. bak/etc/pam. d/login
Cp-r/etc/profile. bak/etc/profile
Cp-r/home/oracle/. bash_profile.bak/home/oracle/. bash_profile
Cp-r/etc/sysconfig/network. bak/etc/sysconfig/network
Echo "1.8-############### restore finished ################### ##################"
}


# Call functions in sequence for execution. comment out the corresponding functions as needed.
Oracle_user;


Backup_config;


Sys_info;


Rpm_info;


Sysctl_config;


Security_config;


Rlwrap_config;


Environment_config;


# Restore_config;
Echo "##############################.... over .... ######################################## ##########################"
Echo "############## Now you shoshould login in by oracle and upload zip files and install ########## ##################"
Echo "###################################### ######################################## ###############################"

  • 1
  • 2
  • Next Page
[Content navigation]
Page 1: root Configuration Page 2nd: Oracle Installation

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.