跳过正文

Oracle 11.2.0.4 RAC 在 CentOS 7.9 上安装实战

Greatfinish
作者
Greatfinish
记录 Oracle、PostgreSQL、达梦、Linux、存储与生产环境故障处理经验。

安装介质
#

操作系统包

compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm pdksh-5.2.14-37.el5_8.1.x86_64.rpm

oracle安装介质

p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip p13390677_112040_Linux-x86-64_3of7.zip

oracle补丁,执行root.sh

p18370031_112040_Linux-x86-64.zip

asm安装包

oracleasm-support-2.1.11-2.el7.x86_64.rpm kmod-oracleasm-2.0.8-28.0.1.el7.x86_64.rpm oracleasmlib-2.0.12-1.el7.x86_64.rpm

百度网盘下载

链接: https://pan.baidu.com/s/1c1Zl2N6w1RgGyS2WRTpG2g 提取码: rfc2

安装步骤
#

系统版本
#

cat /etc/centos-release

关闭防火墙
#

systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state

关闭selinux
#

setenforce 0
sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
sestatus

配置Yum源
#

有网络的条件配置清华源

sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
         -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.tuna.tsinghua.edu.cn|g' \
         -i.bak \
         /etc/yum.repos.d/CentOS-*.repo

没有网络的,配置本地源

mount -o loop /root/CentOS-7-x86_64-DVD-2207-02.iso /mnt
cat >> /etc/yum.repos.d/local.repo << "EOF"
[local]
name=local
baseurl=file:///mnt
gpgcheck=0
enabled=1

EOF
yum clean all
yum makecache

移除虚拟嵌套
#

yum remove libvirt-libs -y

配置hosts文件
#

hostnamectl set-hostname rac-1
cat >> /etc/hosts << "EOF"

192.168.17.20        rac-1
192.168.17.21        rac-2
18.18.18.1           rac-1-priv
18.18.18.2           rac-2-priv
192.168.17.23        rac-1-vip
192.168.17.24        rac-2-vip

192.168.17.25        rac-scan


EOF

配置sysctl.conf
#

cat >> /etc/sysctl.conf << "EOF"

fs.file-max = 6815744
kernel.sem = 10000  10240000 10000 1024
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 40960000
vm.dirty_ratio = 20
vm.dirty_background_ratio = 3
vm.dirty_writeback_centisecs = 100
vm.dirty_expire_centisecs = 500
vm.swappiness = 10
vm.min_free_kbytes = 524288
vm.nr_hugepages = 529    #注意sga 32G 设置16408 64G设置32792 128G设置65560 256G设置131096

EOF
/sbin/sysctl -p

配置limits.conf
#

cat >> /etc/security/limits.conf << "EOF"

oracle   soft   nofile     1048576
oracle   hard   nofile     1048576
oracle   soft   nproc      131072
oracle   hard   nproc      131072
oracle   soft   stack      10240
oracle   hard   stack      32768
oracle   soft   core       6291456
oracle   hard   core       6291456
oracle   soft   memlock    241591910
oracle   hard   memlock    241591910

grid     soft   nofile     1048576
grid     hard   nofile     1048576
grid     soft   nproc      131072
grid     hard   nproc      131072
grid     soft   stack      10240
grid     hard   stack      32768
grid     soft   core       6291456
grid     hard   core       6291456
grid     soft   memlock    241591910
grid     hard   memlock    241591910


EOF

cat >> /etc/pam.d/login << "EOF"

session    required     pam_limits.so
session    required     /lib64/security/pam_limits.so

EOF

安装所需包
#

yum install -y bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
gcc \
gcc-c++ \
elfutils-libelf \
elfutils-libelf-devel \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
libX11 \
libXau \
libXi \
libXtst \
libXrender \
libXrender-devel \
make \
net-tools \
nfs-utils \
smartmontools \
sysstat \
e2fsprogs \
e2fsprogs-libs \
fontconfig-devel \
expect \
unzip \
openssh-clients \
readline* \
tigervnc* \
psmisc --skip-broken
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
rpm -e ksh-20120801-144.el7_9.x86_64
rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
# 检查安装包
rpm -q bc binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ elfutils-libelf elfutils-libelf-devel glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst libXrender libXrender-devel make net-tools nfs-utils smartmontools sysstat e2fsprogs e2fsprogs-libs fontconfig-devel expect unzip openssh-clients readline | grep "not installed"
注意ksh not installed是因为pdksh这个包和它有冲突

