Install Oracle 11g in RHEL 6.2 x86_64

Source: Internet
Author: User

Install oracle 11g in RHEL6.2 x86_64

By Gong Changyu


If you encounter any problems during the installation process, you can discuss them and learn together. If there are any errors, please let us know. Thank you.
1. First modify the/etc/sysctl. conf file to add parameters.
[Root @ redz-server ~] # Cat>/etc/sysctl. conf <EOF
> # Oracle need parameters
> Fs. aio-max-nr = 1048576
> Fs. file-max = 6815744
> Kernel. shmall = 2097152
> Kernel. shmmax = 1024000000 (adjusted based on the system memory)
> Kernel. shmmni = 4096
> Kernel. sem = 250 32000 100 65500
> Net. ipv4.ip _ local_port_range = 9000 65500
> Net. core. rmen_default = 262144
> Net. core. rmem_max = 4194304
> Net. core. wmem_default = 262144
> Net. core. wmem_max = 1048586
> EOF
 
Run/sbin/sysctl-p to make the parameter take effect.
 
2. Modify/etc/security/limits. conf
[Root @ redz-server ~] # Cat>/etc/sysctl. conf <EOF
[Root @ redz-server ~] # Cat>/etc/security/limits. conf <EOF
> # Oracle need parameters
> Orcle soft nproc 2047
> Hard nproc 16384
> Oracle soft nofile 1024
> Oracle hard nofile 65536
> EOF
 
3. Modify/etc/pam. d/limits. conf.
[Root @ redz-server ~] # Cat>/etc/pam. d/login <EOF
> Session required pam_limits.so
> EOF
4. Modify/etc/profile
If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
4. Modify/etc/csh. login
Vi/etc/csh. login
 
# Oracle need setting
If ($ USER = "oralce") then
Limit maxproc 16384
Limit descriptors 65536
Umask 022
Endif
 
5. create user groups and users
[Root @ redz-server ~] #/Usr/sbin/groupadd oinstall
[Root @ redz-server ~] #/Usr/sbin/groupadd dba
[Root @ redz-server ~] #/Usr/sbin/useradd-m-g oinstall-G dba oracle
[Root @ redz-server ~] # Echo "oracle" | passwd -- stdin oracle
 
Change the password of your oracle database.
Passwd: All authentication tokens have been successfully updated.
 
6. Create the installation directory and authorize
[Root @ redz-server ~] # Mkdir-p/opt/oracle/ora11g
[Root @ redz-server ~] # Chown-R oralce: oinstall/opt/oracle/ora11g
[Root @ redz-server ~] # Chown-R oracle: oinstall/opt/oracle/ora11g
[Root @ redz-server ~] # Chmod-R 775/opt/oracle/ora11g
[Root @ redz-server ~] # Mkdir-p/opt/oracle/oraInventory
[Root @ redz-server ~] # Chown-R oracle: oinstall/opt/oracle/oraInventory
[Root @ redz-server ~] # Chmod-R 775/opt/oracle/oraInventory
 
7. Set the oracle user environment variables (note that the shell command '[', ']' and '=' have a space on both sides)
Vi/home/oracle/. bash_profile
TMP =/tmp; export TMP
TMPDIR = $ TMP; export TMPDIR
ORACLE_BASE =/opt/oracle/ora11g; export ORACLE_BASE
ORACLE_HOME = $ ORACLE_BASE/product/11.2.2/dbhome; export ORACLE_HOME
ORACLE_SID = redzdb; export ORACLE_SID
ORACLE_TERM = xterm; export ORACLE_TERM
PATH = $ ORACLE_HOME/bin:/usr/sbin: $ PATH; export PATH
LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH = $ ORACLE_HOME/JRE: $ ORACLE_HOME/jlib: $ ORACLE_HOME/rdbms/jlib;
Export CLASSPATH
 
If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi
 
Umask 022
 
Make the file take effect on www.2cto.com
Source/home/oracle/. bash_profile
 
