6年没碰Oracle了,今天有个项目需要远程安装一套DataGuard的备库,记录安装过程。
安装步骤
- Step 1 Add Required RPMs.
- Step 2 Configure the Kernel.
- Step 3 Create directories, Add groups.
- Step 4 Create Grid & Oracle Users and give permissions.
- Step 5 Make the primary partition for added disk to use for ASM.
- Step 6 Install RPM for ASM, Configure ASM, Create ASM disks.
- Step 7 Copy grid binary on server , Unzip & Create responce file for grid. (With Grid user).
- Step 8 install grid in silent mode
- Step 9 Copy oraclebinary on server , Unzip & Create responce file for oracle. (With Oracle user)
- Step 10 install oracle in silent mode
- Step 11 Create Listener in silent mode
- Step 12 Create database
- Step 13 打补丁(grid和oracle用户)
Step 1 – Add Required RPMs.
Oracle 11.2.0.4.0 requires extra RPMs from the install media.
The following command should load all needed RPMs for 11.2.0.4.0 Grid and Database.
rpm -Uvh binutils-2*x86_64*
rpm -Uvh glibc-2*x86_64*
rpm -Uvh glibc-2*i686*
rpm -Uvh nss-softokn-freebl-3*x86_64*
rpm -Uvh nss-softokn-freebl-3*i686*
rpm -Uvh elfutils-libelf-0*x86_64*
rpm -Uvh elfutils-libelf-devel-0*x86_64*
rpm -Uvh gcc-4*x86_64*
rpm -Uvh gcc-c++-4*x86_64*
rpm -Uvh ksh-*x86_64*
rpm -Uvh numactl-devel-2*x86_64*
rpm -Uvh sysstat-9*x86_64*
rpm -Uvh compat-libcap*
rpm -Uvh binutils-2.*
rpm -Uvh compat-libstdc++-33*
rpm -Uvh elfutils-libelf-0.*
rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
rpm -Uvh sysstat-9.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh-2*
rpm -Uvh make-3.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-4.*.i686*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh libcap-2.16-5.2.el6.i686.rpm
rpm -Uvh libattr-2.4.44-4.el6.i686.rpm
rpm -Uvh libtool-ltdl*i686*
rpm -Uvh ncurses*i686*
rpm -Uvh readline*i686*
rpm -Uvh unixODBC*
Step 2 – Configure the Kernel.
The following steps modify key settings to allow Oracle to execute. We will also disable the NTP time synchronization configuration file which will confuse the Oracle installer.
(i) If you are not using DNS, the “/etc/hosts” file must contain the following information.
192.168.36.10 cqdbsvr-c1
(ii) Add or amend the following lines to the “/etc/sysctl.conf” file.
fs.aio-max-nr = 4194304
fs.file-max = 6815744
kernel.shmmax = 128849018880
kernel.shmmni = 4096
kernel.shmall = 31457280
kernel.sem = 250 32000 100 128
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 = 1048586
net.ipv4.conf.eth1.rp_filter = 2
net.ipv4.conf.eth0.rp_filter = 2
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_recycle = 0
net.core.somaxconn = 8192
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 30
vm.min_free_kbytes = 2097152
vm.nr_hugepages = 20500
(iii) Run the following command to change the current kernel parameters.
/sbin/sysctl -p
(iv) Add the following lines to the “/etc/security/limits.conf” file.
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 10240
grid hard nproc 16384
grid soft nofile 10240
grid hard nofile 65536
grid soft stack 10240
(v) Add the following lines to the “/etc/pam.d/login” file, if it does not already exist.
session required pam_limits.so
(vi) Make the following changes to the default shell startupfile, add the following lines to the “/etc/profile” file:
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
(vii) Amend the “/etc/security/limits.d/90-nproc.conf” file as described below. See MOS Remark [ID 1487773.1]
# Change this
* soft nproc 1024
# To this
* - nproc 16384
(viii) Change the setting of SELinux to permissive by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows.
SELINUX=disabled
(ix) If you have the Linux firewall enabled, you will need to disable or configure it, as shown here or here. The following is an example of disabling the firewall.
# service iptables stop
# chkconfig iptables off
(x) Disable the NTP configuration file
# service ntpd stop
Shutting down ntpd: [ OK ]
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.orig
# rm /var/run/ntpd.pid
Step 3 - Create directories, Add groups
- For oracle user
mkdir -p /oracle/app/oracle/product/11.2.0/db_home
mkdir -p /oracle/app/oracle/oraInventory
- For grid user
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/grid/product/11.2.0/grid_home
mkdir -p /oracle/app/oraInventory
Step 4 - Create Grid & Oracle Users and give permissions.
groupadd -g 200 oinstall
groupadd -g 201 dba
groupadd -g 202 oper
groupadd -g 203 asmdba
groupadd -g 204 asmoper
groupadd -g 205 asmadmin
useradd -u 201 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid grid
useradd -u 200 -g oinstall -G dba,oper,asmdba -d /home/oracle oracle
[root@DBA01 Packages]# passwd oracle
[root@DBA01 Packages]# passwd grid
chown -R oracle:oinstall /oracle/
chown -R oracle:oinstall /oracle/app/oracle/oraInventory
chown -R grid:oinstall /oracle/app/grid/
chown -R grid:oinstall /oracle/app/oraInventory/
chown -R grid:oinstall /oracle/app/grid/product/11.2.0/grid_home
chown -R oracle:oinstall /oracle/app/oracle
chmod -R 775 /oracle
- Setting for .bash_profile for grid and oracle user
修改SID
.bash_profile for Grid:
[root@host11g1 ~]# vi /home/grid/.bash_profile
ORACLE_BASE=/oracle/app/grid; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/grid_home; export ORACLE_HOME
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
.bash_profile for oracle:
[root@host11g1 ~]# vi /home/oracle/.bash_profile
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_home; export ORACLE_HOME
ORACLE_SID=cqnevastandby; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
Step 5 - Make the primary partition for added disk to use for ASM
(i) List of partition disk in my machine.
[root@cqdbsvr-c1 xx]# fdisk -l
Disk /dev/sda: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a7325
Device Boot Start End Blocks Id System
/dev/sda1 * 1 39 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 39 109298 877621248 8e Linux LVM
Disk /dev/mapper/vg_cqdbsvrc1-LogVol03_swap: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 8354 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_cqdbsvrc1-LogVol00_root: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_cqdbsvrc1-LogVol01_home: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_cqdbsvrc1-LogVol02_oracle: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdd: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sde: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdf: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdg: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdh: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdi: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdj: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdk: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdl: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdm: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdo: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdn: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdp: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/sdq: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Disk /dev/mapper/mpathb: 2199.0 GB, 2199023255552 bytes
255 heads, 63 sectors/track, 267349 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 32768 bytes / 32768 bytes
Disk identifier: 0x14f9054c
Device Boot Start End Blocks Id System
Step 6 - Install RPM for ASM, Configure ASM, Create ASM disks
- create a udev rules file for raw devices
[root@cqdbsvr-1 ~]# less /etc/udev/rules.d/99-oracleasm.rules
ENV{DM_NAME}=="mpath[b]", OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@cqdbsvr-c1 ~]# start_udev
正在启动 udev: [确定]
Step 7 - Copy grid binary on server , Unzip & Create response file for grid. (With Grid user)
grid_install.rsp:
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0
ORACLE_HOSTNAME=cqdbsvr-c1
INVENTORY_LOCATION=/oracle/app/oraInventory
SELECTED_LANGUAGES=en
oracle.install.option=HA_CONFIG
ORACLE_BASE=/oracle/app/grid
ORACLE_HOME=/oracle/app/grid/product/11.2.0/grid_home
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName=
oracle.install.crs.config.gpnp.scanPort=
oracle.install.crs.config.clusterName=
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.gpnp.gnsSubDomain=
oracle.install.crs.config.gpnp.gnsVIPAddress=
oracle.install.crs.config.autoConfigureClusterNodeVIP=
oracle.install.crs.config.clusterNodes=
oracle.install.crs.config.storageOption=
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=NORMA