Oracle10gr2 environment variable configuration script rhel5 passed the test

Source: Internet
Author: User
#! Binbash ### thescripttoinstalloracle10gonrhel5 !! # Shownotes! Echo-neThescriptiswritedbyxtao @ sinoinfo! NSPATHpublicsourcecodeORACLE_BASEu01apporacleORACLE_Snecho

#! /Bin/bash ### the script to install oracle10g on rhel5 !! # Show notes! Echo-ne The script is writed by xtao @ sinoinfo! \ N SPATH =/public/sourcecode ORACLE_BASE =/u01/app/oracle ORACLE_SID = orcl # edit the/etc/sysctl. conf! Echo-e '\ n' echo

#! /Bin/bash
### The script to install oracle10g on rhel5 !!
# Show notes!
Echo-ne "The script is writed by xtao @ sinoinfo! \ N"

SPATH =/public/sourcecode
ORACLE_BASE =/u01/app/oracle
ORACLE_SID = orcl


# Edit the/etc/sysctl. conf!
Echo-e '\ N'
Echo-en' \ e [31 m Modify the/etc/sysctl. conf! \ E [0 m \ N'
Cp/etc/sysctl. conf/etc/sugon. bak. sysctl. conf
If [$? ! = 0]; then
Echo "backup sysctl. conf failed"
Exit-1
Fi
Cat <EOF>/etc/sysctl. conf
Kernel. shmall = 4194304
Kernel. shmmax = 17179869184
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 = 1048576
Net. core. rmem_max = 1048576
Net. core. wmem_default = 1048576
Net. core. wmem_max = 1048576
EOF

If [$? ! = 0]; then
Echo "modify sysctl. conf failed"
Exit-1
Fi

# Login as root and issue the following command:
Echo-e '\ N'
Echo-en' \ e [31 m Add the xhost! \ E [0 m \ N'
Xhost + $ HOSTNAME

# Edit the/etc/redhat-release file replacing the current release information (Red Hat Enterprise Linux Server release 5 (Tikanga) with the following:
Echo-e '\ N'
Echo-en' \ e [31 m Change the releas to rhel4! \ E [0 m \ N'
Cp/etc/redhat-release/etc/sugon. bak. redhat-release
Echo-n "redhat-4">/etc/redhat-release
# Run the following command to change the current kernel parameters:
Echo-e '\ N'
Echo-en' \ e [31 m Display the sysctl information! \ E [0 m \ N'
/Sbin/sysctl-p
If [$? ! = 0]; then
Echo "update sysctl failed"
Exit-1
Fi
# Add the following lines to the/etc/security/limits. conf file:
Echo-e '\ N'
Echo-en' \ e [31 m Modify the/etc/security/limits. conf! \ E [0 m \ N'
Cp/etc/security/limits. conf/etc/security/sugon. bak. limits. conf
If [$? ! = 0]; then
Echo "backup limits. conf failed"
Exit-1
Fi
Cat <EOF>/etc/security/limits. conf
* Soft nproc 2047
* Hard nproc 16384
* Soft nofile 1024
* Hard nofile 65536
EOF

If [$? ! = 0]; then
Echo "modify limits. conf failed"
Exit-1
Fi

# Add the following line to the/etc/pam. d/login file, if it does not already exist:
Echo-e '\ N'
Echo-en' \ e [31 m Modify the/etc/pam. d/login! \ E [0 m \ N'
Cp/etc/pam. d/login/etc/pam. d/sugon. bak. login &&
If [$? ! = 0]; then
Echo "backup pam. d-login failed"
Exit-1
Fi
Echo-n "session required pam_limits.so">/etc/pam. d/login &&
If [$? ! = 0]; then
Echo "modify pam. d-login failed"
Exit-1
Fi

# Disable secure linux by editing the/etc/selinux/config file, making sure the SELINUX flag is set as follows:
Echo-e '\ N'
Echo-en' \ e [31 m Disable the SELINUX! \ E [0 m \ N'
Cp/etc/selinux/config/etc/selinux/sugon. bak. config &&
If [$? ! = 0]; then
Echo "backup selinux. config failed"
Exit-1
Fi
Echo-n "SELINUX = disabled">/etc/selinux/config &&
If [$? ! = 0]; then
Echo "modify selinux failed"
Exit-1
Fi

# Create the new groups and users:
Echo-e '\ N'
Echo-en' \ e [31 m Create the user and group for install! \ E [0 m \ N'
Groupadd oinstall &&
Groupadd dba &&
Groupadd rule &&
Useradd-g oinstall-G dba oracle &&
Echo 11111 | passwd oracle -- stdin

# Create the directories in which the Oracle software will be installed:
Echo-e '\ N'
Echo-en' \ e [31 m Create the DIR for ORACLE_BASE and chown the privilege! \ E [0 m \ N'
Mkdir-p $ ORACLE_BASE/product/10.2.0/db_1 &&
Chown-R oracle. oinstall/u01 &&

# Login as the oracle user and add the following lines at the end of the. bash_profile file:
Echo-e '\ N'
Echo-en' \ e [31 m Modify the bash_profile of oracle! \ E [0 m \ N'
Cat <EOF>/home/oracle/. bash_profile
Export ORACLE_BASE =/u01/app/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/10.2.0/db_1
Export ORA_CRS_HOME =/u01/crs/oracle/10gr2/crs
Export ORACLE_SID = orcl
Export TNS_ADMIN = $ ORACLE_HOME/network/admin
Export PATH = $ ORACLE_HOME/bin: $ HOME/bin: $ ORA_CRS_HOME/bin:/sbin: $ ORA_ASM_HOME: $ PATH
EOF

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.