oracleLinuxR7-U6系统Oracle 12.2 RAC集群实施(DNS服务器)
环境
RAC1 | RAC2 | DNS服务器 | |
---|---|---|---|
操作系统 | Oracle LinuxR7 | Oracle LinuxR7 | windows server 2008R2 |
IP地址 | 172.30.21.101 | 172.30.21.102 | 172.30.21.112 |
主机名称 | hefei1 | hefei2 | hefei |
数据库名 | hefeidb | hefeidb | |
实例名 | hefei1 | hefei1 |
3台操作系统安装后的简单配置
–1、IP 地址规则
#public ip
172.30.21.101 hefei1 hefei1.hefeidb.com
172.30.21.102 hefei2 hefei2.hefeidb.com
#priv ip
10.10.1.101 hefei1prv hefei1prv.hefeidb.com
10.10.1.102 hefei2prv hefei2prv.hefeidb.com
#vip ip
172.30.21.103 hefei1vip hefei1vip.hefeidb.com
172.30.21.104 hefei2vip hefei2vip.hefeidb.com
#scan ip
172.30.21.105 hefeiscan hefeiscan.hefeidb.com
172.30.21.106 hefeiscan hefeiscan.hefeidb.com
172.30.21.107 hefeiscan hefeiscan.hefeidb.com
#For DNS Server
172.30.21.112 hefeidns hefeidb.com hefeidns.hefeidb.com
配置 DNS 服务端
环境准备
配置/etc/hosts 文件
172.30.21.101 hefei1 hefei1.hefeidb.com
172.30.21.102 hefei2 hefei2.hefeidb.com
10.10.1.101 hefei1prv hefei1prv.hefeidb.com
10.10.1.102 hefei2prv hefei2prv.hefeidb.com
172.30.21.103 hefei1vip hefei1vip.hefeidb.com
172.30.21.104 hefei2vip hefei2vip.hefeidb.com
172.30.21.105 hefeiscan hefeiscan.hefeidb.com
172.30.21.106 hefeiscan hefeiscan.hefeidb.com
172.30.21.107 hefeiscan hefeiscan.hefeidb.com
172.30.21.112 hefeidns hefeidb.com hefeidns.hefeidb.com
配置/etc/resolv.conf
search hefeidb.com hefeidns.hefeidb.com localdomain
nameserver 172.30.21.112
options timeout:2
options attempts:5
配置解析顺序
vi /etc/host.conf
order bind,hosts
multi on
配置网卡上的 DNS
PEERDNS=NO
DNS1=172.30.21.112
停止 NetworkManager 服务
systemctl stop NetworkManager.service
systemctl status NetworkManager.service
测试 nslookup
检查两个网卡配置信息
ONBOOT=yes
Linux 操作系统的配置及参数修改
准备文件系统
/dev/sdc1 /oracle
/dev/sdb1 /soft
LVM:
pvcreate /dev/sdb /dev/sdc
vgcreate oravg /dev/sdb
vgcreate softvg /dev/sdc
lvcreate -n softlv -L 30000M softvg
lvcreate -n oralv -L 50000M oravg --lvextend -L +45000M /dev/oravg/oralv
mkfs.xfs /dev/softvg/softlv
mkfs.xfs /dev/oravg/oralv
vi /etc/fstab
/dev/oravg/oralv /oracle xfs defaults 0 0
/dev/softvg/softlv /soft xfs defaults 0 0
mkdir /oracle
mkdir /soft
mount /oracle
mount /soft
创建用户、组、目录
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba
/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin
/usr/sbin/groupadd -g 60010 racdba
useradd -u 61001 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
useradd -u 61002 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
id oracle
id grid
passwd oracle
passwd grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/12.2/grid
chown -R grid:oinstall /oracle
chown -R grid:oinstall /soft
mkdir -p /oracle/app/oracle
chown -R oracle:oinstall /oracle/app/oracle
mkdir -p /oracle/app/oraInventory
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle
安装相关软件包
mount /dev/cdrom /mnt
cd /etc/yum.repos.d
mkdir bk
mv public-yum-ol7.repo bk/
vi itpux.repo
[EL]
name =Linux 7.3 DVD
baseurl=file:///mnt
gpgcheck=0
enabled=1
yum list |more
# From Public Yum or ULN
yum -y install autoconf
yum -y install automake
yum -y install binutils
yum -y install binutils-devel
yum -y install bison
yum -y install cpp
yum -y install dos2unix
yum -y install ftp
yum -y install gcc
yum -y install gcc-c++
yum -y install lrzsz
yum -y install python-devel
yum -y install compat-db*
yum -y install compat-gcc-34
yum -y install compat-gcc-34-c++
yum -y install compat-libcap1
yum -y install compat-libstdc++-33
yum -y install compat-libstdc++-33.i686
yum -y install glibc-*
yum -y install glibc-*.i686
yum -y install libXpm-*.i686
yum -y install libXp.so.6
yum -y install libXt.so.6
yum -y install libXtst.so.6
yum -y install libXext
yum -y install libXext.i686
yum -y install libXtst
yum -y install libXtst.i686
yum -y install libX11
yum -y install libX11.i686
yum -y install libXau
yum -y install libXau.i686
yum -y install libxcb
yum -y install libxcb.i686
yum -y install libXi
yum -y install libXi.i686
yum -y install libgcc_s.so.1
yum -y install libstdc++.i686
yum -y install libstdc++-devel
yum -y install libstdc++-devel.i686
yum -y install libaio
yum -y install libaio.i686
yum -y install libaio-devel
yum -y install libaio-devel.i686
yum -y install ksh
yum -y install libXp
yum -y install libaio-devel
yum -y install numactl
yum -y install numactl-devel
yum -y install make -y
yum -y install sysstat -y
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install elfutils-libelf-devel-0.97
yum -y install elfutils-libelf-devel
yum -y install redhat-lsb-core
yum -y install *vnc*
修改系统相关参数
修改资源限制参数
vi /etc/security/limits.conf
#ORACLE SETTING
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 16384
grid hard nofile 65536
grid soft stack 16384
grid hard stack 32768
grid hard memlock 8192000
grid soft memlock 8192000
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 16384
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 8192000
oracle soft memlock 8192000
ulimit -a
vi /etc/security/limits.d/20-nproc.conf
* - nproc 16384
vi /etc/pam.d/login
session required pam_limits.so
修改内核参数
vi /etc/sysctl.conf
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 8719476736
kernel.shmall = 2128778
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 = 1048586
kernel.panic_on_oops = 1
vm.nr_hugepages = 2500
sysctl -p
关闭透明页 --【开了大内存页,需要,不打开不需要】
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
配置安全
–防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
–SELINUX
vi /etc/selinux/config
SELINIX=disabled
setenforce 0
关闭 NTP 服务
systemctl stop ntpd.service
systemctl disable ntpd.service
systemctl status ntpd.service
mv /etc/ntp.conf /etc/ntp.conf.bak
rm /var/run/ntpd.pid
配置 NOZEOCONF
vi /etc/sysconfig/network
NOZEROCONF=yes
修改 nsswitch.conf
–NIS
vi /etc/nsswitch.conf
hosts: files dns myhostname
–to:
hosts: files dns myhostname nis
avahi-daemon
avahi-daemon 是一种 Linux 操作系统上运行在客户机上实施查找基于网络的 Zeroconf service 的服务守护进程。 该服务可以为 Zeroconf 网络实现 DNS 服务发现及 DNS 组播规范。 用户程 序通过 Linux D-Bus 信息传递接收发现到网络服务和资源的通知。 该守护进程配合缓存用户程序 的答复,以帮助减少因答复而产生的网络流量。根据官方一些文档已经列出的一些 BUG,我们还是建议关掉这个进程比较安全。
To stop the avahi-daemon, for OL5/OL6:
# service avahi-dnsconfd stop
# ignore any errors
# service avahi-daemon stop
# chkconfig avahi-dnsconfd off
# chkconfig avahi-daemon off
for OL7:
# systemctl stop avahi-daemon.socket avahi-daemon.service
# systemctl disable avahi-daemon.socket avahi-daemon.service
两台主机的时间要同步
data -s
重启
shutdown -r now
配置用户环境变量
节点 1:
su - grid
grid 的环境变量
[grid@hefei1 ~]$ vi .bash_profile
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
umask 022
#alias sqlplus="rlwrap sqlplus"
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
ORACLE_SID=+ASM1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_BASE=/oracle/app/grid; export ORACLE_BASE
ORACLE_HOME=/oracle/app/12.2/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATH
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
su - oracle
PS1="[`whoami`@`hostname`:"'$PWD]$'
#alias sqlplus="rlwrap sqlplus"
#alias rman="rlwrap rman"
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux1
export ORACLE_UNQNAME=itpuxdb
ORACLE_SID=itpuxdb1; export ORACLE_SID
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2/db_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/12.2/db_1/bin:$ORACLE_HOME/bin; export PATH
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
节点 2:
su - grid
grid 的环境变量
PS1="[`whoami`@`hostname`:"'$PWD]$'
export PS1
umask 022
#alias sqlplus="rlwrap sqlplus"
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
ORACLE_SID=+ASM2; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_BASE=/oracle/app/grid; export ORACLE_BASE
ORACLE_HOME=/oracle/app/12.2/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export PATH
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
su - oracle
PS1="[`whoami`@`hostname`:"'$PWD]$'
#alias sqlplus="rlwrap sqlplus"
#alias rman="rlwrap rman"
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux2
export ORACLE_UNQNAME=itpuxdb
ORACLE_SID=itpuxdb2; export ORACLE_SID
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2/db_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_BASE/product/12.2/db_1/bin:$ORACLE_HOME/bin; export PATH
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
oracle@hefei1:/home/oracle]$env |grep ORACLE
su - root
vi ~/.bash_profile
/oracle/app/12.2/grid/bin
配置共享存储及ASM磁盘
4个2g dggrid1, dggrid2,dgrecovery,dgdata01
1个40g dggriddb
1个6g dgsystem
[root@hefei2 ~]# fdisk -l |grep “Disk /dev/sd*”
Disk /dev/sdc: 32.2 GB, 32212254720 bytes, 62914560 sectors
Disk /dev/sdf: 6442 MB, 6442450944 bytes, 12582912 sectors
Disk /dev/sdh: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sdi: 42.9 GB, 42949672960 bytes, 83886080 sectors
Disk /dev/sdg: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sde: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Disk /dev/sdd: 2147 MB, 2147483648 bytes, 4194304 sectors
Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
编写 udev rules 文件,生成文件内容的脚本如下
for i in d e f g h i;
do
echo "KERNEL==\"sd?\",SUBSYSTEM==\"block\",PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\",SYMLINK+=\"asm-disk$i\",OWNER=\"grid\", GROUP=\"asmadmin\",MODE=\"0660\""
done
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBd2430a0a-255a817b",SYMLINK+="asm-diskd",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB9b6a71f1-fdae8d45",SYMLINK+="asm-diske",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB6446e0c2-d7933b7b",SYMLINK+="asm-diskf",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB90dec77a-102eab38",SYMLINK+="asm-diskg",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB5e9d82c4-33692a7f",SYMLINK+="asm-diskh",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBf4c1bcfe-dcc15b3d",SYMLINK+="asm-diski",OWNER="grid", GROUP="asmadmin",MODE="0660"
将生成的内容保存在 99-oracle-asmdevices.rules 文件中
#vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBbda90f19-47c823b1", SYMLINK+="asm-dggrid1",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB2e22114d-0f4edefb", SYMLINK+="asm-dggrid2",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBb02c0af0-e60a3841", SYMLINK+="asm-dgsystem",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBcd66d3ca-68bbb4a2", SYMLINK+="asm-dgrecovery",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB975d4459-4013e311", SYMLINK+="asm-dgdata01",OWNER="grid", GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB48e4ab47-27d5ce7e", SYMLINK+="asm-dggriddb",OWNER="grid", GROUP="asmadmin",MODE="0660"
重启 udev 设备
/sbin/udevadm trigger --type=devices --action=change
检查 udev 设备
ls -lsa /dev/asm*
ls -lsa /dev/sd*
Oracle GRID集群软件的安装与调试
上传软件并解压
–[grid在hefei1设备上面解压,hefei2不用]
[root@hefei1 /]# su - grid
Last login: Wed Aug 23 11:00:09 CST 2023 on pts/0
[grid@hefei1:/home/grid]$cd /soft/
[grid@hefei1:/soft]$ls
**linuxx64_12201_database.zip linuxx64_12201_grid_home.zip**
[grid@hefei1:/soft]$cd $ORACLE_HOME
[grid@hefei1:/oracle/app/12.2/grid]$unzip /soft/linuxx64_12201_grid_home.zip
root:
root@hefei1 /]# cd /oracle/app/12.2/grid/cv/rpm/
[root@hefei1 rpm]# rpm -ivh cvuqdisk-1.0.10-1.rpm
[root@hefei2 soft]# rpm -ivh cvuqdisk-1.0.10-1.rpm
配置两个节点之前的信任关系
root:
[root@hefei1 ~]# cd /oracle/app/12.2/grid/oui/prov/resources/scripts/
[root@hefei1 scripts]# ./sshUserSetup.sh -user grid -hosts “hefei1 hefei2” -advanced -exverify -confirm
[root@hefei1 scripts]# ./sshUserSetup.sh -user oracle -hosts “hefei1 hefei2” -advanced -exverify -confirm
–[yes yes 回车 回车 4次密码]
验证:
su - grid
ssh hefei1 date
ssh hefei2 date
ssh hefei1prv date
ssh hefei2prv date
ssh hefei1.hefeidb.com date --[都输入一次,yes确认]
ssh hefei2.hefeidb.com date
ssh hefei1prv.hefeidb.com date
ssh hefei1prv.hefeidb.com date
su - oracle
ssh hefei1 date
ssh hefei2 date
ssh hefei1prv date
ssh hefei2prv date
ssh hefei1.hefeidb.com date
ssh hefei2.hefeidb.com date
ssh hefei1prv.hefeidb.com date
ssh hefei1prv.hefeidb.com date
安装软件
[root@hefei1 scripts]# su - grid
Last login: Wed Aug 23 14:17:45 CST 2023 on pts/0
[grid@hefei1:/home/grid]$vncserver
使用vnc登录安装
[grid@hefei1 ~]$ cd $ORACLE_HOME
[grid@hefei1 grid]$ ./gridSetup.sh
这里勾选最后一项,报错:
FD-620:AFD is not supported on this operating system version:‘4.14.35-1818.3.3el7uek.x86_64’
AFD-9201:not supported
报错说了不支持这个内核版本。
如果使用了udev和多路径绑定存储,完全不需要AFD,这个特性在12.2之后会默认选中,我们一般在安装的时候会去掉这个选项,采用传统的方式直接配置asm
第一条:先用root用户在两个节点分别执行
第二条:在root用户第一个节点执行完成后,再在第二个节点执行
跑完后,再点ok继续安装。
[root@hefei1 run]# crsctl check crs
[grid@hefei1:/home/grid]$crs_stat -t
Oracle ASM磁盘组的创建与基础管理
[grid@hefei1:/home/grid]$vncserver
asmca
Oracle RAC数据库软件安装
[oracle@hefei1:/soft]$unzip linuxx64_12201_database.zip
[oracle@hefei1:/soft]$vncserver
Oracle RAC集群数据库的创建与配置
dbca
块大小:8K/16/32
字符集:GBK/UTF8
配置RAC环境下的归档与闪回
启动归档 --只在一个实例上面做
+dgrecovery
–首先要关闭另一个实例。
–show parameter recover;
alter system set db_recovery_file_dest_size=1g scope=both;
alter system set db_recovery_file_dest=‘+dgrecovery’ scope=both;
–show parameter cluster;
alter system set cluster_database=false scope=spfile; --关闭集群
shutdown immediate;
sharup mount;
alter database archivelog;
alter database flashback on; --如果需要开归档,就执行这个。
alter system set cluster_database= true scope=spfile; --打开集群,重启生效
shutdown immediate;
startup;
archivelog log list;
alter system swithc logfile;
检查下数据库日志是否有报错
– tail -100f /oracle/app/oracle/diag/rdbms/hefeidb/hefeidb1/trace/alert_hefeidb1.log
再开启另外一个实例。
2、关闭归档 --只在一个实例上面做
先关闭另外一个实例。
alter system set cluster_database=false scope=spfile; --关闭集群
shutdown immediate;
sharup mount;
alter database flashback off; --先关闭闪回,再关归档
alter database noarchivelog;
alter system set cluster_database= true scope=spfile; --打开集群
shutdown immediate;
startup;
archivelog log list;
再关闭另外一个实例。
Oracle RAC日常维护基本管理与维护
180天密码过期
select * from dba_profiles where profile=‘DEFAULT’ and resource_name=‘PASSWORD_LIFE_TIME’;
alter profile default limit password_life_time unlimited;
关闭审计
show parameter audit
alter system set audit_trail =none scope=spfile; --重启生效
ocr配置信息的镜像
ocrconfig -add +dggrid2
EM管理器
打开 EM
exec dbms_xdb_config.sethttpsport(5500);
exec dbms_xdb_config.sethttpport(5501);
关闭 EM
exec dbms_xdb_config.sethttpsport(0);
exec dbms_xdb_config.sethttpport(0);
检查 EM
select dbms_xdb_config.gethttpsport from dual;
select dbms_xdb_config.gethttpport from dual;
RAC启停
停止
–两个节点
su - oracle
sqlplus “/as sysdba”
shutdown immediate
–两个节点
su - root
crsctl stop crs
启动
su - root
crsctl start crs
crsctl check crs
crsctl status res -t
crs_stat -t
–两个节点
su - oracle
sqlplus “/as sysdba”
select name,open_mode from v$database;
select instance_name,status from v$instance;
检查数据库的日志
数据库日志:tail -100f /oracle/app/oracle/diag/rdbms/hefeidb/hefeidb1/trace/alert_hefeidb1.log
集群日志:tail -100f /oracle/app/grid/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log