关闭ntp和chrony服务
#

systemctl stop ntpd
systemctl disable ntpd.service
mv /etc/ntp.conf /etc/ntp.conf.bak
systemctl stop chronyd
systemctl disable chronyd
mv /etc/chrony.conf /etc/chrony.conf_bak

关闭透明大页和numa
#

查看透明大页是否关闭(always表示启用,never表示禁用)

cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
vi /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
Fi
chmod +x /etc/rc.d/rc.local

修改grub配置文件添加"transparent_hugepage=never":

# grep CMDLINE /etc/default/grub
vi /etc/default/grub
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet transparent_hugepage=never numa=off"
# 直接或者用sed修改
sed -i 's/quiet/quiet transparent_hugepage=never numa=off/' /etc/default/grub
cat /etc/default/grub
# 重建/boot/grub2/grub.cfg文件
grub2-mkconfig -o /boot/grub2/grub.cfg
[root@rac-1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.71.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.71.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-61edbdff9a994c8e987f8f628d240f19
Found initrd image: /boot/initramfs-0-rescue-61edbdff9a994c8e987f8f628d240f19.img
done
[root@rac-1 ~]#
# 重启OS
shutdown -r now

禁用avahi-daemon
#

建议关闭avahi-daemon

yum install -y avahi*
systemctl stop avahi-daemon.socket
systemctl stop avahi-daemon.service
systemctl disable avahi-daemon.socket
systemctl disable avahi-daemon.service
systemctl status avahi-daemon.socket
systemctl status avahi-daemon.service
pgrep -f avahi-daemon | awk '{print "kill -9 "$2}'

# 配置NOZEROCONF=yes
cat >> /etc/sysconfig/network << "EOF"

NOZEROCONF = yes

EOF

创建组和用户
#

创建组
/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 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
/usr/sbin/groupadd -g 54330 racdba

创建用户
/usr/sbin/useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba,oper grid
/usr/sbin/useradd -u 54321 -g oinstall -G asmdba,dba,backupdba,dgdba,kmdba,racdba,oper oracle

修改密码
echo "sinopharm" |passwd oracle --stdin
echo "sinopharm" |passwd grid --stdin

创建目录
#

mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/11.2.0/db
mkdir -p /u01/app/oraInventory
mkdir -p /backup
mkdir -p /home/oracle/scripts

chown -R oracle:oinstall /backup
chown -R oracle:oinstall /home/oracle/scripts
chown -R grid:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

修改profile
#

cat >> /etc/profile << "EOF"

if [ $USER = "oracle" ] || [ $USER = "grid" ] ; then
        if  [ $SHELL = "/bin/ksh" ];  then
              ulimit -p 131072
              ulimit -n 1048576
        else
              ulimit -u 131072 -n 1048576
        fi
fi


EOF

环境变量设置
#

su - grid
cat >> /home/grid/.bash_profile << "EOF"

#Grid Settings
export TMP=/tmp
export TMPDIR=$TMP

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH


EOF


su - oracle
cat >> /home/oracle/.bash_profile << "EOF"

#Oracle Settings
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=orcl1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH


EOF

大页内存设置
#

grep -i huge /proc/meminfo
# Oracle数据库设置sga_target
# 配置/etc/sysctl.conf
vm.nr_hugepages = 529    #注意sga 32G 设置16408 64G设置32792 128G设置65560 256G设置131096

上传安装包解压
#

chown grid:oinstall p13390677_112040_Linux-x86-64_3of7.zip
su - grid
unzip p13390677_112040_Linux-x86-64_3of7.zip
chown oracle:oinstall p13390677_112040_Linux-x86-64_1of7.zip
chown oracle:oinstall p13390677_112040_Linux-x86-64_2of7.zip
su - oracle
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip

配置SSH对等
#

cd grid/sshsetup/
./sshUserSetup.sh -user grid -hosts "rac-1 rac-2" -advanced -exverify -confirm –noPromptPassphrase
cd database/sshsetup/
./sshUserSetup.sh -user oracle -hosts "rac-1 rac-2" -advanced -exverify -confirm –noPromptPassphrase

配置ASM共享存储
#

# 格式化磁盘
lsblk
fdisk /dev/sdb
fdisk /dev/sdc
fdisk /dev/sdd
fdisk /dev/sde
# 同步到异机
partprobe
# 安装asm软件
rpm -ivh oracleasm-support-2.1.11-2.el7.x86_64.rpm
rpm -ivh kmod-oracleasm-2.0.8-28.0.1.el7.x86_64.rpm
rpm -ivh oracleasmlib-2.0.12-1.el7.x86_64.rpm
# 初始化asm
/usr/sbin/oracleasm configure -i
grid
asmadmin
y
y
/usr/sbin/oracleasm init
# 清理磁盘,注意谨慎操作
dd if=/dev/zero of=/dev/sdb1 bs=1024 count=100
dd if=/dev/zero of=/dev/sdc1 bs=1024 count=100
dd if=/dev/zero of=/dev/sdd1 bs=1024 count=100
dd if=/dev/zero of=/dev/sde1 bs=1024 count=100
# 创建OCRVOTE磁盘组和DATA磁盘组
oracleasm createdisk ocrvote01 /dev/sdb1
oracleasm createdisk ocrvote02 /dev/sdc1
oracleasm createdisk ocrvote03 /dev/sdd1
oracleasm createdisk data01 /dev/sde1
# 异机扫描磁盘组
oracleasm scandisks
oracleasm listdisks

cvuqdisk安装
#

# 两台主机都安装cvuqdisk包
cd grid/rpm
rpm -ivh cvuqdisk-1.0.9-1.rpm

安装grid软件
#

# 准备工作检查
cd grid
./runcluvfy.sh stage -pre crsinst -n rac-1,rac-2 -fixup -verbose
./runInstaller

安装补丁
#

原因:RHEL7使用systemd而不是initd运行进程和重启进程,而root.sh是通过传统的initd运行ohasd进程,此为Linux7安装11204版本,执行root.sh时存在的BUG,需要在执行root.sh前安装补丁18370031修复

18370031补丁安装(双节点执行)
上传补丁包
p18370031_112040_Linux-x86-64.zip
chown grid:oinstall p18370031_112040_Linux-x86-64.zip
unzip -q p18370031_112040_Linux-x86-64.zip
cd 18370031/
opatch napply -oh $ORACLE_HOME -local .

[grid@rac-1 18370031]$ opatch napply -oh $ORACLE_HOME -local .
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/11.2.0/grid/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2024-04-23_10-50-57AM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   18370031

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/11.2.0/grid')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '18370031' to OH '/u01/app/11.2.0/grid'

Patching component oracle.crs, 11.2.0.4.0...

Verifying the update...
Patch 18370031 successfully applied.
Log file location: /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2024-04-23_10-50-57AM_1.log

OPatch succeeded.
[grid@rac-1 18370031]$

执行root.sh脚本
#

[root@rac-1 ~]# /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@rac-1 ~]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.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/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
  root wallet
  root wallet cert
  root cert export
  peer wallet
  profile reader wallet
  pa wallet
  peer wallet keys
  pa wallet keys
  peer cert request
  pa cert request
  peer cert
  pa cert
  peer root cert TP
  profile reader root cert TP
  pa root cert TP
  peer pa cert TP
  pa peer cert TP
  profile reader pa cert TP
  profile reader peer cert TP
  peer user cert
  pa user cert
Adding Clusterware entries to oracle-ohasd.service
CRS-2672: Attempting to start 'ora.mdnsd' on 'rac-1'
CRS-2676: Start of 'ora.mdnsd' on 'rac-1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'rac-1'
CRS-2676: Start of 'ora.gpnpd' on 'rac-1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac-1'
CRS-2672: Attempting to start 'ora.gipcd' on 'rac-1'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac-1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'rac-1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac-1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac-1'
CRS-2676: Start of 'ora.diskmon' on 'rac-1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac-1' succeeded

ASM created and started successfully.

Disk Group OCRVOTE created successfully.

clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 2e2ff15375484fabbfc8c13a88290759.
Successful addition of voting disk 7fd1b4dc71304f99bf1c5b4c635e8e91.
Successful addition of voting disk 3024add0cc754febbf637f859a27dd1a.
Successfully replaced voting disk group with +OCRVOTE.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   2e2ff15375484fabbfc8c13a88290759 (ORCL:OCRVOTE01) [OCRVOTE]
 2. ONLINE   7fd1b4dc71304f99bf1c5b4c635e8e91 (ORCL:OCRVOTE02) [OCRVOTE]
 3. ONLINE   3024add0cc754febbf637f859a27dd1a (ORCL:OCRVOTE03) [OCRVOTE]
Located 3 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'rac-1'
CRS-2676: Start of 'ora.asm' on 'rac-1' succeeded
CRS-2672: Attempting to start 'ora.OCRVOTE.dg' on 'rac-1'
CRS-2676: Start of 'ora.OCRVOTE.dg' on 'rac-1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@rac-1 ~]#



[root@rac-2 ~]# /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@rac-2 ~]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/11.2.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/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
Adding Clusterware entries to oracle-ohasd.service
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac-1, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@rac-2 ~]#

