Install Oracle 11g in CentOS 6.5
I recently started to learn how to use CentOS and make some records.
References: Install Oracle 11g in Cent OS 6_5 (x86_64)
I. Hardware requirements
1. Memory & swap
Minimum: 1 GB of RAM
Recommended: 2 GB of RAM or more
Check memory
[Plain] view plaincopy
- # GrepMemTotal/proc/meminfo
- # GrepSwapTotal/proc/meminfo
2. Hard Disk
Since CentOS is installed almost 4 ~ 5 GB, plus Oracle and so on, so please prepare at least 10 Gb hard disk space.
Check disk status
# Df-h
Ii. Software
System Platform: CentOS6.5 (x86_64)
(I have installed the DeskTop version here. To install the lite version, you must use a separate yum desktop program)
Oracle version: Oracle11g
Bytes
Iii. System Installation notes
During system installation, you must install the desktop mode. Otherwise, oracle cannot be installed. In addition, do not enable SELinux. oracle does not recommend SELinux. Please disable the firewall temporarily to reduce installation troubles. To prevent garbled characters during Oracle Installation, we recommend that you use English as the system language to install Oracle.
The system commands described in this article are marked as "#", which indicates the root permission, and "$" indicates the oracle permission.
4. system preparation before Oracle Installation
First, log in with the root account for some pre-set jobs.
1. Disable and firewall (SELinux temporary close command: setenforce 0 firewall temporary close command: serviceiptablesstop)
2. Install the dependency package
Copy the following RPM package to the/opt directory and run the following command to run the opt directory.
[Plain] view plaincopy
- # Rpm-ivhlibstdc ++ devel-4.4.7-4.el6.x86_64.rpm
- # Rpm-ivhmpfr-2.4.1-6.el6.x86_64.rpm
- # Rpm-ivhcpp-4.4.7-4.el6.x86_64.rpm
- # Rpm-ivhppl-0.10.2-11.el6.x86_64.rpm
- # Rpm-ivhcloog-ppl-0.15.7-1.2.el6.x86_64.rpm
- # Rpm-ivhgcc-4.4.7-4.el6.x86_64.rpm
- # Rpm-ivhgcc-c ++-4.4.7-4. el6.x86 _ 64.rpm
- # Rpm-ivhcompat-libcap1-1.10-1.x86_64.rpm
- # Rpm-ivhcompat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
- # Rpm-ivhlibaio-devel-0.3.107-10.el6.x86_64.rpm
- # Rpm-ivhpdksh-5.2.14-37.el5_8.1.x86_64.rpm
- # Rpm-ivhelfutils-libelf-devel-0.152-1.el6.x86_64.rpm
3. Create users and groups
(1) create groups oinstall and dba
[Plain] view plaincopy
- # Groupaddoinstall
- # Groupadddba
(2) Add the user oracle and add it to the dba group.
[Plain] view plaincopy
- # Useradd-m-goinstall-Gdbaoracle
(4) test whether the oracle account has been created
[Plain] view plaincopy
- # Idoracle
(5) Create a New oracle Password
[Plain] view plaincopy
- # Passwdoracle
4. Add oracle users to The sudo Group
[Plain] view plaincopy
- # Vi/etc/sudoers
Find
RootALL = (ALL) ALL
This line, and add it below
[Plain] view plaincopy
- OracleALL = (ALL) ALL
Enter wq! (Because this is a read-only document, you need to add it !) And press Enter
5. Configure System Kernel Parameters
[Plain] view plaincopy
- # Vi/etc/sysctl. conf
Modify and add the following content:
[Plain] view plaincopy
- Fs. aio-max-nr = 1048576
- Fs. file-max = 6815744
- # Kernel. shmall = 2097152
- # Official document kernel. shmmax = 536870912. In actual software, kernel. shmmax = 980742144
- # Kernel. shmmax = 980742144
- Kernel. shmmni = 4096
- Kernel. sem = 25032000100128
- Net. ipv4.ip _ local_port_range = 900065500
- Net. core. rmem_default = 262144
- Net. core. rmem_max = 4194304
- Net. core. wmem_default = 262144
- Net. core. wmem_max = 1048586
- Vm. hugetlb_shm_group = 501
- # Oracle user group dbaid is 501 to completely resolve ORA-27125 errors.
- # Idoracle
We can see thatOracleGroupDbaidIs501
If there are some parameters that are repeated with the current ones, modify them to the ones provided on the file.
After editing, save and execute:
[Plain] view plaincopy
- # Sysctl-p
Enable the change.
6. edit/etc/security/limits. conf.
[Plain] view plaincopy
- # Vi/etc/security/limits. conf
Add the following four lines
[Plain] view plaincopy
- Oraclesoftnproc2047
- Oraclehardnproc16384
- Oraclesoftnofile1024
- Oraclehardnofile65536
7. edit/etc/pam. d/login.
[Plain] view plaincopy
- # Vi/etc/pam. d/login
Add the following two lines
[Plain] view plaincopy
- Sessionrequired/lib64/security/pam_limits.so
- Sessionrequiredpam_limits.so
8. Modify/etc/profile
[Plain] view plaincopy
- # Vi/etc/profile
Add the following code to the profile file.
[Plain] view plaincopy
- If [$ USER = "oracle"]; then
- If [$ SHELL = "/bin/ksh"]; then
- Ulimit-p16384
- Ulimit-n65536
- Else
- Ulimit-u16384-n65536
- Fi
- Fi
10. Create an Oracle installation folder and a data storage folder
[Plain] view plaincopy
- # Mkdir/opt/oracle
- # Mkdir/opt/oracle/112
- # Mkdir/opt/oraInventory
- # Chown-Roracle: dba/opt/oracle
- # Chown-Roracle: dba/opt/oraInventory
- # Chown-Roracle: dba/opt
11. configure a Linux host
Check whether the localhost record (pointing to 127.0.0.1) exists in the/etc/hosts file. If it does not exist, some problems may occur when configuring the Oracle listener later, resulting in failure to start the listener, manually add this record here.
Add the following configurationIPAddress and host name ing
[Plain] view plaincopy
- 192.168.1.101CentOS-Oracle
(192.168.1.101 is the IP address of the machine to be installed. CentOS-Oracle is the host name of the machine to be installed. Please fill in according to your situation)
After completing these settings, log out of the root account and log on to the system again with the oracle account.
12. Configure oracle user environment variables
[Plain] view plaincopy
- # Suoracle
- $ Cd/home/oracle
- $ Vi. bash_profile
Modify and add the following content
[Plain] view plaincopy
- ORACLE_BASE =/opt/oracle # The Oracle installation folder created above
- ORACLE_HOME = $ ORACLE_BASE/112
- ORACLE_SID = orcl
- LD_LIBRARY_PATH = $ ORACLE_HOME/lib
- PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/bin
- ExportORACLE_BASEORACLE_HOMEORACLE_SIDLD_LIBRARY_PATHPATH
- # PATH = $ PATH: $ HOME/bin
- # ExportPATH
Save and run the following command to make the settings take effect:
[Plain] view plaincopy
- $ Source/home/oracle/. bash_profile
5. install and configure Oracle
1. decompress the Installation File
Release to the/opt/oracle folder where oracle is to be installed
Return to Terminal Mode and enter the oracle Folder:
[Plain] view plaincopy
- $ Cd/opt/oracle
Decompress [plain] view plaincopy
- $Unzipp13390677_112040_Linux-x86-64_1of7.zip
- $Unzipp13390677_112040_linux-x86-64204 f7.zip
Next we will see a series of decompression actions.
After decompression, you will see the database folder in the same folder. Please enter the database Folder:
[Plain] view plaincopy
- $ Cddatabase
Prepare to install the database. If your operating system is in a Chinese environment, Chinese characters may be garbled during installation. Use the following command
$ Export LANG = en_US.UTF-8
It must not be missing.UTF-8Otherwise, the following error is prompted:
[Plain] view plaincopy
- [Oracle @ databasedatabase] $ exportLANG = en_US
- [Oracle @ databasedatabase] $./runInstaller
- ERROR: Unabletoconvertfrom "UTF-8" to "ISO-8859-1" forNLS!
- Redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1orasianux-2
- /Tmp/OraInstall2013-09-06_09-17-04AM. [oracle @ databasedatabase] $
Run the command (switch to oracle to log on to the desktop and then execute the command)
$./RunInstaller
(The following problems are basically caused by remote tool installation)
If you cannot see the installation interface, run the following command in the root account before running the installation program:
# Export DISPLAY =: 0.0
# Xhost +
Switch back to ORACLE user
$./RunInstaller
Start to execute the installation program.
The InstallSummary screen is displayed. You only need to press the Install button to start installation.
Select advanced installation to specify the character set ZH16GBK.
2. Installation Process (omitted)
3. After installation, log on to the EM console.
Address: https: // db: 1158/em
Use SYS and SYSTEM to log on and verify that the installation is successful.
Vi. References
6.1 set Oracle service to start automatically
1. Modify the Oracle system configuration file:/etc/oratab. Only in this way can dbstart and dbshut of Oracle be used.
[Plain] view plaincopy
- # Vi/etc/oratab
- Orcl:/opt/oracle/102: Y
- # Entriesareoftheform:
- # $ ORACLE_SID: $ ORACLE_HOME: <N | Y>:
2. Create the file oracle under/etc/init. d/. The content is as follows:
[Plain] view plaincopy
- # Vi/etc/init. d/oracle
[Plain] view plaincopy
- #! /Bin/bash
- # Chkconfig: 358010
- # Description: Oracleautostart-stopscript.
- #
- # SetORA_HOMEtobeequivalenttothe $ ORACLE_HOME
- # Fromwhichyouwishtoexecutedbstartanddbshut;
- #
- # SetORA_OWNERtotheuseridoftheownerofthe
- # OracledatabaseinORA_HOME.
- ORA_HOME =/opt/oracle/1 <spanstyle = "font-family: ;"> 1 </span> 2
- ORA_OWNER = oracle
- If [! -F $ ORA_HOME/bin/dbstart]
- Then
- Echo "Oraclestartup: cannotstart"
- Exit
- Fi
- Case "$1" in
- 'Start ')
- # StarttheListener:
- Echo "startingeffeclelisteners ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: starting1_lelistenersaspartofsystemup.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctlstart">/var/log/oracle
- Echo "Done ."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: Finished.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Touch/var/lock/subsys/oracle
- # StarttheOracledatabases:
- Echo "StartingOracleDatabases ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: StartingOracleDatabasesaspartofsystemup.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbstart">/var/log/oracle
- Echo "Done"
- # Startthedbconsole:
- Echo "StartingOracledbconsole ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: StartingOracledbconsoleaspartofsystemup.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctlstartdbconsole">/var/log/oracle
- Echo "Done ."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: Finished.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Touch/var/lock/subsys/oracle
- ;;
- 'Stop ')
- # StoptheOracledbconsole:
- Echo "StopingOracledbconsole ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: StopingOracledbconsoleaspartofsystemdown.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctlstopdbconsole">/var/log/oracle
- Echo "Done ."
- # StoptheOracleDatabase:
- Echo "StopingOracleDatabases ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: StopingOracleDatabasesaspartofsystemdown.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbshut">/var/log/oracle
- Echo "Done ."
- Echo ""
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: Finished.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- # Stopthepoliclelistener:
- Echo "stopingeffeclelisteners ..."
- Echo "-----------------------------------------------">/var/log/oracle
- Date + "% T % a % D: stoping1_lelisteneraspartofsystemdown.">/var/log/oracle
- Echo "-----------------------------------------------">/var/log/oracle
- Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctlstop">/var/log/oracle
- Echo "Done ."
- Rm-f/var/lock/subsys/oracle
- ;;
- 'Restart ')
- $0 stop
- $0 start
- ;;
- <Styletype = "text/css"> P {margin-bottom: 0.08in; direction: ltr; text-align: justify ;} </style> <styletype = "text/css"> P {margin-bottom: 0.08in; direction: ltr; text-align: justify;} </style> esac
3. Change File Permissions
[Plain] view plaincopy
- # Chmod755/etc/init. d/oracle
4. Add a service
[Plain] view plaincopy
- # Chkconfig -- level35oracleon
5. You need to stop the database before shutting down or restarting the machine.
[Plain] view plaincopy
- # Ln-s/etc/init. d/oracle/etc/rc0.d/K01oracle // Shutdown
- # Ln-s/etc/init. d/oracle/etc/rc6.d/K01oracle // restart
6. Usage
[Plain] view plaincopy
- # Serviceoraclestart // start oracle
- # Serviceoraclestop // close oracle
- # Service‑lerestart // restart oracle
7. Test
[Plain] view plaincopy
- A. Auto Start
- B. serviceoraclestop
- C. serviceoraclestart
- D. service‑lerestart
Now, the script for starting and stopping the Oracle service and the auto-starting setting for starting the Oracle service are complete.