8. Set system firewall
[Root @ redz-server ~] # Vi/etc/sysconfig/iptables (the iptables file exists only when the firewall is enabled)
Join
-A input-m state -- state NEW-m tcp-p tcp -- drop 1158-j ACCEPT
-A input-m state -- state NEW-m tcp-p tcp -- drop 1521-j ACCEPT
[Root @ redz-server ~] #/Etc/init. d/iptables restart (restart the firewall and enable the new rule)
 
 
9. Before installation, add a local ip address to the/etc/hosts file.
192.168.1.8 redz-server localhost
10. log on with an oracle user. Decompress the Database Installation File and start installation. (If the environment variable is set successfully, you do not need to manually set it here. If the installation of Chinese characters is garbled
Execute export LANG = en_US in the terminal first)
[Oracle @ redz-server ~] $ Export LANG = en_US
[Oracle @ redz-server ~] $ Cd orainstall
[Oracle @ redz-server ~ Orainstall] #./runInstaller
Wait for graphical interface Installation
Ps:
If the root user logs on to the terminal and su oracle is installed on the terminal, a display error may exist.
There are many solutions, but they are not necessarily successful. Therefore, we recommend that you directly log on to the system using an oracle user.
Resolution of display Failure Detection
Method 1: [root @ redz-server ~] # Xhost local: oracle;
Method 2: [root @ redz-server ~] # Xhost +;
Method 2: [root @ redz-server ~] # Xhost + 192.168.1.8;
[Root @ redz-server ~] # Su oracle
[Oracle @ redz-server ~] $ Export DISPLAY = 192.168.1.8: 0.0
The above methods may fail.

 
 
11. after the installation is complete, configure the name of the listener database instance (the Dynamic Registration and static registration of the oracle listener are not very clear. For a high-version database, you do not need to manually configure the listener to access it. Therefore, this step can be omitted temporarily)
./Netmgr
 
4. Set random startup of oralce
[Root @ redz-server ~] # Vi/etc/oratab
Redzdb:/opt/oracle/ora11g/product/11.2.2/dbhome: N
Change
Redzdb:/opt/oracle/ora11g/product/11.2.2/dbhome: Y
12. Edit $ ORACLE_HOME/bin/dbstart as a system user in oracle.
 
# Comment out ORACLE_HOME_LISTNER = $1
Add ORACLE_HOME_LISTNER = $ ORACLE_HOME
 
 
Ps: When this script is automatically generated, that is, when ORACLE is installed in RHEL, this script does not know your
 
◆ What is ORACLE_HOME_LISTNER? Now you need to specify this parameter so that it will not be reported when executing this script.
 
◆ ORACLE_HOME_LISTNER is not specified. Note: After 10 Gb, The dbstart and dbshut scripts have merged the start and close of the listener.
The script for starting and disabling the database instance. Instead of being separated separately.
 
13 edit $ ORACLE_HOME/bin/dbshut in oracle as a system user
# Comment out ORACLE_HOME_LISTNER = $1
Add ORACLE_HOME_LISTNER = $ ORACLE_HOME
 
14. Write a random STARTUP script and register it as a system service.
 
Su root
Vi/etc/init. d/redzora
 
#! /Bin/bash
# Chkconfig: 2345 99 10
# Description: StartupScriptfororacleDatabases
#/Etc/rc. d/init. d/oradbstart
Export ORACLE_BASE =/opt/oracle/ora11g
Export ORACLE_HOME =/opt/oracle/ora11g/product/11.2.2/dbhome
Export ORACLE_SID = redzdb
Export PATH = $ PATH: $ ORACLE_HOME/bin
Case "$1" in
Start)
Echo "----- startuporacle -----">/var/log/oracleauto. log
Su oracle-c $ ORACLE_HOME/bin/dbstart
Su oracle-c "$ ORACLE_HOME/bin/emctl start dbconsole"
Touch/var/lock/subsys/redzora
Echo "----- startuporaclesuccessful -----">/var/log/oracleauto. log
Echo "OK"
;;
Stop)
Echo "----- shutdwnoracle -----">/var/log/oracleauto. log
Su oracle-c "$ ORACLE_HOME/bin/emctl stop dbconsole"
Su oracle-c $ ORACLE_HOME/bin/dbshut
Rm-f/var/lock/subsys/redzora
Echo "----- shutdownoraclesuccessful -----">/var/log/oracleauto. log
Echo "OK"
;;
*)
Echo "Usage: 'basename $ 0' start | stop"
Exit1
Esac
 
 
 