安装Oracle软件
#

./runInstaller

#root执行
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/db_1/root.sh

安装中报错ins_emagent.mk解决

cd $ORACLE_HOME/sysman/lib
sed  -i  's/^\(\s*\$(MK_EMAGENT_NMECTL)\)\s*$/\1 -lnnz11/g'  ins_emagent.mk

执行root.sh,/u01/app/oracle/product/11.2.0/db/root.sh

[root@rac-1 ~]# /u01/app/oracle/product/11.2.0/db/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/db

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

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.
Finished product-specific root actions.
[root@rac-1 ~]#

[root@rac-2 ~]# /u01/app/oracle/product/11.2.0/db/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/11.2.0/db

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

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.
Finished product-specific root actions.
[root@rac-2 ~]#

创建库
#

dbca
#数据库创建后,修改部分参数,具体应用再做详细调整
--调整最大进程数(以下值为一般设定值,根据具体应用要求)
alter system set processes=1000 scope=spfile sid='*';
alter system set resource_manager_plan='FORCE:' scope =spfile sid='*';
--禁用AUDIT
alter system set audit_trail=none scope=spfile sid='*';
alter system set undo_retention=10800 scope=spfile sid='*';
alter system set session_cached_cursors=500 scope=spfile sid='*';
alter system set db_files=2000 scope=spfile sid='*';
alter system set max_shared_servers=0 scope=spfile sid='*';
alter system set sec_max_failed_login_attempts=100 scope=spfile sid='*';
alter system set deferred_segment_creation=false scope=spfile sid='*';
alter system set parallel_force_local=true scope=spfile  sid='*';
alter system set parallel_max_servers=32 scope=spfile  sid='*';
--关闭密码大小写敏感
alter system set sec_case_sensitive_logon=false scope=spfile  sid='*';
alter system set open_cursors=3000     scope=spfile sid='*';
alter system set open_link =40      scope=spfile sid='*';
alter system set open_links_per_instance =40  scope=spfile sid='*';
--使用sga自动调整
--alter system set sga_target=0 scope=spfile sid='*';
alter system set db_cache_size=120g scope=spfile sid='*';
alter system set shared_pool_size=25g scope=spfile sid='*';
alter system set large_pool_size=512m scope=spfile sid='*';
alter system set java_pool_size=512m scope=spfile sid='*';
alter system set db_cache_advice=off scope=spfile sid='*';
alter system set gcs_server_processes=6  scope=spfile sid='*';
--关闭结果集缓存
alter system set result_cache_max_size = 0 sid='*';
alter system set "_b_tree_bitmap_plans"=false scope=spfile sid='*';
alter system set "_gc_policy_time"=0 scope=spfile sid='*';
alter system set "_gc_defer_time"=3 scope=spfile sid='*';
alter system set "_lm_tickets"=5000 scope=spfile sid='*';
alter system set "_optimizer_use_feedback"=false sid='*';
alter system set "_undo_autotune"=false scope=both  sid='*';
alter system set "_bloom_filter_enabled"=FALSE     scope=spfile sid='*';
 alter system set "_cleanup_rollback_entries"=2000  scope=spfile sid='*';
