Oracle DataGuard备库在服务器重启后,若未配置自动启动(即MRP进程自启),则会出现数据延迟,通过以下脚本配置备库自启动。
- 配置自启脚本
[oracle@HKDB02 ~]$ vi autostartdg.sh
#!/bin/sh
#dg autostart open read only when os restart
source /home/oracle/.bash_profile
env|grep ORA
lsnrctl start
sqlplus / as sysdba <<EOF
startup;
alter database recover managed standby database using current logfile disconnect from session;
exit;
EOF
- 脚本赋予执行权限
[oracle@HKDB02 ~]$ chmod 775 autostartdg.sh
- 添加rc.local
[root@HKDB02 ~]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#
su - oracle -c '/home/oracle/autostartdg.sh'