天天看點

Oracle 11g on ECS 測試實踐--安裝篇

一、環境介紹

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*           

基礎安裝結束