alter system set "_px_use_large_pool"=true scope=spfile sid='*';
--关闭use_adaptive_log_file_sync特性
ALTER SYSTEM SET "_use_adaptive_log_file_sync"=FALSE scope=both sid='*';
--关闭密码延迟验证特性
alter system set event='28401 trace name context forever,level 1','10949 trace name context forever,level 1'scope=spfile sid='*';
--关闭直接路径读特性
alter system set "_serial_direct_read”=NEVER scope=spfile sid='*';
#关闭ACS特性
alter system set "_optimizer_extended_cursor_sharing_rel"=NONE scope=spfile sid='*';
alter system set "_optimizer_extended_cursor_sharing"=NONE scope=spfile sid='*';
alter system set "_optimizer_adaptive_cursor_sharing"=false  scope=spfile sid='*';
alter system set "_optimizer_mjc_enabled"=FALSE  scope=spfile sid='*';
alter system set "_sort_elimination_cost_ratio"=1 scope=spfile sid='*';
alter system set "_partition_large_extents"=FALSE scope=spfile sid='*';
alter system set "_index_partition_large_extents"=FALSE  scope=spfile sid='*';
--使用sga自动调整,这个不能关闭
--alter system set "_memory_imm_mode_without_autosga"=FALSE scope=spfile sid='*';
alter system set "_clusterwide_global_transactions"=FALSE scope=spfile sid='*';
alter system set "_part_access_version_by_number"=FALSE scope=spfile;
alter system set "_partition_large_extents"=FALSE         scope=spfile;
alter system set "_sort_elimination_cost_ratio"=1         scope=spfile;
alter system set "_use_adaptive_log_file_sync"=FALSE  scope=spfile;
alter system set "_lm_sync_timeout"=1200 scope=spfile;
alter system set "_ksmg_granule_size"=134217728 scope=spfile;
alter system set "_external_scn_logging_threshold_seconds"=3600 scope=spfile;
alter system set "_datafile_write_errors_crash_instance"=false scope=spfile;
alter system set event='28401 TRACE NAME CONTEXT FOREVER, LEVEL 1:60025 trace name context forever:10949 trace name context forever,level 1' sid='*' scope=spfile;

CRS资源调整
#

CRS默认每秒检查一次网络建库情况,如果发现网络存在异常比如闪断,那么将会立刻将SCAN/LISTENER等资源failover切换。可能影响业务。建议将check频率调大,建议将public 网络的检查频率从1秒修改为6秒

# 用grid账号执行查询
crsctl stat res ora.net1.network -p
# 用root账号执行调整
/u01/app/11.2.0/grid/bin/crsctl modify res ora.net1.network -attr "CHECK_INTERVAL=6"

关闭系统自带JOB
#

关闭优化器统计顾问等

exec dbms_scheduler.disable('ORACLE_OCM.MGMT_CONFIG_JOB');
exec dbms_scheduler.disable('ORACLE_OCM.MGMT_STATS_CONFIG_JOB');

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'auto space advisor',
operation => NULL,
window_name => NULL);
END;
/

BEGIN
DBMS_AUTO_TASK_ADMIN.DISABLE(
client_name => 'sql tuning advisor',
operation => NULL,
window_name => NULL);
END;
/