虚拟机配置
计划安装ASM实例和Oracle数据库实例,均为19c
硬盘80G一个,共享磁盘30G一个,网卡两个,均为nat模式 内存16G,swap16G,虚拟机内核数量2*2
节点1、2的vxm文件添加
需要虚拟机处于关机状态
disk.EnableUUID="TRUE"
disk.locking = "FALSE"
scsi1.shared = "TRUE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize= "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "VIRTUAL"
更改配置文件
ifconfig
两张网卡ens33/ens34,两节点网卡名称需要一致
vi /etc/sysconfig/network-scripts/ifcfg-ens33
service network restart
BOOTPROTO=static,配置静态IP
重要的IP规划,详见文件内容
vi /etc/hosts
原有的我注释掉了,两节点都需要改
关防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
–vi /etc/selinux/config 改成SELINUX=disabled
配置yum源
在root操作,保证虚拟机GUI界面能看到一个小光盘的图标
mkdir /yums
cd /run/media/root/CentOS\ 7\ x86_64/Packages/
cp * /yums
rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm
rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm
rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm
cd /yums
createrepo .
cd /etc/yum.repos.d/
ls
rm -rf *
vi /etc/yum.repos.d/yum.local.repo
[local]
name=yum local repo
baseurl=file:///yums
gpgcheck=0
enable=1
yum clean all
下载各种包
yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc++-33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++-devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*
yum install -y iscsi-initiator-utils
yum install -y udev
yum install -y xclock*
关闭透明大页
cp /etc/default/grub /etc/default/grub.bak
vi /etc/default/grub
----加一行
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never"
改参数文件
vi /etc/sysctl.conf
kernel.shmmax = 277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
#net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
sysctl -p ----------生成参数命令
vi /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 16384
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
grid hard memlock 134217728
grid soft memlock 134217728
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
----root用户
vim /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
fi
-------生效命令
source /etc/profile
创建用户、修改密码
groupadd -g 601 oinstall
groupadd -g 602 dba
groupadd -g 603 oper
groupadd -g 604 backupdba
groupadd -g 605 dgdba
groupadd -g 606 kmdba
groupadd -g 607 asmdba
groupadd -g 608 asmoper
groupadd -g 609 asmadmin
useradd -u 601 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
useradd -u 602 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin,oper,asmdba oracle
passwd grid
passwd oracle
创建目录
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
mkdir -p /u01/app/grid
mkdir -p /u01/app/19c/grid
chown -R grid:oinstall /u01/app/grid
chmod -R 775 /u01/app/grid
chown -R grid:oinstall /u01/app/19c
chmod -R 775 /u01/app/19c/
mkdir -p /u01/app/oracle
mkdir /u01/app/oracle/cfgtoollogs
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle
mkdir -p /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1
chmod -R 775 /u01/app/oracle/product/19c/db_1
配置grid用户参数文件
export ORACLE_SID=+ASM2,记得自己改
su - grid
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19c/grid
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
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
-----生效命令
source ~/.bash_profile
配置Oracle用户参数文件
export ORACLE_HOSTNAME=rac2 export ORACLE_SID=orcl2 这俩得改
su - oracle
vim ~/.bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=rac2
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
export ORACLE_SID=orcl2
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/19c/db_1/bin:$ORACLE_HOME/bin
export THREADS_FLAG=native;export THREADS_FLAG
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
----生效命令
source ~/.bash_profile
上传软件包
把LINUX.X64_193000_grid_home.zip上传到/u01/app/19c/grid ------在一个节点传文件就行!!!!! 把LINUX.X64_193000_db_home.zip上传到/u01/app/oracle/product/19c/db_1------在一个节点传文件就行!!!!!
su - root
--------ASM
cd /u01/app/19c/grid
chown -R grid:oinstall LINUX.X64_193000_grid_home.zip
chmod 775 LINUX.X64_193000_grid_home.zip
----------ORACLE
cd /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall LINUX.X64_193000_db_home.zip
chmod 775 LINUX.X64_193000_db_home.zip
udev挂共享盘
查看disk-id
ll /dev/disk/by-id/
lrwxrwxrwx. 1 root root 9 Oct 10 14:38 scsi-36000c2907639ca4eb41afaf12ee61542 -> ../../sdb
在一个节点分区就行!!!!!!
fdisk /dev/sdb-----分区命令依次输入n,p,1,两个enter,p,w
修改规则,30是主机的IP后三位,具体命令根据Linux版本不同有差异!! 此条适用于Linux-centos7
vim /etc/udev/rules.d/30-oracle-asmdevices.rules
----这三个地方要改!!!!
----KERNEL=="sdb1",
------RESULT=="36000c2907639ca4eb41afaf12ee61542"---disk-id
-------SYMLINK+="asm-diskb1"
KERNEL=="sdb1", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$parent", RESULT=="36000c2907639ca4eb41afaf12ee61542", SYMLINK+="asm-diskb1", OWNER="grid", GROUP="asmadmin", MODE="0660"
-----配置udev生效
/sbin/udevadm trigger --type=devices --action=change
查看挂载生效
ll /dev/asm-disk*
lrwxrwxrwx. 1 root:root 4 Oct 10 15:18 /dev/asm-diskb -> sdb1
此上的所有命令,无特殊备注,所有节点都要敲
安装ASM
su - grid
cd /u01/app/19c/grid
unzip LINUX.X64_193000_grid_home.zip--------在一个节点解压就可以!!!!!!
export DISPLAY=192.168.142.1:0.0------主机ip:0.0
./gridSetup.sh
此处用12c的截图,但是步骤都一样,路径里的12.0.0换成19c即可
scan-name 和/etc/hosts里scan-ip保持一致 名称自己写,磁盘路径就是共享盘的路径
下图所示的错误可以忽略,勾选ignore all 其他错误点击fix & check again,跑提示的脚本可以自动修复 再有其他错误,自己百度
然后一路下一步安装,因为忽略错误会有一些警告,但是可以继续 安装会提示用root用户跑两个脚本,首先在第一个节点跑完两个,成功后再在第二个节点跑两个脚本,截图如下
会提示部分失败,没有关系,因为跳过错误导致的,实际安装成功
安装oracle数据库实例
su - oracle
cd /u01/app/oracle/product/19c/db_1
unzip LINUX.X64_193000_db_home.zip--------在一个节点解压就可以!!!!!!
export DISPLAY=192.168.142.1:0.0
./runInstaller
截图如下
点一下fix&check,同ASM grid安装,下图这些报错可以忽略,有需要安装的rpm依赖包就自己装上 一直下一步直至完成,可能会有点慢
安装可以在数据库上下翻命令的软件包
rlwrap-0.37-1.el6.x86_64.rpm 务必在ROOT用户下安装,双节点都要
su - oracle
vi /home/oracle/.bash_profile
---将下面三行文字粘贴进该文件中即可
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
-----添加完内容后保存退出 并执行以下命令来生成环境变量
. /home/oracle/.bash_profile
su - grid
vi /home/grid/.bash_profile
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias asmcmd='rlwrap asmcmd'
----添加完内容后保存退出 并执行以下命令来生成环境变量
. /home/grid/.bash_profile
dbca创建数据库
一些管理如arcive,CDB等可以选择性安装,选的越复杂,安装的越慢
su - oracle
export DISPLAY=192.168.142.1:0.0
dbca
一直下一步直至安装完成
验证集群安装成功,监听正常
su - grid
crsctl stat res -t
lsnrctl status
oracle EMCC管理配置
su - oracle
sqlplus / as sysdba
select dbms_xdb_config.gethttpsport() from dual;
select dbms_xdb_config.gethttpport() from dual;
//设置https端口的端口号
exec dbms_xdb_config.setHTTPSPort(8089);
//设置http端口的端口号
exec dbms_xdb_config.setHTTPPort(8090);
改权限
lsnrctl
cd /u01/app/oracle/product/19c/db_1/admin/orclone/xdb_wallet
chmod 777 *wall*
ll
-rwxrwxrwx 1 oracle asmadmin 3880 Oct 10 20:24 cwallet.sso
-rwxrwxrwx 1 oracle asmadmin 3835 Oct 10 20:24 ewallet.p12
ie浏览器打开网站,即可登录 https://192.168.142.30:8089/em/
|