Press ALT + z
Input: wq
Save and exit
Run chmod-Rf 777/var/lock/subs/
Chmod-Rf 777/var/log
Enable users to read and write startup files and logs
 
Ps:
(Thank you for your reference)
Now, I want to give a key explanation for this script:
 
First: # chkconfig: 23459910 is a line of comment, but it is indeed an essential line, unless you do not use the chkconfig command to automatically generate a symbolic connection file, but are completely created manually. Otherwise, the chkconfig System reports that oracle11 does not have the chkconfig Service permission.
 
Second, suoracle-c $ ORACLE_HOME/bin/dbstart and touch/var/lock/subsys/oracle11 run the dbstart script to start oracle, then, create a server in the service activity list directory that corresponds to oracle11.
 
A file with the same name indicates that the service is active, that is, started.
 
Suoracle-c $ ORACLE_HOME/bin/dbshut and rm-f/var/lock/subsys/oracle11 are used to execute the dbshut emergency first, delete the same name as oracle11 from the service activity list directory.
 
Files, indicating that the service is neither active nor closed.
 
So why do we need to do touch/var/lock/subsys/oracle11 and rm-f/var/lock/subsys/oracle11? The reason is related to the mechanism of the LINUX system: LINUX determines whether a service is started based on whether a file with the same name as the server is in the/var/lock/subsys/directory, if yes, the service has been started. When the system is shut down, LINUX will close all the services listed here and delete files with the same name as the service. If a service is started, but there is no file with the same name of the Service in this directory, the service will not be closed. All articles on the Internet set this location wrong, so we will find that ORACLE can be started with the system, but it is not closed with the system. I also analyzed/etc/rc. d/rc. local and found this principle. After the test, it is true that. After analyzing the mysql startup and shutdown scripts, I finally realized that
 
It turns out that. Please note this.
 
15. register the compiled STARTUP script as a system service.
1) grant the execution permission to the script
Su root
Chown oracle/etc/init. d/redzora
Chmod 775/etc/init. d/redzora
2) create a symbolic link file
Chkconfig -- add/etc/init. d/redzora
(Thank you for your reference)
To execute this command, you need to write # chkconfig: 2345 99 10 in the script. In this way, when the command is executed, go back to the oracle11 file to search for this line of comment, parse this line of comment, and add it to/etc/rc according to the parsing result. d/rc2.d;/etc/rc. d/rc3.d;/etc/rc. d/rc4.d;/etc/rc. d/rc5.d create a symbolic connection file S99oracle11, which is executed when the system starts. In fact, this file points to/etc/init. d/oracle11. When started, the system sends a start parameter to this file, and then runs the start branch in the oracle11 file. In the/etc/rc. d/rc0.d;/etc/rc. d/rc1.d;/etc/rc. d/rc6.d: Create the K10oracle11 file. This file must be executed when the system shuts down. In fact, this file also points to/etc/init. d/oracle11. When it is disabled, the system sends a stop parameter to the file, and the stop branch in the oracle11 file is executed.
 
I think you should understand the meaning of the numbers in # chkconfig: 2345 99 10: point out that the service is started at Level 2, 3, and 5, and 99 is in the corresponding/etc/rc. d/rcN. d (N is the level specified above, here is 2345) the serial number of the link file generated under the directory (startup priority level) S99oracle11, 10. d/rcN. d (N is a level other than 2345) the serial number of the link file generated by the Directory (priority of service stop) K10oracle11. As for the reason for creating naming rules for files and files in these directories, you need to have a familiar understanding of the LINUX system startup process.
 
 
Run the/etc/init. d/redzora start command under the root user.
/Etc/init. d/redzora stop
Auto Start successful

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.