重庆思庄Oracle、Redhat认证学习论坛

标题: linux系统启动时自动启用oracle standby备库日志应用 [打印本页]

作者: 王亮    时间: 2020-5-17 10:59
标题: linux系统启动时自动启用oracle standby备库日志应用
本帖最后由 王亮 于 2020-5-18 09:12 编辑

1.创建shell文件, 内容参考如下
  [oracle@localhost ~]$ cat /home/oracle/dgstart.sh
#!/bin/sh
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=实例名
export PATH=$PATH:$ORACLE_HOME/bin
sqlplus / as sysdba @/home/oracle/standby_log_apply.sql

[oracle@localhost ~]$ cat /home/oracle/standby_log_apply.sql
startup;
alter database recover managed standby database using current logfile disconnect;

2. 使用root用户将oracle下的启动脚本加入/etc/rc.local
  [root@localhost ~]$ cat /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 -lc "/u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"
su - oracle -lc "/home/oracle/dgstart.sh"








欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2