Anolis 7.9 安装 Oracle 19c 记录
yum update
===
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libaio-devel*.devel libstdc++-devel libstdc++-devel*.devel libXi libXtst make sysstat unixODBC unixODBC-devel
cd /home/
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/compat-libcap1-1.10-7.el7.x86_64.rpm
yum localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
yum localinstall compat-libcap1-1.10-7.el7.x86_64.rpm
===
systemctl disable ip6tables.service
===
groupadd -g 5001 dba
groupadd -g 5002 asmdba
groupadd -g 5003 backupdba
groupadd -g 5004 dgdba
groupadd -g 5005 kmdba
groupadd -g 5006 racdba
groupadd -g 5007 oper
groupadd -g 5008 oinstall
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
mkdir -p /app/oracle/{oraInventory,product/19.3.0/db}
passwd oracle
<password>
===
unzip /home/LINUX.X64_193000_db_home.zip -d /app/oracle/product/19.3.0/db
===
chown -R oracle:oinstall /app
chmod -R 775 /app
vi /etc/sysctl.conf
#shmall=内存*1024*1024*1024/4096
#shmmax=1/2内存
#64G
kernel.shmall = 16777216
kernel.shmmax = 34359738368
#32G
kernel.shmall = 8388608
kernel.shmmax = 171849023488
#16G
kernel.shmall = 4194304
kernel.shmmax = 8589934592
fs.file-max = 6815744
fs.aio-max-nr = 3145728
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.wmem_max=3145728
net.core.rmem_max=4194304
net.ipv6.conf.all.disable_ipv6=1
vi /etc/sysconfig/network
NETWORKING_IPV6=no
vi /etc/security/limits.conf
oracle soft nproc 65536
oracle hard nproc 65536
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft stack 65536
oracle hard stack 65536
vi /home/oracle/.bash_profile
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db
export ORACLE_SID=<SID名>
export ORACLE_TERM=xterm
export ORACLE_OWNER=oracle
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
=============自启动
vi /etc/oratab
N改成Y
SID名:/opt/app/oracle/product/19.3.0:Y
vi /usr/bin/oracle.sh
! /bin/bash
script For oracle19c.service
/app/oracle/product/19.3.0/db/bin/lsnrctl start
/app/oracle/product/19.3.0/db/bin/dbstart /app/oracle/product/19.3.0/db
===
chmod 777 /usr/bin/oracle.sh
vi /etc/systemd/system/oracle.service
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/app/oracle/product/19.3.0/db"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
systemctl enable oracle
systemctl is-enabled oracle.service
====================自启动
创建用户
<sql>create user <username> identified by <password>;
<sql>grant dba,connect,resource,create view to <username>;
设置SGA
<sql>ALTER SYSTEM SET SGA_MAX_SIZE=32G SCOPE=SPFILE;
<sql>ALTER SYSTEM SET SGA_TARGET=32G SCOPE=SPFILE;
================开启归档模式
<sql>shutdown immediate
<sql>startup mount
<sql>alter database archivelog;
<sql>alter database open;
更改归档日志目录
<sql>alter system set log_archive_dest_1='location=/app/archivelog/archive_log';
修改日志文件命名格式
<sql>alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;
<sql>alter system set log_archive_max_processes = 5;
查看当前Oracle模式:
<sql>select log_mode from v$database;
<sql>archive log list;
================开启归档模式
================关闭归档模式
shutdown immediate;
startup mount;
ALTER DATABASE NOARCHIVELOG;
alter database open;
archive log list;
================关闭归档模式
================配置快速恢复区域
mkdir /app/oracle/fast_recovery_area
chown -R oracle:oinstall /app/oracle/fast_recovery_area
===
<sql>alter system set db_recovery_file_dest_size=40G scope=spfile;
<sql>alter system set db_recovery_file_dest='/app/oracle/fast_recovery_area' scope=spfile;
<sql>Shutdown immediate;
<sql>Startup;
================配置快速恢复区域