一、前期规划
1、硬件环境
CPU: Intel(R) Xeon(R) CPU E7-4820 v4 @ 2.00GHz 8*10核
内存:512GB
OCR:2147*5 MB
DATA1:2TB
ARCH1:1TB
2、软件环境
操作系统:RedHat Linux 6.x 64位
数 据 库:Oracle 11.2.0.4 r2 RAC
3、业务系统
检查系统
4、主机规划
主机名 |
|
IP |
用户名 |
密码 |
||
Public |
Private |
Vip& Scanip |
Scanip |
|||
rac1 |
172.16.10.201 |
192.168.10.201 |
172.16.10.202 |
172.16.10.205 |
grid oracle |
oracle oracle |
rac2 |
172.16.10.203 |
192.168.10.203 |
172.16.10.204 |
二、安装数据库前准备
1、清除 DNS 中内容
vi /etc/resolv.conf --消除其内容
2、改hosts
rac1
vi /etc/hosts --加入public、private、vip、scanip内容
# rac1
172.16.10.201 rac1
172.16.10.202 rac1-vip
192.168.10.201 rac1-priv
# rac2
172.16.10.203 rac2
172.16.10.204 rac2-vip
192.168.10.203 rac2-priv
# scan-ip
172.16.10.205 scan-vip
rac2:
vi /etc/hosts --加入public、private、vip、scanip内容
# rac1
172.16.10.201 rac1
172.16.10.202 rac1-vip
192.168.10.201 rac1-priv
# rac2
172.16.10.203 rac2
172.16.10.204 rac2-vip
192.168.10.203 rac2-priv
# scan-ip
172.16.10.205 scan-vip
4、关闭iptables
service iptables stop
chkconfig iptables off
5、关闭selinux
Setenforce 0
vi /etc/sysconfig/selinux
将SELINUX值改为disabled
6、关NTP
mv /etc/ntp.conf /etc/ntp.conf.bak
三、集群参数配置
1、设置内核参数
/etc/sysctl.conf 文件中增加以下参数:
fs.aio-max-nr = 1048576
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
2、设置limits参数
/etc/security/limits.conf 文件中添加如下参数:
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
/etc/pam.d/login 文件中添加如下参数:
session required pam_limits.so
/etc/profile 文件中添加如下参数:
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
3、创建用户、组
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/groupadd -g 507 asmoper
/usr/sbin/useradd -u 501 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
4、配置互信(grid / oracle用户)
1、(比较老的办法)#####grid 和 oracle用户操作的用户都是这样
##节点1,节点2都执行如下:
cd
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
##配置互相ssh
#节点1执行如下:
cd
cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
###节点1二执行如下:
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
节点2 执行
ssh rac2 date
ssh rac1 date
ssh rac2-priv date
ssh rac1-priv date
2、利用解压的软件包(sshUserSetup.sh)
ROOT:
设置GRID SSH:
./sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced -noPromptPassphrase
设置ORACLE SSH:
./sshUserSetup.sh -user oracle -hosts "rac1 rac2" -advanced -noPromptPassphrase
5、上传安装软件并用相应帐户解压
将软件上传到一节点/soft目录,并用unzip命令解压。
6、创建Oracle所需目录
mkdir -p /u01/app/grid/
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle/
chmod -R 775 /u01
7、设置grid和oracle帐户环境变量
Grid用户:/home/grid/.bash_profile 文件中添加如下内容:
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM1
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
Oracle 用户:/home/oracle/.bash_profile 文件中添加如下参数:
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl1
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
8、检查软件包
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' make \
binutils \
gcc \
libaio \
glibc \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
glibc-common \
glibc-devel \
glibc-headers \
gcc-c++ \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
sysstat \
ksh \
expat \
sysstat \
unixODBC \
unixODBC-devel
利用yum安装所需的源码包:
mount /dev/cdrom /mnt
rm -f /etc/yum.repos.d/*
vi /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux \$releasever - \$basearch - Debug
baseurl=file:///mnt/
enabled=1
gpgcheck=0
yum clean all
yum -y install compat-libcap1-1.10-1 binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel glibc-common glibc-headers ksh libaio libaio-devel libgcc libstdc++ make sysstat unixODBC unixODBC-devel
9、准备仲裁磁盘和数据磁盘
等存储工程师分配好lun后,在服务器上做如下操作:
1、 将磁盘/dev/sd*做好分区(我的是用的测试机/dev/sd*,真实环境大多数用的EMC存储/dev/emcpower*)
2、 在/etc/udev/rules.d/ 99-oracle-asmdevices.rules文件中添加如下参数:
KERNEL=="sdb1", NAME="asmdisk_ocr1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc1", NAME="asmdisk_ocr2", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdd1", NAME="asmdisk_ocr3", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sde1", NAME="asmdisk_data1", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdf1", NAME="asmdisk_arch1", OWNER="grid", GROUP="asmadmin", MODE="0660"
3、添加完成后,重启所有节点
10 禁用Linux透明大页
Oracle 安装时官方建议关闭Linux的透明大页,防止内存延迟分配导致的性能问题
https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1519
MOS:ID 1557478.1
Because Transparent HugePages are known to cause unexpected node reboots and performance problems with RAC, Oracle strongly advises to disable the use of Transparent HugePages. In addition, Transparent Hugepages may cause problems even in a single-instance database environment with unexpected performance problems or delays. As such, Oracle recommends disabling Transparent HugePages on all Database servers running Oracle.
1.查看透明大页是否启用
RHEL 6:
# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[oracle@rhel 6 ~]$ cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[always] madvise never
RHEL 7:
# cat /sys/kernel/mm/transparent_hugepage/enabled
[root@rhel 7 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
2.禁用透明大页
RHEL 6:
(1).编辑/etc/grub.conf 文件,在kernel 那一行后面追加
transparent_hugepage=never
例如:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-642.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-642.el6.x86_64 ro root=/dev/mapper/rootvg-lvroot rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_LVM_LV=rootvg/lvswap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=rootvg/lvroot rd_NO_DM rhgb quiet transparent_hugepage=never
initrd /initramfs-2.6.32-642.el6.x86_64.img
(2).重启系统生效。
RHEL 7:
(1).编辑/etc/sysconfig/grub 文件,在 GRUB_CMDLINE_LINUX 那一行后面追加 transparent_hugepage=never
例如:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
(2).再使用 grub2-mkconfig 生成grub.cfg配置文件。
# grub2-mkconfig -o /boot/grub2/grub.cfg
(3).重启系统使配置生效。
四、安装Grid Infrastucture
1. 预检查
手动检测环境配置是否准备完毕,在grid安装目录中运行脚本,检测环境是否符合grid的安装标准
[grid@rac1 ~]$ cd /u01/soft/grid/
[grid@rac1 grid]$ ls -lh
total 68K
drwxr-xr-x 4 grid oinstall 4.0K Aug 26 2013 install
-rw-r--r-- 1 grid oinstall 30K Aug 27 2013 readme.html
drwxr-xr-x 2 grid oinstall 4.0K Aug 26 2013 response
drwxr-xr-x 2 grid oinstall 4.0K Aug 26 2013 rpm
-rwxr-xr-x 1 grid oinstall 4.8K Aug 26 2013 runcluvfy.sh
-rwxr-xr-x 1 grid oinstall 3.2K Aug 26 2013 runInstaller
drwxr-xr-x 2 grid oinstall 4.0K Aug 26 2013 sshsetup
drwxr-xr-x 14 grid oinstall 4.0K Aug 26 2013 stage
-rw-r--r-- 1 grid oinstall 500 Aug 27 2013 welcome.html
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -verbose >/home/grid/grid_check.log
查看/home/grid/grid_check.log
利用/etc/hosts 域名解析,/etc/resolv.conf 报错可以忽略
2. 准备GI安装的响应文件
响应文件模板:
可以参照解压后的 /u01/soft/grid/response/grid_install.rsp 响应文件。
只用了三块ocr 磁盘,NORMAL冗余方式,磁盘组名称为OCRDG,监听端口为1521,cluster 名称为cluster,scan名称为scan-vip,sysasm 密码为Oracle123
按照实际情况修改内容。
密码设置:(可以设置的复杂一点,否则后续安装的时候会有警告信息)
成功案例的配置文件:
[grid@rac1 response]$ vi /u01/soft/grid/grid_install.rsp
注意英文符号,以及自己安装实际情况,为空的不用填。
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0
ORACLE_HOSTNAME=rac1
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
oracle.install.option=CRS_CONFIG
ORACLE_BASE=/u01/app/grid
ORACLE_HOME=/u01/app/11.2.0/grid
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName=scan-vip
oracle.install.crs.config.gpnp.scanPort=1521
oracle.install.crs.config.clusterName=cluster
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.gpnp.gnsSubDomain=
oracle.install.crs.config.gpnp.gnsVIPAddress=
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.clusterNodes=rac1:rac1-vip,rac2:rac2-vip
oracle.install.crs.config.networkInterfaceList=eth0:172.16.10.0:1,eth1:192.168.10.0:2
oracle.install.crs.config.storageOption=ASM_STORAGE
oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=NORMAL
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=NORMAL
oracle.install.crs.config.useIPMI=false
oracle.install.crs.config.ipmi.bmcUsername=
oracle.install.crs.config.ipmi.bmcPassword=
oracle.install.asm.SYSASMPassword=Oracle123
oracle.install.asm.diskGroup.name=OCRDG
oracle.install.asm.diskGroup.redundancy=NORMAL
oracle.install.asm.diskGroup.AUSize=1
oracle.install.asm.diskGroup.disks=/dev/asmdisk_ocr1,/dev/asmdisk_ocr2,/dev/asmdisk_ocr3
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/*
oracle.install.asm.monitorPassword=Oracle123
oracle.install.crs.upgrade.clusterNodes=
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
PROXY_HOST=
PROXY_PORT=0
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
3. 通过响应文件安装GI
请使用grid用户在节点1(rac1)上执行以下命令
Chmod 775 /u01/soft/grid/grid_install.rsp
./runInstaller -ignorePrereq -silent -force -responseFile /u01/soft/grid/grid_install.rsp -showProgress
操作记录如下:
[grid@rac1 grid]$ ./runInstaller -ignorePrereq -silent -force -responseFile /u01/soft/grid/grid_install.rsp -showProgress
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 1061 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-02-27_07-59-53AM. Please wait ...[grid@rac1 grid]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2018-02-27_07-59-53AM.log
Prepare in progress.
.................................................. 9% Done.
Prepare successful.
Copy files in progress.
.................................................. 15% Done.
.................................................. 20% Done.
.................................................. 25% Done.
.................................................. 30% Done.
.................................................. 35% Done.
.................................................. 40% Done.
.................................................. 45% Done.
........................................
Copy files successful.
Link binaries in progress.
Link binaries successful.
.................................................. 62% Done.
Setup files in progress.
Setup files successful.
.................................................. 76% Done.
Perform remote operations in progress.
Perform remote operations in progress.
.................................................. 89% Done.
Perform remote operations successful.
The installation of Oracle Grid Infrastructure 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2018-02-27_07-59-53AM.log' for more details.
.................................................. 94% Done.
Execute Root Scripts in progress.
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/11.2.0/grid/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[rac1, rac2]
Execute /u01/app/11.2.0/grid/root.sh on the following nodes:
[rac1, rac2]
.................................................. 100% Done.
Execute Root Scripts successful.
As install user, execute the following script to complete the configuration.
1. /u01/app/11.2.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=
Note:
1. This script must be run on the same host from where installer was run.
2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation).
Successfully Setup Software.
弹出需要执行的脚本:
分别在节点上运行以下脚本:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/11.2.0/grid/root.sh
第一个脚本:
节点1:
节点2:
第二个脚本:
节点1:
节点2日志:
最后执行这个脚本,完成配置:
[grid@rac1 grid]$
/u01/app/11.2.0/grid/cfgtoollogs/configToolAllCommands RESPONSE_FILE=/u01/soft/grid/grid_install.rsp
Setting the invPtrLoc to /u01/app/11.2.0/grid/oraInst.loc
perform - mode is starting for action: configure
perform - mode finished for action: configure
You can see the log file: /u01/app/11.2.0/grid/cfgtoollogs/oui/configActions2018-02-27_08-27-54-AM.log
验证,查看CRS信息:
[grid@rac1 cfgtoollogs]$ crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCRDG.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.registry.acfs
ONLINE ONLINE rac1
ONLINE ONLINE rac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac1
ora.cvu
1 ONLINE ONLINE rac1
ora.oc4j
1 ONLINE ONLINE rac1
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac1
[grid@rac1 cfgtoollogs]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.OCRDG.dg ora....up.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
查看每个节点ASM 实例:
五、安装数据库软件
同理利用database响应文件 db_install.rsp
1. 准备GI安装的响应文件
vi /u01/soft/database/db_install.rsp
需要按照实际情况修改。空的不用填。
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=rac1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.CLUSTER_NODES=rac1,rac2
oracle.install.db.isRACOneInstall=false
oracle.install.db.racOneServiceName=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl1
oracle.install.db.config.starterdb.characterSet=AL32UTF8 --oracle软件字符集设置,数据库字符集后面有设置
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=false
oracle.install.db.config.starterdb.password.ALL=Oracle123
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=Oracle123
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
2. 通过响应文件安装oracle软件
chmod 775 /home/oracle/db.rsp
./runInstaller -ignorePrereq -silent -force -responseFile /home/oracle/db.rsp -showProgress
记录如下:
[oracle@rac1 database]$ ./runInstaller -ignorePrereq -silent -force -responseFile /u01/soft/database/db_install.rsp -showProgress
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 1008 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1998 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-02-27_09-05-25AM. Please wait ...[oracle@rac1 database]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2018-02-27_09-05-25AM.log
Prepare in progress.
.................................................. 9% Done.
Prepare successful.
Copy files in progress.
.................................................. 14% Done.
.................................................. 19% Done.
.................................................. 25% Done.
.................................................. 30% Done.
.................................................. 36% Done.
.................................................. 41% Done.
.................................................. 46% Done.
.................................................. 51% Done.
.................................................. 56% Done.
Copy files successful.
..........
Link binaries in progress.
Link binaries successful.
.................................................. 77% Done.
Setup files in progress.
.................................................. 94% Done.
Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2018-02-27_09-05-25AM.log' for more details.
Execute Root Scripts in progress.
As a root user, execute the following script(s):
1. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Execute /u01/app/oracle/product/11.2.0/dbhome_1/root.sh on the following nodes:
[rac1, rac2]
.................................................. 100% Done.
Execute Root Scripts successful.
Successfully Setup Software.
我这个只需要执行一个脚本:
节点1:
节点2:
六、手工创建磁盘组
GI,ORACLE软件安装后,需要创建磁盘组安装DB
查看:
手工创建磁盘组:
CREATE DISKGROUP DATADG external REDUNDANCY disk ' /dev/asmdisk_data1' ATTRIBUTE 'au_size'='1M', 'compatible.asm' = '11.2';
CREATE DISKGROUP ARCHDG external REDUNDANCY disk '/dev/asmdisk_arch1' ATTRIBUTE 'au_size'='1M','compatible.asm' = '11.2';
并且保证所有节点都是mout状态
查看:
节点2 离线,需要手动在节点2 mount 磁盘组
alter diskgroup datadg mount;
alter diskgroup archdg mount;
再次查看crs:
七、创建数据库
1. 准备database安装的响应文件
同理利用/u01/soft/database/response/dbca.rsp 文件。
以下是成案例:
数据库唯一名为orcl,redo log 每个实例2组(默认的为50m),需要手工进行修改,字符集是16gbk,后续需要进行手动的参数修改(例如归档模式以及路径,闪回区大小以及路径(先修改大小再改路径),redo log,系统参数修改等),会自动生成tnsnames.ora文件。
vi /u01/soft/database/rac_dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
DB_UNIQUE_NAME = "orcl"
SID = "orcl" 会自动生成orcl1,orcl2 两个实例
NODELIST=rac1,rac2
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "Oracle123"
SYSTEMPASSWORD = "Oracle123"
DATAFILEDESTINATION = "+datadg"
RECOVERYAREADESTINATION= "+datadg"
STORAGETYPE=ASM
DISKGROUPNAME=DATADG
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "UTF8"
DB_BLOCK_SIZE=8192
TOTALMEMORY = "900" 这个是分配给ORACLE的sga 900m
2. 通过响应文件安装DB
chmod 775 /u01/soft/database/rac_dbca.rsp
$ORACLE_HOME/bin/dbca -silent -responseFile /u01/soft/database/rac_dbca.rsp
如下图:
[oracle@rac1 database]$
[oracle@rac1 database]$ $ORACLE_HOME/bin/dbca -silent -responseFile /u01/soft/database/rac_dbca.rsp
Copying database files
1% complete
3% complete
9% complete
15% complete
21% complete
27% complete
30% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
44% complete
45% complete
48% complete
50% complete
Creating cluster database views
52% complete
70% complete
Completing Database Creation
73% complete
76% complete
85% complete
94% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl0.log" for further details.
后续参数调整,请自行修改……