Install oracle on Centos6
It is really not easy to install oracle on linux. A lot of dependent libraries need to be installed. After a long time, the installation is successful. Record the installation to prevent subsequent installation, because I can't remember the databases that need to be depended on.
1. Create an oracle user, user group, and installation directory:
Create oracle users and user groups
Groupadd oinstall # create a user group oinstall
Groupadd dba # create a user group dba
Useradd-g oinstall-g dba-m oracle # create an oracle user and add it to the oinstall and dba user groups
Passwd oracle # Set the user's oracle login password and enter the password twice as prompted
Create installation directory
Mkdir-p/opt/oracle/app # oracle database installation directory
Mkdir-p/opt/oracle/app/oracle # directory of the oracle Database Configuration File
Mkdir-p/opt/oracle/app/oradata
Mkdir-p/opt/oraInventory
Chown-R oracle: oinstall/opt/oraInventory
Chown-R oracle: oinstall/opt/oracle # grant permissions to oracle users and user groups oinstall
2. Modify the System ID (oracle does not support CentOS installation by default)
Vi/etc/redhat-release # Edit
CentOS release 6.5 (Final)
To: redhat-5
3. Configure the user environment
Vi/home/oracle/. bash_profile
Export PATH
Export ORACLE_BASE =/opt/oracle
Export ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
Export ORACLE_SID = orcl
Export ORACLE_TERM = xterm # window installation mode
Export PATH = $ ORACLE_HOME/bin: $ PATH
Export LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK # Set the Oracle client character set. If the character set is set, it must be consistent with the character set during Oracle installation, for example, ZHS16GBK; otherwise, Chinese characters may be garbled during data import and export
4. Disable selander.
Vi/etc/selinux/config # edit the configuration file
# SELINUX = enforcing # comment out
# SELINUXTYPE = targeted # comment out
SELINUX = disabled # Add
5. configure the firewall to enable port 1521
Vi/etc/sysconfig/iptables # edit the firewall configuration file and add the following content
-A input-m state -- state NEW-m tcp-p tcp -- dport 1521-j ACCEPT
/Etc/init. d/iptables restart # restart the firewall to make the configuration take effect.
Set DISPLAY
Export DISPLAY = 192.168.193.110
Vi/etc/inittab
Id: 3: initdefault: # Change 3 to 5 (the Desktop system can be started successfully only after it is installed. If the Desktop system is not installed and oracle cannot be installed, install the Desktop command yum groupinstall-y "Desktop ")
6. restart the system
Shutdown-r now
7. decompress the oracle zip package
Unziplinux.x64_11gR2_database.zip
If no unzip command is prompted, install yum install-y zip unzip
8. Grant the decompressed directory to the oracle user.
Chown-R oracle: oinstall/opt/linux. x64_11gR2_database
9 switch users
Su oracle
10. Enter the directory where the runInstaller of the execution file is located.
Cd/opt/linux. x64_11gR2_database/database
In this case, the runInstaller in the directory does not have the execution permission. Authorize
Chmod 755 runInstaller
Install oracle
Libraries installed before installation
Yum install-y gcc * gcc-c ++-* glibc-devel-* glibc-headers-* compat-libstdc * elfutils-libelf-devel * libaio- devel * sysstat * unixODBC-* pdksh -*
Install oracle
./RunInstaller
The file/opt/linux. x64_11gR2_database/database/install/. oui is not authorized.
Chmod 755/opt/linux. x64_11gR2_database/database/install/. oui
Chmod 755/opt/linux. x64_11gR2_database/database/install/unzip
After the installation, the installation page will be displayed.
There may be another problem, that is, if the Chinese version of the installation is installed and the installation interface may be garbled, cancel the installation and execute
Export LANG = en_US.UTF-8
You can install it again.
You can follow the prompts to continue the installation.
2. After the installation is complete, set the listener before creating the database.
Netca # configure listener commands
The listener settings page will be called up.
Complete the next step
Create an Oracle database instance orcl
Dbca # Start the oracle instance installation interface,
Follow the prompts to install the SDK step by step.
There are four options in this step. Character Sets the database language. If the preceding environment variable is set, this step needs to correspond
For example
Select ZHS16GBK-GBK 16-bit Simplified Chinese
National character set: AL16UTF16-Unicode UTF-16 Universal character set
Default language: Simplified Chinese
Default region: China
If File '/etc/oratab' is not accesssiblei exists in the window that is then dyed, run it as root
Note: If the above prompt appears, you can log on with the root account after the installation is complete and execute the following two Commands
./Opt/oracle/app/product/11.2.0/db_1/root. sh
./Opt/oraInventory/orainstRoot. sh
Generate the/etc/oratab file.
4. Start the oracle database
Su-oracle # Switch to oracle user
Sqlplus/nolog # Enter sqlplus
Conn/as sysdba # Log On as a super Administrator
Startup # Start a database instance
Quit # exit
Lsnrctl start # start the listener
Startup parameter description:
Startup # Start the database instance and open the database without any parameters.
Startup nomount # Only start the database instance, do not open the database, is generally used to create a new database
Startup mount # Start the database instance and load the database, but do not open the database. It is generally used to modify the Database Name and manage it.
8. Close the oracle database
Su-oracle # Switch to oracle user
Lsnrctl stop # disable listener
Sqlplus/nolog # Enter sqlplus
Shutdown immediate # Shut Down database instances
Quit # exit
Shutdown parameter description:
Normal # Wait until all users are disconnected. New connections are not allowed after the command is executed.
Immediate # Wait until the user completes the current statement and disconnect the user. New users are not allowed to connect.
Transactional # Disconnect after the user completes the current transaction and do not allow new users to connect
Abort # force disconnect and close the database
The preceding three methods do not cause database errors. The last method is not recommended unless otherwise specified,
Shutdown immediate is generally used to close the database.
Note: If you execute shutdown immediate, The ORA-01012: not logged on error occurs.
Run the following statement first.
Ps-ef | grep ora_dbw0 _ $ orcl
Kill-9 pid # pid is the process number
Here, orcl is the SID of the database.
9. Set oracle startup
Note: Oracle is not automatically started after Oracle is installed in linux.
1. su-root # Switch to the root user
/Data/oracle/product/11.2.0/db_1/root. sh # Run the script to generate the/etc/oratab file.
/Data/oraInventory/orainstRoot. sh
2. vi/etc/oratab # Edit
Find: $ ORACLE_SID: $ ORACLE_HOME: <N | Y>:
Cancel the # comment and modify it:
Orcl:/data/oracle/product/11.2.0/db_1: Y # orcl indicates the name of the oracle database instance.
: Wq! # Save and exit
3. Edit vi/data/oracle/product/11.2.0/db_1/bin/dbstart #
Found: ORACLE_HOME_LISTNER = $1
Changed to: ORACLE_HOME_LISTNER = $ ORACLE_HOME
4. vi/data/oracle/product/11.2.0/db_1/bin/dbshut # Edit
Found: ORACLE_HOME_LISTNER = $1
Changed to: ORACLE_HOME_LISTNER = $ ORACLE_HOME
5. Create an oracle Startup Script
Vi/etc/init. d/oracle # edit and add the following code
######################################## ##################
#! /Bin/sh
# Chkconfig: 0356 99 10
# Description: Startup Script for Oracle Databases
# Script path:/etc/init. d/oracle
# Author: www. osyunwei. comby qihang01
#
ORACLE_BASE =/data/oracle
ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID = orcl
PATH = $ ORACLE_HOME/bin:/usr/sbin: $ PATH
Export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
#
ORA_OWNR = "oracle"
#
If [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME]
Then
Echo "Oracle startup: cannot start"
Exit 1
Fi
#
Case "$1" in
Start)
Su-$ ORA_OWNR-lc $ ORACLE_HOME/bin/dbstart
Echo "Oracle Start Succesful! "
;;
Stop)
#
Su-$ ORA_OWNR-lc $ ORACLE_HOME/bin/dbshut
Echo "Oracle Stop Succesful! "
;;
Restart)
$0 stop
$0 start
;;
*)
Echo $ "Usage: 'basename $ 0' {start | stop | restart }"
Exit 1
Esac
Exit 0
######################################## ##################
: Wq! # Save and exit
Chown oracle. oinstall/etc/init. d/oracle # change the file owner
Chmod 755/etc/init. d/oracle # Add execution permission
Ln-s/etc/init. d/oracle/etc/rc3.d/S99oracle # Add system startup Level 3 soft connection
Ln-s/etc/init. d/oracle/etc/rc5.d/S99oracle # Add 5 soft connections at system startup level
Ln-s/etc/init. d/oracle/etc/rc0.d/K01oracle # Add a soft connection for system shutdown
Ln-s/etc/init. d/oracle/etc/rc6.d/K01oracle # Add a soft connection to restart the system
Chkconfig-add oracle # add System Service
Chkconfig oracle on # Set startup
Note: # chkconfig: 0356 99 10
0356: Define the running level
99: boot priority (the greater the number, the more late the boot)
10: shutdown stop priority (the smaller the number, the earlier the shutdown)
System O & M www.osyunwei.com reminder: qihang01 original content is copyrighted. For more information, see the source and original article links.
6. Restore the Operating System ID
Vi/etc/redhat-release # Edit
Put: redhat-4
Change to: CentOS release 5.8 (Final)
: Wq! # Save and exit
7. Change the default startup level to 3.
Vi/etc/inittab # Edit
Id: 3: initdefault: # modify 5 to 3
: Wq! # Save and exit
8. Test
Shutdown-r now # restart the system
Service oracle start # start oracle
Service oracle stop # disable oracle
/Etc/init. d/oracle restart # restart oracle
Su-oracle # Switch to oracle user
Dbstart # Start oracle
Dbshut # disable oracle
Ps-efw | grep ora # view oracle Processes
Ps-efw | grep LISTEN | grep-v gre # view oracle port listening
Lsnrctl status # view the oracle running status
So far, the installation of Oracle 11g R2 in CentOS is complete.
Additional reading:
Use a vnc remote connection to install Oracle. If an error occurs and the installation interface cannot be started, perform the following operations!
Log On with root ssh
Vncserver # Start vnc
New 'www: 1 (root) 'desktop is www: 1 # Remember www: 1, which will be used later!
Export DISPLAY = www: 1 # Input
Service vncserver start # start vnc
Use the vnc client root to log on
Xhost +
Su-oracle # Switch to oracle user
./RunInstaller # Run the installation
Reference: http://www.cnblogs.com/zhwl/p/3719302.html