Install Oracle 11gR2 With OL7
Install Oracle 11gR2 With OL7
################################################
# Require software size
################################################
virtual tool:
VirtualBox
VMwarm
OS:
Oracle Linux 7 (V74844-01) https://edelivery.oracle.com/EPD/Search/get_form
Centos 7
DB:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
or
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
or
linux.x64_11gR2_examples.zip
Memory:1G OEM
1.5G ASM instance and restart
Disk: 3G swap (ram 2g)
1G /tmp
3.8G oracle db software
4.5G Grid Infrastructure software
1.7G preconfigured db
3.4G fast recovery area
System:
1 版本
2 架構
3 memory size
4 swap size
5 /tmp size
6 OS Patch
7 System package
8 System and kernel parameters
9 X server
10 .bash_profile
################################################
# VirtualBox share disk from HOST and VM
################################################
download:
http://www.virtualbox.org/manual/
Resize virtualbox hd
cmd
cd C:\Program Files\Oracle\VirtualBox
VM 關閉,變更為50g
C:\Program Files\Oracle\VirtualBox>VboxManage modifyhd "D:\VirtualBox VMs\CentOS
7\CentOS 7.vdi" --resize 50000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
################################################
# Host check
################################################
Oracle Database 11g Release 2 (11.2) Installation On Oracle Linux 7 (OL7)
https://oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-oracle-linux-7
1 檢查 kernel 版本
[mis@COS1603 ~]$ cat /proc/version
Linux version 3.10.0-229.el7.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)
) #1 SMP Fri Mar 6 11:36:42 UTC 2015
[mis@COS1603 ~]$ uname -r
3.10.0-229.el7.x86_64
------------------------
Kernel Requirements:
On Oracle Linux 7
3.8.13-33.el7uek.x86_64 or later
2 檢查系統架構
[root@COS1603 ~]# uname -m
x86_64
[root@OEL7 ~]# cat /etc/*release*
Oracle Linux Server release 7.1
NAME="Oracle Linux Server"
VERSION="7.1"
ID="ol"
VERSION_ID="7.1"
PRETTY_NAME="Oracle Linux Server 7.1"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:1"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
4 檢查swap 空間大小
[root@COS1603 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 2097148 kB
swapon -s
6 /etc/hostname /etc/hosts
/etc/hostname
[root@localhost ~]# echo "OL1604.ora.cent" > /etc/hostname
[root@localhost ~]# cat /etc/hostname
OL1604.ora.cent
/etc/hosts
ex:
[root@localhost ~]# echo "192.168.11.9 OL1604.ora.cent OL1604" >> /etc/hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.11.9 OL1604.ora.cent OL1604
################################################
# OS kernel parameter
################################################
fs.aio-max-nr: Asynchronous I/O Requests 優化了 Network Setting
1
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.shmmni = 4096
kernel.panic_on_oops = 1
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
net.ipv4.ip_local_port_range = 9000 65500
EOF
vm.swappiness = 0
vm.dirty_ratio = 80
vm.dirty_background_ratio = 3
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
EOF
立即生效
/sbin/sysctl -p
/sbin/sysctl -a
2
cat >> /etc/security/limits.conf <<EOF
#ORACLE configuration
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 134217728
oracle hard memlock 134217728
EOF
################################################
# OS patch check
################################################
rpm -qa package name
rpm -ivh package name
cd /etc/yum.repos.d
wget http://public-yum.oracle.com/public-yum-ol7.repo
vi public-yum-ol7.repo
將以下enable
[ol7_addons]
#linux 7 以前 /etc/sysconfig/rhel.repo
el5_qa_base
el5_u4_base
el5_addons
el5_oracle_addons
語系
locale
not english
#export LANG=en_US.UTF-8
#export LC_ALL=en_US.UTF-8
################################################
# SELinux Firewall
################################################
Firewall:
[root@ol1605 ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since Tue 2016-05-03 13:28:52 CST; 1 day 9h ago
Main PID: 583 (firewalld)
CGroup: /system.slice/firewalld.service
└─583 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
vi /etc/selinux/config
SELINUX=enforcing
the SELINUX flag is set as follows
SELINUX=disable or
SELINUX=permissive >> 都允許但會記錄log;關閉防火牆免干擾
################################################
# X window
################################################
root:
[root@OL1605 stage]# xclock
bash: xclock: command not found...
[root@OL1605 stage]# find / -name X11
/etc/X11
/usr/lib64/X11
/usr/share/X11
[root@OL1605 stage]# yum list xorg-x11-apps
Loaded plugins: langpacks
Available Packages
xorg-x11-apps.x86_64 7.7-6.el7 ol7_latest
[root@OL1605 stage]# yum install xorg-x11-apps.x86_64 -y
Error Warning: Missing charsets in String to FontSet conversion
#export LANG=C
#export LC_ALL=C
[root@ol1605 ~]# xclock
Error: Can't open display:
[root@ol1605 ~]# export DISPLAY=192.168.100.192:0.0
[root@ol1605 ~]# xclock
Warning: Missing charsets in String to FontSet conversion
clock show ok
################################################
# create group user directory
################################################
The Oracle Inventory group (typically, oinstall)
The OSDBA group (typically, dba)
The Oracle software owner (typically, oracle)
The OSOPER group (optional. Typically, oper)
檢查群組是否存在
grep dba /etc/group
grep 500 /etc/group
id oracle
目錄:
mkdir -p /u01/app/grid
chown -R grid:oinstall /u01
su - oracle
ulimit -a
1 su - oracle
2
Check the soft and hard limits for the file descriptor setting
$ ulimit -Sn
4096
$ ulimit -Hn
65536
Check the soft and hard limits for the number of processes available to a user
$ ulimit -Su
2047
$ ulimit -Hu
16384
Check the soft limit for the stack setting
$ ulimit -Ss
10240
$ ulimit -Hs
32768
################################################
# oracle parameter
################################################
grid:
vi /home/grid/.bash_profile
export ORACLE_BASE=/u01/app/grid/
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_SID=+ASM
export PATH=$PATH:HOME/bin:$ORACLE_HOME/bin
export NLS_LANG=
note
NLS:National Language Support
select * from nls_session_parameters;
oracle:
vi /home/oracle/.bash_profile
umask 022
TMP=/tmp
TMPDIR=/$TMP
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
################################################
# install oracle binary
################################################
[root@OL1605 stage]# chown oracle:oinstall p13390677_112040_Linux-x86-64_1of7.zip
[root@OL1605 stage]# chown oracle:oinstall p13390677_112040_Linux-x86-64_2of7.zip
[root@OL1605 stage]# su - oracle
[oracle@OL1605 /]$ cd stage
[oracle@OL1605 stage]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@OL1605 stage]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@OL1605 stage]$ cd database/
[oracle@ol1605 database]$ echo $DISPLAY
192.168.100.192:0.0
[oracle@OL1605 database]$ ./runInstaller
note:
received following error during linking binaries
edit $ORACLE_HOME/sysman/lib/ins_emagent.mk
search for the line
$(MK_EMAGENT_NMECTL)
and replace the line with
$(MK_EMAGENT_NMECTL) -lnnz11
then click “Retry” button
note:
[oracle@OL16051 database]$ ./runInstaller: /stage/database/install/.oui: /lib/ld-linux.so.2: bad ELF interpreter: No such file or
directory
[root@OL16051 /]# yum install glibc.i686 -y
################################################
# netca
################################################
su - oracle
[oracle@OL1605 ~]$ netca
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=OL1605.ora.cent)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 03-MAY-2016 17:03:19
Uptime 0 days 0 hr. 1 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/OL1605/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=OL1605.ora.cent)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
listener.ora
tnsname.ora
################################################
# Listener
################################################
/u01/app/oracle/product/11.2.0/db_home_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
lsnrctl status
lsnrctl start
lsnrctl stop
################################################
# dbca
################################################
/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbca
Database Character Set:請選可以Support中文的-->建議ZHT16MSWIN950
################################################
# Template DB& create db script
################################################
create db script
[oracle@ol1605 scripts]$ pwd
/u01/app/oracle/admin/ORCL/scripts
Template DB:
[oracle@ol1605 templates]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/templates
################################################
# check after install DB
################################################
@$ORACLE_HOME/rdbms/admin/catalog.sql
@$ORACLE_HOME/rdbms/admin/catproc.sql
Conn system/xxxxx
@$ORACLE_HOME/sqlplus/admin/pupbld.sql
################################################
# OEM Oracle Enterprise Manager
################################################
PORT:1158
emca -config dbcontrol db
emctl start dbconsole
emctl stop dbconsole
################################################
# example db
################################################
[root@OL1605 ~]# su - oracle
[oracle@OL1605 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@OL1605 ~]$ cd $ORACLE_HOME
[oracle@OL1605 dbhome_1]$ cd oui
[oracle@OL1605 oui]$ cd bin
[oracle@OL1605 bin]$ echo $DISPLAY
install path
/stage/examples/stage/products.xml
################################################
# delete database
################################################
shutdown immediate
backup database
startup mount restrict force;
--startup mount exclusive restrict;
drop database;
note:
use dbca log檔案刪除比較乾淨
################################################
# Install slient
################################################
--在安裝程式的路徑下找到response的資料夾
[oracle@ol1605 response]$ pwd
/stage/database/response
[oracle@ol1605 response]$ ls
dbca.rsp db_install.rsp netca.rsp
################################################
# auto start oracle
################################################
Edit the “/etc/oratab” file to set restart flag for ORA11G to ‘Y’
ORA11G:/u01/app/oracle/product/11.2.0/db_1:Y
root :
/etc/rc.d/init.d/oradb
#!/bin/bash
# chkconfig: 2345 90 10
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
ORCL_OWN="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- start, stop, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbstart"
touch /var/lock/subsys/oradb
su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORCL_OWN -c "$ORACLE_HOME/bin/emctl stop dbconsole"
su - $ORCL_OWN -c "$ORACLE_HOME/bin/dbshut"
rm -f /var/lock/subsys/oradb
echo "OK"
;;
reload|restart)
$0 stop
$1 start
;;
*)
echo "Usage: 'basename $0' start|stop|restart|reload"
exit 1
esac
exit 0
參考:
http://www.noous.com/2013/09/13/deploy-oracle-database-11gr2-on-rhel6-4/