一、环境介绍
1.ECS使用1核2G,系统、数据盘各20G这样的配置。
2.OS使用CentOS7.6
3.Oracle 使用 11.2.0.4
4.存储规划:/u01在系统盘,/oradata(存放数据)和/orabackup(存放备份)分别占用10G空间,存储设备使用上面单独的数据盘
二、安装
1.配置环境
这里我蹭一下Oracle的包,十分便利,参考文档
cd /etc/yum.repos.d/
wget http://public-yum.oracle.com/public-yum-ol7.repo
yum install oracle-rdbms-server-11gR2-preinstall --nogpgcheck
##完成后配置oracle用户的的环境变量
[root@orcl1 ~]# cat /home/oracle/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
# Oracle configure profile parameters success
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=chsh
export ORACLE_TERM=vt100
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
#
# change this NLS settings to suit your country:
# example:
# german_germany.we8iso8859p15, american_america.we8iso8859p2 etc.
#
export LANG=en_US
2.使用静默的方式安装
[root@orcl1 database]# cp ./response/db_install.rsp ./db_install.rsp
##此处我们对 db_install.rsp文件内容进行修改:
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=orcl1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.DBA_GROUP=dba
DECLINE_SECURITY_UPDATES=true
##静默安装
./runInstaller -silent -responseFile /opt/oracle/install/database/db_install.rsp
##安装及执行root脚本 略
3.善后-DB相关目录
##看下阿里分配的磁盘叫啥
[root@orcl1 database]# fdisk -l
Disk /dev/vda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b0ebb
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 41943039 20970496 83 Linux
Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
##将/dev/vdb划分成两个分区,划分过程略
[root@orcl1 database]# ls /dev/vdb*
/dev/vdb /dev/vdb1 /dev/vdb2
##将磁盘设置为自动挂载
[root@orcl1 database]# blkid /dev/vdb1 >> /etc/fstab
[root@orcl1 database]# blkid /dev/vdb2 >> /etc/fstab
##/etc/fstab 修改成如下(UUID保平安)
UUID=1cff7e09-01a3-4ae3-a4f1-81590d664a99 /oradata ext4 defaults 0 0
UUID=4a242a04-ed42-4f61-9f95-781ee264b3f5 /orabackup ext4 defaults 0 0
##创建文件夹并修改属组
[root@orcl1 database]# mkdir /oradata
[root@orcl1 database]# mkdir /orabackup
[root@orcl1 database]# chown -R oracle.oinstall /ora*
[root@orcl1 database]# mount -a
[root@orcl1 database]# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=930656k,nr_inodes=232664,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/vda1 on / type ext4 (rw,relatime,data=ordered)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=188224k,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=26,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=48832)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
/dev/vdb1 on /oradata type ext4 (rw,relatime,data=ordered)
/dev/vdb2 on /orabackup type ext4 (rw,relatime,data=ordered)
[root@orcl1 database]# chown -R oracle.oinstall /ora*
基础安装结束