|
Install Oracle Database 11g R2.
Desktop Environment is required because installation proceeds on GUI. Before Installing, Change some settings for requirement of installing Oracle.
|
[1] |
Install some packages |
[root@db01 ~]#
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc
gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel pdksh
|
[2] |
Edit Kernel parameter. |
[root@db01 ~]#
vi /etc/sysctl.conf
# add at the last
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
[root@db01 ~]#
sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576 |
[3] |
Create a user for Oracle. |
[root@db01 ~]#
groupadd -g 200 oinstall
[root@db01 ~]#
groupadd -g 201 dba
[root@db01 ~]#
useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle
[root@db01 ~]#
vi /etc/pam.d/login
# near line 9: add
session required pam_selinux.so close
session required pam_limits.so
session optional pam_keyinit.so force revoke
[root@db01 ~]#
vi /etc/security/limits.conf
# add at the last
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@db01 ~]#
vi /etc/profile
# add at the last
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
|
[4] |
Switch to a user "Oracle" and configure some settings. |
[oracle@db01 ~]$
chmod 755 /usr/oracle
[oracle@db01 ~]$
mkdir /usr/oracle/app
[oracle@db01 ~]$
chmod 775 /usr/oracle/app
[oracle@db01 ~]$
mkdir /usr/oracle/oradata
[oracle@db01 ~]$
chmod 775 /usr/oracle/oradata
[oracle@db01 ~]$
vi ~/.bash_profile
# add at the last
umask 022
export ORACLE_BASE=/usr/oracle/app
[oracle@db01 ~]$
mkdir tmp
# create a temporary dir for installation
|
Install Oracle Database 11g R2.
Desktop Environment is required because installation proceeds on GUI.
|
[1] |
Download Oracle Databse 11g R2 for Linux and upload on your server.
http://www.oracle.com/technology/software/products/database/index.html
After uploading, refer to follows. |
[oracle@db01 ~]$
cd tmp
[oracle@db01 tmp]$
unzip linux.x64_11gR2_database_1of2.zip
[oracle@db01 tmp]$
unzip linux.x64_11gR2_database_2of2.zip
[oracle@db01 tmp]$
./database/runInstaller
|
[2] |
Oracle Installer starts like follows. First, Set your email address and password for receiving some infomation from Oracle like security issues and so on. |
[3] |
Select "Install database software only". |
[4] |
For this example, select "Single Instance ***". |
[5] |
Select your language. |
[6] |
Select which edition you install. |
[7] |
Specify base directory and files for Oracle. On this example, keep default and Proceed. |
[8] |
Specify directory for installation. On this example, keep default and Proceed. |
[9] |
Specify priviledged group. On this example, keep default and Proceed. |
[10] |
Checking settings runs automatically for requirements of installing Oracle. Generally, some packages requirements failed like follows, but it‘s noplobmen because most of them are higher version packages than requirements. Ignore them if the result is the
same to the follows. |
[11] |
The summary is shown for configuration. Click "Finish" if it‘s OK all. |
[12] |
Installation starts. |
[13] |
Following screen is shown, then open a terminal and execute follwong commands by root user. |
 |
[root@db01 ~]#
/usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /usr/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /usr/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@db01 ~]#
/usr/oracle/app/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /usr/oracle/app/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
# Enter
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions. |
[14] |
Installation completed. Click "Close" button. |
[15] |
Configure some settings for Oracle user. |
[oracle@db01 ~]$
vi ~/.bash_profile
# add at the last line
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@db01 ~]$
source ~/.bash_profile
[oracle@db01 ~]$
rm -rf tmp
|
Create a Oracle Net Listener that is a network service on Oracle.
|
[1] |
Login as Oracle user and input a command "netca", then following screen is shown. Check a box "Listener Configuration" and go next. |
[3] |
Set Listner‘s name. Input any one you like. |
[4] |
This example goes next with keeping default "TCP". If you‘d like to change, Change it. |
[5] |
Set port. This example goes next with keeping default. If you‘d like to change, Change it. |
[6] |
If you‘d like to create more Listener, Answer "Yes". This example selects "No". |
[7] |
Configuration completed. |
[8] |
Click "Finish" to quit. After finishing, Confirm the status by "netstat" comand. Then you‘ll show "tnslsnr" listens 1521 port. |
|
Create a Database.
|
[1] |
Login as a Oracle user and Input a Command "dbca", then following screen is shown. Click "Next" to proceed. |
[2] |
Select "Create Database" and go next. |
[3] |
This example selects "General Purpose ***" and go next. |
[4] |
Set Grobal Database name and SID like follows. Input any one you like. |
[5] |
This example goes next with keeping default. |
[6] |
Set passwords. Please set a password for a user for security. |
[7] |
This example goes next with keeping default "File System". |
[8] |
Configure recovery settings. If you‘d like to change it, Set it. |
[9] |
Configure sample schema and scripts. If you‘d like to add them, Set them. |
[10] |
Configure memory setting. After setting, go to next tab. |
[11] |
Specify max processes. |
[12] |
Set Character setting. |
[13] |
Select connection mode. If your server does not have many clients, Select Dedicated server mode. If your server has many clients, Select Shared server mode. |
[14] |
Confirm parameters for Storage settings. If you‘d like to change, set them. |
[15] |
Configuration completed. Click "Finish" button to finish. |
[16] |
Confirm settings and Click "OK" if all are OK. |
[17] |
Database creation starts. |
[18] |
After completing to create a database, Click "Exit" to finish. |
[19] |
Access to a URL that is shown on finished screen above with web browser, then follwing screen is shown. Input a user name and password that you configured on the section [6]. |
[20] |
Just logined. It‘s possible to manage the database on here. |
|
Create an init Script to make Oracle start automatically on system booting.
|
[1] |
Change like folows first. |
[root@db01 ~]#
vi /etc/oratab
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ‘:‘, is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, ‘#‘, are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
db01:/usr/oracle/app/product/11.2.0/dbhome_1:
Y
# change
[root@db01 ~]#
vi /usr/oracle/.bash_profile
# add your SID at the last line
export ORACLE_SID=db01
|
[2] |
Create an init Script |
[root@db01 ~]#
vi /etc/rc.d/init.d/oracle
# this is an example
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/usr/oracle/app/product/11.2.0/dbhome_1
ORACLE_USER=oracle
case "$1" in
‘start‘)
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
‘stop‘)
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
‘restart‘)
$0 stop
$0 start
;;
‘status‘)
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
[root@db01 ~]#
chmod 755 /etc/rc.d/init.d/oracle
[root@db01 ~]#
/etc/rc.d/init.d/oracle start
Starting Oracle Database:
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 30-MAR-2011 22:40:02
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /usr/oracle/app/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /usr/oracle/app/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /usr/oracle/app/diag/tnslsnr/db01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01.srv.world)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db01.srv.world)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date
30-MAR-2011 22:40:02
Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/usr/oracle/app/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File
/usr/oracle/app/diag/tnslsnr/db01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01.srv.world)(PORT=1521)))
The listener supports no services
The command completed successfully
Processing Database instance "db01": log file /usr/oracle/app/product/11.2.0/dbhome_1/startup.log
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
https://db01.srv.world:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .......... started.
------------------------------------------------------------------
Logs are generated in directory /usr/oracle/app/product/11.2.0/dbhome_1/db01.srv.world_db01/sysman/log
[root@db01 ~]#
chkconfig --add oracle
[root@db01 ~]#
chkconfig oracle on
Centos 5 Oracle 11G 超详细安装
标签: