1 安裝目標與規劃 交易系統1台HP DL580 G9伺服器將安裝Oracle11gR2 。 1.1 安裝介質版本 主機名 his1 IP地址 192.168.40.102 Oracle Grid軟體 Oracle DB軟體版本 Oracle Enterprise11g 補丁集版本 Oracle 1 ...
1 安裝目標與規劃
交易系統1台HP DL580 G9伺服器將安裝Oracle11gR2 。
1.1 安裝介質版本
主機名 |
his1 |
IP地址 |
192.168.40.102 |
Oracle Grid軟體 |
|
Oracle DB軟體版本 |
Oracle Enterprise11g |
補丁集版本 |
Oracle 11.2.0.4 |
PSU(推薦補丁版本) |
Oracle 11.2.0.4.160719 |
1.2 安裝目錄規劃
項目 |
類別 |
目錄 |
空間大小 |
Oracle軟體目錄 |
Oracle DB |
/oracle/11.2.0/db/dbhome1 |
20GB |
Oracle 線上日誌文件及控制文件、數據文件、歸檔日誌文件 |
控制文件,線上日誌,數據文件 |
/data |
500GB |
文件系統 |
歸檔備份 |
/archive |
500GB |
2 安裝環境檢查
2.1 硬體配置檢查
2.1.1物理記憶體,最小需求1024M
[root@his1 ~]# grep MemTotal /proc/meminfo MemTotal: 2075524 kB |
2.1.2交換區SWAP大小
[root@his1 ~]# grep SwapTotal /proc/meminfo SwapTotal: 8385920 kB |
||||||||
|
2.1.3可用記憶體和交換空間
[root@ his1 ~]# free -m total used free shared buffers cached Mem: 2026 1291 735 0 73 1005 -/+ buffers/cache: 212 1814 Swap: 8189 0 8189 |
2.1.4臨時目錄/tmp 最少400MB
[root@his1 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda6 58G 9.4G 46G 18% / /dev/sda5 500G 0.4G 500G 0.018% /archive /dev/sda4 500G 0.4G 500G 0.018% /data /dev/sda3 20.1G 73M 20G 0.2% /oracle /dev/sda2 7.8G 358M 7.0G 5% /tmp /dev/sda1 388M 34M 334M 10% /boot tmpfs 1014M 528M 486M 53% /dev/shm |
2.1.5安裝軟體的剩餘磁碟空間4.5G以上,安裝目錄在/u01
掛接點 |
大小 |
/ |
60GB |
swap |
8GB |
/oracle |
500GB |
/archive |
500GB |
2.1.6配置主機名解析
[root@his1 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.40.102 his1 |
這個不設置的話安裝的時候會出錯。 |
2.1.7CPU信息
[root@his1 ~]# grep "model name" /proc/cpuinfo model name : Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz |
2.2 軟體需求檢查
2.2.1操作系統需求
[root@his1 ~]# cat /proc/version Linux version 2.6.18-164.el5PAE ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Sep 3 02:28:20 EDT 2009 |
[root@his1 ~]# cat /etc/issue Enterprise Linux Enterprise Linux Server release 5.4 (Carthage) Kernel \r on an \m |
2.2.2操作系統核心版本需求
[root@his1 ~]# uname -a Linux his1 2.6.18-164.el5PAE #1 SMP Thu Sep 3 02:28:20 EDT 2009 i686 i686 i386 GNU/Linux |
2.2.3系統軟體包需求
Asianux Server 3, Oracle Linux 5, and Red Hat Enterprise Linux 5, The following packages (or later versions) must be installed: binutils-2.17.50.0.6 compat-libstdc++-33-3.2.3 elfutils-libelf-0.125 elfutils-libelf-devel-0.125 elfutils-libelf-devel-static-0.125 gcc-4.1.2 gcc-c++-4.1.2 glibc-2.5-24 glibc-common-2.5 glibc-devel-2.5 glibc-headers-2.5 kernel-headers-2.6.18 ksh-20060214 libaio-0.3.106 libaio-devel-0.3.106 libgcc-4.1.2 libgomp-4.1.2 libstdc++-4.1.2 libstdc++-devel-4.1.2 make-3.81 sysstat-7.0.2 |
查看命令
yum list binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat |
[root@his1 ~]# yum list binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat Loaded plugins: security file:///media/cdrom1/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/media/cdrom1/Server/repodata/repomd.xml' Trying other mirror. Installed Packages binutils.i386 2.17.50.0.6-12.el5 installed elfutils-libelf.i386 0.137-3.el5 installed elfutils-libelf-devel.i386 0.137-3.el5 installed elfutils-libelf-devel-static.i386 0.137-3.el5 installed gcc.i386 4.1.2-46.el5 installed gcc-c++.i386 4.1.2-46.el5 installed glibc.i686 2.5-42 installed glibc-common.i386 2.5-42 installed glibc-devel.i386 2.5-42 installed glibc-headers.i386 2.5-42 installed kernel-headers.i386 2.6.18-164.el5 installed ksh.i386 20080202-14.el5 installed libaio.i386 0.3.106-3.2 installed libaio-devel.i386 0.3.106-3.2 installed libgcc.i386 4.1.2-46.el5 installed libgomp.i386 4.4.0-6.el5 installed libstdc++.i386 4.1.2-46.el5 installed make.i386 1:3.81-3.el5 installed sysstat.i386 7.0.2-3.el5 installed Available Packages glibc.i386 2.5-42 nam |
補安裝軟體包:
配置yum
# cd /etc/yum.repos.d 操作系統密令 #vi server.repo 操作系統密令 [base] name=iso baseurl=file:///mnt gpgcheck=1 enabled=1 gpgkey=file:///mnt/RPM-GPG-KEY-oracle |
安裝RPM包
yum list binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++ make sysstat |
2.2.4JAVA 版本需求:1.4.2
運行oracle安裝需要運行java OUI界面,要求操作系統中安裝有java環境1.4.2以上
[root@his1~]# java -version java version "1.6.0" OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK Client VM (build 1.6.0-b09, mixed mode) |
3 安裝前準備工作
3.1 創建安裝目錄
mkdir -p /oracle/11.2.0/db/dbhome |
chown –R oracle.oinstall /oracle |
3.2 建立用戶
安裝oracle 11g s資料庫軟體需要手工創建oracle用戶,用於管理資料庫
3.2.1建立oracle用戶
#groupadd -g 1000 oinstall #groupadd -g 1200 dba #groupadd -g 1201 oper |
#useradd -m -u 1100 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle |
3.2.2修改密碼(初步設定密碼為123456)
# passwd oracle |
3.2.3檢查nobody用戶
# id nobody uid=60001(nobody) gid=60001(nobody) |
如沒有該用戶則需要建立nobody用戶
# /usr/sbin/useradd nobody
- 安裝目錄授權
chown -R oracle:oinstall /oracle chown -R oracle:oinstall /data chown -R oracle:oinstall /archive |
3.2 參數配置和修改
配置系統內核參數,在兩個節點上都進行修改
參數 |
推薦值 |
查看命令 |
semmsl semmns semopm semmni |
250 32000 100 128 |
/sbin/sysctl -a | grep sem |
shmall |
2097152 |
/sbin/sysctl -a | grep shm
|
shmmax |
536870912 |
|
shmmni |
4096 |
|
file-max |
6815744 |
/sbin/sysctl -a | grep file-max |
ip_local_port_range |
Minimum:9000 Maximum: 65500 |
/sbin/sysctl -a | grep ip_local_port_range |
rmem_default |
262144 |
/sbin/sysctl -a | grep rmem_default |
rmem_max |
4194304 |
/sbin/sysctl -a | grep rmem_max |
wmem_default |
262144 |
/sbin/sysctl -a | grep wmem_default |
wmem_max |
1048576 |
/sbin/sysctl -a | grep wmem_max |
aio-max-nr |
Maximum: 1048576 |
/sbin/sysctl -a | grep aio-max-nr |
vm.min_free_kbytes |
524288 |
/sbin/sysctl -a | grep vm.min_free_kbytes |
vm.swappiness |
100 |
/sbin/sysctl -a | grep vm.swappiness |
將以下修改添加到/etc/sysctl.conf中
kernel.shmmax = 34359738368 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 4194304 vm.min_free_kbytes = 524288 vm.swappiness=100 net.ipv4.conf.eth4.rp_filter = 0 net.ipv4.conf.eth8.rp_filter = 0 |
執行以下使得參數生效
# sysctl -p
禁用ASLR功能
禁用ASLR功能,在/etc/sysctl.conf文件添加以下內容 kernel.randomize_va_space=0 重啟生效 註:# /sbin/sysctl -a | grep randomize kernel.randomize_va_space = 1 If the parameter is set to any value other than 0 then ASLR is in use. |
3.3.1修改Oracle用戶限制
在機器上修改下列文件,增加對應的內容 cat >> /etc/security/limits.conf <<EOF oracle soft nproc 2048 oracle hard nproc 32768 oracle soft nofile 2048 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 EOF |
在oracle用戶下執行以下命令
[root@his1 ~]# su - oracle [oracle@his1 ~]$ ulimit -Sn 2048 [oracle@his1 ~]$ ulimit -Hn 65536 [oracle@his1 ~]$ ulimit -Su 2048 [oracle@his1 ~]$ ulimit -Hu 32768 [oracle@his1 ~]$ ulimit -Ss 10240 [oracle@his1 ~]$ ulimit -Hs 32768 |
編輯以下兩個文件,添加相應的內容
echo 'session include system-auth' >> /etc/pam.d/login echo 'session required pam_limits.so' >> /etc/pam.d/system-auth |
cat >> /etc/profile <<EOF if [ \$USER = "oracle" ]; then if [ \$SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi EOF |
3.3.2禁用HugePages
vi /boot/efi/EFI/redhat/grub.conf
添加transparent_hugepage=never title Oracle Linux Server Unbreakable Enterprise Kernel (3.8.13-44.1.1.el6uek.x86_64) root (hd0,1) kernel /vmlinuz-3.8.13-44.1.1.el6uek.x86_32 ro root=/dev/mapper/vg_jydb1-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_jydb1/lv_root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=256M KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rd_LVM_LV=vg_jydb1/lv_swap rhgb quiet transparent_hugepage=never initrd /initramfs-3.8.13-44.1.1.el6uek.x86_32.img |
重啟用以下命令確認:
# cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never] # grep AnonHugePages /proc/meminfo 結果"AnonHugepages: 0 kB" 參考: ALERT: Disable Transparent HugePages on SLES11, RHEL5, OEL5 and UEK2 Kernels (文檔 ID 1557478.1) |
3.3.3禁用AVAHI daemon
# service avahi-daemon stop # /sbin/chkconfig avahi-daemon off vi /etc/sysconfig/network 添加 NOZEROCONF=yes 參考: CSSD Fails to Join the Cluster After Private Network Recovered if avahi Daemon is up and Running (文檔 ID 1501093.1) |
3.3.4關閉防火牆
# service iptables stop # service ip6tables stop # chkconfig iptables off # chkconfig ip6tables off |
3.3.5關閉SElinux
#vi /etc/selinux/config 修改SELINUX=disabled |
3.3 配置環境變數
配置oracle用戶環境變數
說明:oracle用戶需要配置相關的環境變數 |
$ echo $SHELL /usr/bin/bash Bourne shell (sh), Bash shell (bash), or Korn shell (ksh): $ vi .bash_profile export PS1='[\h:\u:$PWD]$' export ORACLE_BASE=/oracle/11.2.0/db export ORACLE_HOME=$ORACLE_BASE/dbhome export ORACLE_SID=qlhsdb1 # ORACLE_SID=qlhsdb2 export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch export TNS_ADMIN=$ORACLE_HOME/network/admin export ORACLE_TERM=vt100 export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS" export ORA_NLS11=$ORACLE_HOME/nls/data export LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib export CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export TEMP=/tmp export TMP=/tmp export TMPDIR=/tmp stty erase ^H umask 022 |
3.4 配置存儲
說明:文件系統的話建議使用邏輯捲,這裡在安裝系統的時候已經把捲建好了 |
|
3.5 配置網路
說明:標記為紅色的字體要註意 |
[root@his1 ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:96:91:67 inet addr:192.168.40.102 Bcast:192.168.40.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe96:9167/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5164 errors:0 dropped:0 overruns:0 frame:0 TX packets:5513 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:412668 (402.9 KiB) TX bytes:1638598 (1.5 MiB) Interrupt:59 Base address:0x2024
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:983 errors:0 dropped:0 overruns:0 frame:0 TX packets:983 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:49739 (48.5 KiB) TX bytes:49739 (48.5 KiB) |
[root@his1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 # Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] DEVICE=eth0 BOOTPROTO=none ONBOOT=yes HWADDR=00:0c:29:96:91:67 NETMASK=255.255.255.0 IPADDR=192.168.40.34 TYPE=Ethernet |
4 軟體安裝過程
4.1 安裝Oracle DB 11.2.0.4軟體
步驟 |
詳細操作 |
登錄his1 |
#xhost + #su - oracle |
運行RDBMS的runInstaller |
$ cd /oracle/install/db/database ./runInstaller |
界面1:Configure Security Updates |
取消選擇“I wish to receive security updates via My Oracle Support” 。點擊“next”,忽略提示警告。 |
界面2:Download Software Updates |
選擇“Skip software updates”. 點擊“next” |
界面3:Installation Option |
選擇“Install database software only”. 點擊“next” |
界面4:Grid Installation Options |
選擇“Single instance database installtion” 然後點擊“next” |
界面5:Select Product Languages |
從左側選擇“Simplified Chinese”到右側. 點擊“next” |
界面6:Select Database Edition |
選擇“Enterprise Edition”點擊“Select Option”確認以下選件: Oracle Partitioning Oracle OLAP Oracle Data Mining RDBMS Files Oracle Real Application Testing 點擊“Next” |
界面7:Specify Installation Location |
確定Oracle的安裝路徑: Oracle Base: /oracle/11.2.0/db Software Location: /oracle/11.2.0/db/dbhome 點擊“Next” |
界面8:Privileged Operating System Groups |
操作系統用戶組 Database Administration (OSDBA) Group : dba Database Operator (OSOPER) Group: oper 點擊“next”。 |
界面9:Perform Prerequisite Checks |
等待約安裝檢查的完成 |
界面10:Summary |
點擊“Install” |
界面11:Install Product |
等待完成 |
Install (Execute Configuration scripts) |
安裝接近完成時,需要手使用root用戶在每一個節點運行以下腳本: 在兩個節點上上執行 #/oracle/11.2.0/db/dbhome/root.sh
運行root.sh後最後顯示: Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /oracle/11.2.0/db/dbhome Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /var/opt/oracle/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Finished product-specific root actions. |
界面12:Finish |
點擊“Close”退出 |
4.2 建立資料庫
步驟 |
詳細操作 |
啟動dbca |
#su - oracle $dbca |
界面1:Welcome |
選擇Create a Database,點擊next |
界面2: Step 2 of 12: Database Templates |
選擇Custom Database,點擊next |
界面3:Step 3 of 12: Databases Identifier |
Global Database Name:orcl SID Prefix: orcl 點擊next |
界面4: Step 4 of 12: Management Options |
取消選擇"Configure Enterprise Manager" 取消選擇"Automatic Maintenance Tasks" 點擊Next |
界面5:Step 5 of 12: Database Credentials |
選擇Use the same password for all accounts , 輸入口令“oracle”並確認輸入,點擊next |
界面6: Step 6 of 12: Storage Options |
選擇存儲類型:File System 選擇"Use Database File Location from Template" 點擊Next |
界面7: Step 7 of 12: Recovery Configuration |
選擇“Specify Fast Recovery Area” 點擊Next |
界面8: Step 8 of 12: Database Content |
選擇Oracle Text、Oracle OLAP、Oracle Spatial、Enterprise Manager Repository和Oracle Warehourse Builder 點擊Next |
界面9: Step 9 of 12: Initialization Parameters |
在Memory處選擇Typical指定64%即40G作為memory_target大小 Block Size=8192, Processes=5000 在Character Sets TAB處選擇 選擇“Use Unicode (AL32UTF8)” 在Connection Mode TAB處選擇:Dedicated Server Mode 點擊Next |
界面10:Step 10 of 12: Database Storage |
SYSAUX表空間:10240M SYSTEM表空間:5120M TEMP表空間 :10240M UNDOTBS1表空間:10240M UNDOTBS2表空間:10240M USERS表空間:2048M Redo Thread 1: Group1 500M Group2 500M Redo Thread 2: Group3 500M Group4 500M
配置完畢後點擊Next |
界面11:Step 11 of 12 |
點擊Finish。開始創建資料庫。 |
界面12:Finish |
點擊“Exit” |