Install Oracle 11g in CentOS 6.5

Source: Internet
Author: User

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
  1. # GrepMemTotal/proc/meminfo
  2. # 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
  1. # Rpm-ivhlibstdc ++ devel-4.4.7-4.el6.x86_64.rpm
  2. # Rpm-ivhmpfr-2.4.1-6.el6.x86_64.rpm
  3. # Rpm-ivhcpp-4.4.7-4.el6.x86_64.rpm
  4. # Rpm-ivhppl-0.10.2-11.el6.x86_64.rpm
  5. # Rpm-ivhcloog-ppl-0.15.7-1.2.el6.x86_64.rpm
  6. # Rpm-ivhgcc-4.4.7-4.el6.x86_64.rpm
  7. # Rpm-ivhgcc-c ++-4.4.7-4. el6.x86 _ 64.rpm
  8. # Rpm-ivhcompat-libcap1-1.10-1.x86_64.rpm
  9. # Rpm-ivhcompat-libstdc ++-33-3.2.3-69.el6.x86_64.rpm
  10. # Rpm-ivhlibaio-devel-0.3.107-10.el6.x86_64.rpm
  11. # Rpm-ivhpdksh-5.2.14-37.el5_8.1.x86_64.rpm
  12. # 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
  1. # Groupaddoinstall
  2. # Groupadddba

(2) Add the user oracle and add it to the dba group.

[Plain] view plaincopy
  1. # Useradd-m-goinstall-Gdbaoracle

(4) test whether the oracle account has been created

[Plain] view plaincopy
  1. # Idoracle

(5) Create a New oracle Password

[Plain] view plaincopy
  1. # Passwdoracle

4. Add oracle users to The sudo Group

[Plain] view plaincopy
  1. # Vi/etc/sudoers

Find
RootALL = (ALL) ALL
This line, and add it below

[Plain] view plaincopy
  1. 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
  1. # Vi/etc/sysctl. conf

Modify and add the following content:

[Plain] view plaincopy
  1. Fs. aio-max-nr = 1048576
  2. Fs. file-max = 6815744
  3. # Kernel. shmall = 2097152
  4. # Official document kernel. shmmax = 536870912. In actual software, kernel. shmmax = 980742144
  5. # Kernel. shmmax = 980742144
  6. Kernel. shmmni = 4096
  7. Kernel. sem = 25032000100128
  8. Net. ipv4.ip _ local_port_range = 900065500
  9. Net. core. rmem_default = 262144
  10. Net. core. rmem_max = 4194304
  11. Net. core. wmem_default = 262144
  12. Net. core. wmem_max = 1048586
  13. Vm. hugetlb_shm_group = 501
  14. # Oracle user group dbaid is 501 to completely resolve ORA-27125 errors.
  15. # 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
  1. # Sysctl-p

Enable the change.

6. edit/etc/security/limits. conf.

[Plain] view plaincopy
  1. # Vi/etc/security/limits. conf

Add the following four lines

[Plain] view plaincopy
  1. Oraclesoftnproc2047
  2. Oraclehardnproc16384
  3. Oraclesoftnofile1024
  4. Oraclehardnofile65536

7. edit/etc/pam. d/login.

[Plain] view plaincopy
  1. # Vi/etc/pam. d/login

Add the following two lines

[Plain] view plaincopy
  1. Sessionrequired/lib64/security/pam_limits.so
  2. Sessionrequiredpam_limits.so

8. Modify/etc/profile

[Plain] view plaincopy
  1. # Vi/etc/profile

Add the following code to the profile file.

[Plain] view plaincopy
  1. If [$ USER = "oracle"]; then
  2. If [$ SHELL = "/bin/ksh"]; then
  3. Ulimit-p16384
  4. Ulimit-n65536
  5. Else
  6. Ulimit-u16384-n65536
  7. Fi
  8. Fi

10. Create an Oracle installation folder and a data storage folder

[Plain] view plaincopy
  1. # Mkdir/opt/oracle
  2. # Mkdir/opt/oracle/112
  3. # Mkdir/opt/oraInventory
  4. # Chown-Roracle: dba/opt/oracle
  5. # Chown-Roracle: dba/opt/oraInventory
  6. # 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
  1. 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
  1. # Suoracle
  2. $ Cd/home/oracle
  3. $ Vi. bash_profile

Modify and add the following content

[Plain] view plaincopy
  1. ORACLE_BASE =/opt/oracle # The Oracle installation folder created above
  2. ORACLE_HOME = $ ORACLE_BASE/112
  3. ORACLE_SID = orcl
  4. LD_LIBRARY_PATH = $ ORACLE_HOME/lib
  5. PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/bin
  6. ExportORACLE_BASEORACLE_HOMEORACLE_SIDLD_LIBRARY_PATHPATH
  7. # PATH = $ PATH: $ HOME/bin
  8. # ExportPATH

Save and run the following command to make the settings take effect:

[Plain] view plaincopy
  1. $ 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
  1. $ Cd/opt/oracle
Decompress [plain] view plaincopy
  1. $Unzipp13390677_112040_Linux-x86-64_1of7.zip
  2. $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
  1. $ 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
  1. [Oracle @ databasedatabase] $ exportLANG = en_US
  2. [Oracle @ databasedatabase] $./runInstaller
  3. ERROR: Unabletoconvertfrom "UTF-8" to "ISO-8859-1" forNLS!
  4. Redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1orasianux-2
  5. /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
  1. # Vi/etc/oratab
  2. Orcl:/opt/oracle/102: Y
  3. # Entriesareoftheform:
  4. # $ ORACLE_SID: $ ORACLE_HOME: <N | Y>:

