Oracle 19c Standalone Server安装
Oracle 19c Standalone Server安装
1 检查
1.1.服务器的硬件
1.2 操作系统检查
1.3 服务器的配置
1.4 用户环境配置的检查
1.5 存储检查
2 准备
2.1 环境说明
操作系统: Red Hat Enterprise Linux Server release 7.5 (Maipo)
DB: 19c
IP: 192.168.9.20
2.2 下载软件
方式一:官网下载
方式二:Oracle产品下载(需登录oracle账户才能搜索下载)
方式三:百度云盘下载 提取码:1pv3
2.3 安装操作系统依懒包
所需依赖包官网查看:点我查看
先配置yum源
vi /etc/yum.repos.d/base.repo
添加以下内容:
[bash]
name=bash
baseurl=file:///mnt
enabled=1
gpgcheck=0
mount /dev/sr0 /mnt yum repolist all
安装所需软件包
yum -y install libst* gcc* libaio* glibc* compat* libx* libX* make* sysstat* ksh net-tools
上传软件包
mkdir /soft
安装compat-libstdc++
cd /soft rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm rpm -ivh cvuqdisk-1.0.10-1.rpm
检查所需软件包是否安装
rpm -qa binutils bc binutils compat-libcap1 compat-libstdc++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make
2.4 检查内核版本及参数配置
2.4.1 内核版本检查
cat /etc/redhat-release cat /etc/os-release uname -r
2.4.2 内核参数配置
vi /etc/sysctl.conf
添加以下内容:
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
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 = 1048576
执行下面命令使配置生效:
sysctl -p
vi /etc/security/limits.conf
添加以下内容:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
2.5 禁止Transparent Huge Pages
echo never > /sys/kernel/mm/transparent_hugepage/enabled cat /sys/kernel/mm/transparent_hugepage/enabled # 输出结果为[always]表示透明巨页启用、[never]表示透明巨页禁用 grep -i HugePages_Total /proc/meminfo # HugePages_Total返回0,意味着透明巨页禁用 cat /proc/sys/vm/nr_hugepages # 返回0也意味着透明巨页禁用
2.6 关闭防火墙及selinux
systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
2.7 设置主机别名解析
vi /etc/hosts
添加:
192.168.9.20 dba
2.8 配置用户及组、目录
groupadd -g 54321 oinstall groupadd -g 54322 dba groupadd -g 54323 oper groupadd -g 54324 backupdba groupadd -g 54325 dgdba groupadd -g 54326 kmdba groupadd -g 54330 racdba groupadd -g 54331 asmdba groupadd -g 54332 asmadmin groupadd -g 54333 asmoper useradd -u 54334 -g oinstall -G dba,asmdba,oper,backupdba,dgdba,kmdba,racdba oracle useradd -u 54335 -g oinstall -G dba,asmdba,racdba,asmadmin,asmoper grid echo "oracle" | passwd --stdin oracle echo "grid" | passwd --stdin grid
2.9 创建目录并授权
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1 mkdir -p /u01/app/oraInventory mkdir -p /u01/app/oracle/cfgtoollogs mkdir -p /u01/app/oracle/product/19.3.0/grid mkdir -p /u01/app/grid chmod -R 755 /u01 chown -R oracle:oinstall /u01/ chown -R grid:oinstall /u01/app/grid chown -R grid:oinstall /u01/app/oraInventory chown -R grid:oinstall /u01/app/oracle/product/19.3.0/grid
2.10 配置环境变量
以Oracle用户登陆设置环境变量
vi .bash_profile
添加以下内容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
source ~/.bash_profile
以Grid用户登陆设置环境变量
vi .bash_profile
添加以下内容:
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/grid
export ORACLE_SID=+ASM
export PATH=$ORACLE_HOME/bin:$PATH
source ~/.bash_profile
2.11 解压安装包
chown -R oracle:oinstall /soft/LINUX.X64_193000_db_home.zip chown -R grid:oinstall /soft/LINUX.X64_193000_grid_home.zip
解压数据库软件到指定文件夹
su - grid cd $ORACLE_HOME unzip -q /soft/LINUX.X64_193000_grid_home.zip su - oracle unzip /soft/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME/
2.12 配置ASM存储
2.12.1 虚拟机添加两块硬盘
关机之后添加硬盘,添加完成之后开机
2.12.2 查看添加的硬盘
fdisk -l
2.12.3 查看设置id号
/usr/lib/udev/scsi_id -g -u /dev/sdb
/usr/lib/udev/scsi_id -g -u /dev/sdc
/dev/sdb:35000c292b7992cab
/dev/sdc:35000c29f57edc769
2.12.4 配置UDEV配置文件
cd /etc/udev/rules.d/ vi 99-my-asmdevices.rules
添加以下内容:
KERNEL=="sd*[!0-9]",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="35000c292b7992cab",RUN+="/bin/sh -c 'mknod /dev/asmdisk01 b $major $minor;chown grid:oinstall /dev/asmdisk01;chmod 0660 /dev/asmdisk01'" KERNEL=="sd*[!0-9]",ENV{DEVTYPE}=="disk",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode",RESULT=="35000c29f57edc769",RUN+="/bin/sh -c 'mknod /dev/asmdisk02 b $major $minor;chown grid:oinstall /dev/asmdisk02;chmod 0660 /dev/asmdisk02'"
2.12.5 启动UDEV配置
/sbin/udevadm trigger --type=devices --action=change
ll /dev/asm*
3 安装
3.1 执行安装GI
打开xmanager中的Xmanager - Passive
设置DISPLAY变量的值:
su - grid export DISPLAY=192.168.9.1:0.0 cd $ORACLE_HOME ./gridSetup.sh
开始安装步骤:
执行以下脚本:
/u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/19.3.0/grid/root.sh
root@dba ~ # /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. root@dba ~ # /u01/app/oracle/product/19.3.0/grid/root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/oracle/product/19.3.0/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/oracle/product/19.3.0/grid/crs/install/crsconfig_params The log of current session can be found at: /u01/app/grid/crsdata/dba/crsconfig/roothas_2021-07-27_00-56-23AM.log 2021/07/27 00:56:28 CLSRSC-363: User ignored prerequisites during installation LOCAL ADD MODE Creating OCR keys for user 'grid', privgrp 'oinstall'.. Operation successful. LOCAL ONLY MODE Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. CRS-4664: Node dba successfully pinned. 2021/07/27 00:56:40 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service' dba 2021/07/27 00:59:22 /u01/app/grid/crsdata/dba/olr/backup_20210727_005922.olr 724960844 2021/07/27 00:59:23 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
3.2 查看进程
ps -ef | grep asm
3.3 查看ASM磁盘组信息
export DISPLAY=192.168.9.1:0.0 asmca
3.4 执行安装Oracle
su - oracle export DISPLAY=192.168.9.1:0.0 cd $ORACLE_HOME/ ./runInstaller
开始安装步骤:
3.5 建库
dbca
开始安装步骤:
3.6 查看进程
ps -ef | grep ora_ | grep -v grep
3.7 登陆
sqlplus / as sysdba select file_name from dba_data_files;
4 SRVCTL工具
在oracle用户下执行:
查看srvctl命令帮助
srvctl status -h
srvctl add -h
查看服务的状态
srvctl status database -db orcl
srvctl status listener
srvctl status asm
5 CRSCTL工具
在grid用户下执行:
查看crsctl命令帮助
crsctl -h
crsctl check -h
查看资源状态
crsctl status resource