CentOS 6安裝Oracle 11gR2數據庫


1. 安裝前准備

[1] 安裝軟件包

yum -y install binutils compat-libcap1 compat-libstdc++.i686 compat-libstdc++.x86_64 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libXext libXtst libX11 libXau libxcb libXi make sysstat unixODBC-devel.i686 unixODBC-devel.x86_64 unixODBC.i686 unixODBC.x86_64 compat-libstdc++-33.i686 compat-libstdc++-33.x86_64

安裝軟件包 pdksh-5.2.14-36.el5.i386.rpm (這個包yum源里沒有,所以要手動安裝,不裝安裝oracle時會有警告出現,但不影響最后的使用)

請下載這個包上傳到CentOS后使用如下命令安裝。(單擊文件名稱下載)

[root@localhost public_root]# rpm -ivh pdksh-5.2.14-36.el5.i386.rpm

[2] 更改kernel參數

[root@localhost var]# vi /etc/sysctl.conf

# Disable netfilter on bridges.
#net.bridge.bridge
-nf-call-ip6tables = 0

#net.bridge.bridge
-nf-call-iptables = 0

#net.bridge.bridge
-nf-call-arptables = 0


# Controls the default maxmimum size of a mesage queue
kernel.msgmnb
= 65536

# Controls the maximum size of a message,
in bytes
kernel.msgmax
= 65536

# Controls the maximum shared segment size,
in bytes
kernel.shmmax
= 4294967295

# Controls the maximum number of shared memory segments,
in pages
kernel.shmall
= 268435456

# 在文件末尾添加
net.ipv4.ip_local_port_range
= 9000 65500

fs.
file-max = 6815744

kernel.shmall
= 10523004

kernel.shmmax
= 6465333657

kernel.shmmni
= 4096

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@localhost var]# sysctl -p

[3] 創建安裝oracle所需用戶與用戶組

[root@localhost var]# groupadd -g 200 oinstall
[root@localhost var]# groupadd
-g 201 dba
[root@localhost var]# useradd
-u 440 -g oinstall -G dba -d /usr/oracle oracle
[root@localhost var]#
passwd oracle
[root@localhost var]# vi /etc/pam.d/login
#
%PAM-1.0
auth [user_unknown
=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system
-auth
account required pam_nologin.so
account include system
-auth
password include system
-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed
in the user context
session required pam_selinux.so open
session required pam_namespace.so
session required pam_limits.so
session optional pam_keyinit.so force revoke
session include system
-auth
-session optional pam_ck_connector.so
[root@localhost var]# vi /etc/security/limits.conf

# 在文件末尾添加
oracle soft nproc
2047
oracle hard nproc
16384
oracle soft nofile
1024
oracle hard nofile
65536
[root@localhost var]# vi /etc/profile

# 在文件末尾添加
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit
-p 16384
ulimit
-n 65536
else
ulimit
-u 16384 -n 65536
fi
fi

[4] 切換到oracle用戶,並進行配置

[root@localhost ~]# su - oracle
[oracle@localhost
~]$ chmod 755 /usr/oracle
[oracle@localhost
~]$ mkdir /usr/oracle/app
[oracle@localhost
~]$ chmod 755 /usr/oracle/app/
[oracle@localhost
~]$ mkdir /usr/oracle/oradata
[oracle@localhost
~]$ chmod 755 /usr/oracle/oradata/
[oracle@localhost
~]$ vi ./.bash_profile

# 在文件末尾添加
umask
022
export ORACLE_BASE
=/usr/oracle/app

 

2. 安裝oracle database

[1] 下載oracle安裝文件(for linux x86),並上傳到CentOS上

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

[2] 解壓安裝文件

[root@localhost public_root]# unzip linux_11gR2_database_1of2.zip
[root@localhost public_root]#
unzip linux_11gR2_database_2of2.zip

[3] 以oracle用戶登陸,startx命令啟動圖形界面,打開一個終端窗口,進行到剛剛解壓database的文件夾,運行以下命令

[oracle@localhost database]$ ./runInstaller

[4] oracle安裝界面啟動如下圖所示,輸入郵件地址及密碼(oracle用戶),以從oralce接收安全更新等信息

image

[5] 僅安裝數據庫軟體

image

[6] 本實例中選擇安裝單實例數據庫

image

[7] 選擇語言

image

[8] 選擇要安裝的版本,這里選擇 “Enterprise Edition”

image

[9] 指定Oracle Base 與 Software Location, 我們在oracle用戶的profile文件里已設置此環境變量,此處保持默認

image

[10] 指定Inventory Directory, 本例保持默認

image

[11] 指定oralce特權用戶組,本例保持默認

image

[12] 接下來,oralce安裝程序會對安裝環境進行檢查,本例未檢查到任何問題,顯示安裝信息如下。直接Finish, 開始安裝。

image

[13] 靜待oracle安裝

image

[14] 當出現以下窗口時,另開一個終端,以root用戶登陸,並執行下面的命令。執行完畢后,點擊OK

image

[root@localhost ~]# /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@localhost
~]# /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

[15] 至此oracle 11g R2數據庫安裝完畢。

image

[16] 環境變量配置

[oracle@localhost ~]$ vi ~/.bash_profile

# 文件末尾增加
export ORACLE_HOME
=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH
=$PATH:$ORACLE_HOME/bin

[16] 其它注意事項

  • 關閉SeLinux
  • 配置好FTP以上傳安裝程序(也可以使用其它方式)

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com