2. Create the file oracle under/etc/init. d/. The content is as follows:

[Plain] view plaincopy
  1. # Vi/etc/init. d/oracle

[Plain] view plaincopy
  1. #! /Bin/bash
  2. # Chkconfig: 358010
  3. # Description: Oracleautostart-stopscript.
  4. #
  5. # SetORA_HOMEtobeequivalenttothe $ ORACLE_HOME
  6. # Fromwhichyouwishtoexecutedbstartanddbshut;
  7. #
  8. # SetORA_OWNERtotheuseridoftheownerofthe
  9. # OracledatabaseinORA_HOME.
  10. ORA_HOME =/opt/oracle/1 <spanstyle = "font-family: ;"> 1 </span> 2
  11. ORA_OWNER = oracle
  12. If [! -F $ ORA_HOME/bin/dbstart]
  13. Then
  14. Echo "Oraclestartup: cannotstart"
  15. Exit
  16. Fi
  17. Case "$1" in
  18. 'Start ')
  19. # StarttheListener:
  20. Echo "startingeffeclelisteners ..."
  21. Echo "-----------------------------------------------">/var/log/oracle
  22. Date + "% T % a % D: starting1_lelistenersaspartofsystemup.">/var/log/oracle
  23. Echo "-----------------------------------------------">/var/log/oracle
  24. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctlstart">/var/log/oracle
  25. Echo "Done ."
  26. Echo "-----------------------------------------------">/var/log/oracle
  27. Date + "% T % a % D: Finished.">/var/log/oracle
  28. Echo "-----------------------------------------------">/var/log/oracle
  29. Touch/var/lock/subsys/oracle
  30. # StarttheOracledatabases:
  31. Echo "StartingOracleDatabases ..."
  32. Echo "-----------------------------------------------">/var/log/oracle
  33. Date + "% T % a % D: StartingOracleDatabasesaspartofsystemup.">/var/log/oracle
  34. Echo "-----------------------------------------------">/var/log/oracle
  35. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbstart">/var/log/oracle
  36. Echo "Done"
  37. # Startthedbconsole:
  38. Echo "StartingOracledbconsole ..."
  39. Echo "-----------------------------------------------">/var/log/oracle
  40. Date + "% T % a % D: StartingOracledbconsoleaspartofsystemup.">/var/log/oracle
  41. Echo "-----------------------------------------------">/var/log/oracle
  42. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctlstartdbconsole">/var/log/oracle
  43. Echo "Done ."
  44. Echo "-----------------------------------------------">/var/log/oracle
  45. Date + "% T % a % D: Finished.">/var/log/oracle
  46. Echo "-----------------------------------------------">/var/log/oracle
  47. Touch/var/lock/subsys/oracle
  48. ;;
  49. 'Stop ')
  50. # StoptheOracledbconsole:
  51. Echo "StopingOracledbconsole ..."
  52. Echo "-----------------------------------------------">/var/log/oracle
  53. Date + "% T % a % D: StopingOracledbconsoleaspartofsystemdown.">/var/log/oracle
  54. Echo "-----------------------------------------------">/var/log/oracle
  55. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/emctlstopdbconsole">/var/log/oracle
  56. Echo "Done ."
  57. # StoptheOracleDatabase:
  58. Echo "StopingOracleDatabases ..."
  59. Echo "-----------------------------------------------">/var/log/oracle
  60. Date + "% T % a % D: StopingOracleDatabasesaspartofsystemdown.">/var/log/oracle
  61. Echo "-----------------------------------------------">/var/log/oracle
  62. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/dbshut">/var/log/oracle
  63. Echo "Done ."
  64. Echo ""
  65. Echo "-----------------------------------------------">/var/log/oracle
  66. Date + "% T % a % D: Finished.">/var/log/oracle
  67. Echo "-----------------------------------------------">/var/log/oracle
  68. # Stopthepoliclelistener:
  69. Echo "stopingeffeclelisteners ..."
  70. Echo "-----------------------------------------------">/var/log/oracle
  71. Date + "% T % a % D: stoping1_lelisteneraspartofsystemdown.">/var/log/oracle
  72. Echo "-----------------------------------------------">/var/log/oracle
  73. Su-$ ORA_OWNER-c "$ ORA_HOME/bin/lsnrctlstop">/var/log/oracle
  74. Echo "Done ."
  75. Rm-f/var/lock/subsys/oracle
  76. ;;
  77. 'Restart ')
  78. $0 stop
  79. $0 start
  80. ;;
  81. <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
  1. # Chmod755/etc/init. d/oracle

4. Add a service

[Plain] view plaincopy
  1. # Chkconfig -- level35oracleon

5. You need to stop the database before shutting down or restarting the machine.

[Plain] view plaincopy
  1. # Ln-s/etc/init. d/oracle/etc/rc0.d/K01oracle // Shutdown
  2. # Ln-s/etc/init. d/oracle/etc/rc6.d/K01oracle // restart

6. Usage

[Plain] view plaincopy
  1. # Serviceoraclestart // start oracle
  2. # Serviceoraclestop // close oracle
  3. # Service‑lerestart // restart oracle

7. Test

[Plain] view plaincopy
  1. A. Auto Start
  2. B. serviceoraclestop
  3. C. serviceoraclestart
  4. 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.

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.