银河麒麟系统静默安装19c数据库

2024年 5月 29日 80.4k 0

一、概述

本文将介绍银河麒麟操作系统V10下静默安装oracle 19c单机数据库的过程。

1.1 主机信息

系统版本 Kylin Linux Advanced Server release V10 (Lance)
主机名 oracle-19c
IP地址 192.168.12.110

1.2 数据库信息

数据库版本 oracle 19.22
数据库实例名 oracle
数据库服务名 oracle
数据库字符集 ZHS16GBK
数据文件目录 /data/ORACLE
归档目录 /arch

二、麒麟系统配置

2.1 关闭防火墙

[root@oracle-19c ~]# systemctl stop firewalld.service
[root@oracle-19c ~]# systemctl disable firewalld.service
[root@oracle-19c ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

2.2 关闭selinux

[root@oracle-19c ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@oracle-19c ~]# setenforce 0
setenforce: SELinux is disabled
[root@oracle-19c ~]# getenforce
Disabled

2.3 配置yum源

[root@oracle-19c yum.repos.d]# yum repolist -v
加载插件:builddep, changelog, config-manager, copr, debug, download, generate_completion_cache, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync
YUM version: 4.2.23
cachedir: /var/cache/dnf

2.4 安装依赖包

yum install -y bc \
binutils \
elfutils-libelf \
elfutils-libelf-devel \
fontconfig-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libXrender \
libX11 \
libXau \
libXi \
libXtst \
libgcc \
libnsl \
librdmacm \
libstdc++ \
libstdc++-devel \
libxcb \
libibverbs \
make \
policycoreutils \
policycoreutils-python-utils \
smartmontools \
sysstat

2.5 配置hosts

[root@oracle-19c ~]# cat /etc/hosts
192.168.12.110 oracle-19c
EOF

2.6 配置内核参数

[root@oracle-19c yum.repos.d]# cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
kernel.sysrq=0
net.ipv4.ip_forward=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.tcp_syncookies=1
kernel.dmesg_restrict=1
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 7903699
kernel.shmmax = 32373555199
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
vm.min_free_kbytes=126459
net.ipv4.conf.ens192.rp_filter = 1
vm.swappiness = 10
kernel.panic_on_oops = 1
kernel.randomize_va_space = 2
kernel.numa_balancing = 0

--生效
sysctl -p

2.7 配置资源限制

[root@oracle-19c ]# vi /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock unlimited
oracle soft memlock unlimited

2.8 创建用户和组

## 创建 oinstall dba oper 组
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54330 racdba

## 创建 oracle 用户
/usr/sbin/useradd -u 54321 -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle
## 修改 oracle 用户密码为 oracle
echo "oracle" |passwd oracle --stdin
## 检查 oracle 用户
[root@oracle-19c ~]# id oracle
用户id=54321(oracle) 组id=54321(oinstall) 组=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)

2.9 创建安装目录

[root@oracle-19c ~]# mkdir -p /u01/app/oracle/product/19.3.0/db
[root@oracle-19c ~]# mkdir -p /u01/app/oraInventory
[root@oracle-19c ~]# mkdir -p /home/oracle/scripts
[root@oracle-19c ~]# chown -R oracle:oinstall /u01/
[root@oracle-19c ~]# chown -R oracle:oinstall /home/oracle/scripts
[root@oracle-19c ~]# chmod -R 775 /u01/
[root@oracle-19c ~]# chmod -R oracle:oinstall /arch

2.10 配置环境变量

[root@oracle-19c ~]# cat >> ~oracle/.bash_profile &1 &
$ORACLE_HOME/bin/lsnrctl start > /dev/null 2>&1 &
[root@oracle-19c ~]# cat /usr/local/bin/stopOracle.sh
#!/bin/bash
# Load Oracle environment variables
. /home/oracle/.bash_profile

# Stop Oracle Database
$ORACLE_HOME/bin/dbshut $ORACLE_HOME > /dev/null 2>&1 &
$ORACLE_HOME/bin/lsnrctl stop > /dev/null 2>&1 &

####配置systemd

[root@oracle-19c ~]# su - oracle
[oracle@oracle-19c~]$ cd $ORACLE_HOME/bin
[oracle@oracle-19c bin]$ vi dbstart

ORACLE_HOME_LISTNER=$1
修改:
ORACLE_HOME_LISTNER=/u01/app/oracle/product/19.3.0/db

[root@oracle-19c ~]# su - oracle
[oracle@oracle-19c ~]$ cd $ORACLE_HOME/bin
[oracle@oracle-19c bin]$ vi dbshut
ORACLE_HOME_LISTNER=$1
-->
ORACLE_HOME_LISTNER=/u01/app/oracle/product/19.3.0/db

[root@oracle-19c ~]# cat /usr/lib/systemd/system/oracle.service
[Unit]
Description=Oracle Database 19c
After=syslog.target network.target

[Service]
Type=forking
User=oracle
Group=oinstall
ExecStart=/usr/local/bin/startOracle.sh
ExecStop=/usr/local/bin/stopOracle.sh
Environment=ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
Environment=ORACLE_SID=ORACLE
[Install]
WantedBy=multi-user.target

--重新加载systemd
[root@oracle-19c ~]# systemctl daemon-reload
--启动数据库
[root@ oracle-19c~]# systemctl start oracle
--停止数据库
[root@oracle-19c ~]# systemctl stop oracle
--允许自启动
[root@oracle-19c ~]# systemctl enable oracle
Created symlink from /etc/systemd/system/multi-user.target.wants/oracle.service to /usr/lib/systemd/system/oracle.service.

4.2 配置备份

Rman配置
[oracle@oracle-19c:/arch/backup/rman]$ rman target /
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;

Rman全备脚本,当前配置保留7天全备

[oracle@oracle-19c:/home/oracle/scripts]$ cat fulldbbackup.sh
#!/bin/bash
source ~/.bash_profile
backtime=`date +"20%y%m%d%H%M%S"`
rman target / log=/home/oracle/scripts/log/level0_backup_${backtime}.log

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论