最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

Oracle11gDataGuard自动启动服务

来源:懂视网 责编:小采 时间:2020-11-09 15:10:29
文档

Oracle11gDataGuard自动启动服务

Oracle11gDataGuard自动启动服务:Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:oracledg #!/bin/bash #chkconfig: 2345 98 Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:o
推荐度:
导读Oracle11gDataGuard自动启动服务:Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:oracledg #!/bin/bash #chkconfig: 2345 98 Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:o

Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:oracledg #!/bin/bash #chkconfig: 2345 98

Oracle 11g DataGuard自动启动服务

只为了做的更好
Just to do better

script name:oracledg

#!/bin/bash
#chkconfig: 2345 98 01
#description: Oracle database dataguard server
#Starts the oracle database dataguard server
#If more than four archive no application will be under the mout synchronization
#make SHEEL :MUXINQNG
case $1 in

'start')
if [ ! -f /var/lock/subsys/oracle ]; then
prog="listener"
echo -n $"Starting $prog: "
su - oracle -c "lsnrctl start" >> /var/log/oracle.log
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "success" || echo "failed"

prog="oracle dataguard"
echo -n $"Starting $prog: "
su - oracle -c "sqlplus /nolog" << EOF >> /var/log/oracle.log
connect / as sysdba
startup mount
! sleep 30
select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v\$database;
select thread#,min(sequence#) no_applied_min,max(sequence#) no_applied_max,count(1) no_applied_all from v\$archived_log where applied='NO' and STANDBY_DEST='NO' and deleted<>'YES' group by thread# order by thread#;
declare wyyn number;
begin
select count(1) into wyyn from v\$archived_log where applied='NO' and standby_dest='NO';
if wyyn < 5 then
EXECUTE IMMEDIATE 'alter database open';

EXECUTE IMMEDIATE 'alter database recover managed standby database using current logfile disconnect';
else

EXECUTE IMMEDIATE 'alter database recover managed standby database using current logfile disconnect';
end if;
end;
/
select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v\$database;
select applied,count(1) from v\$archived_log where applied='NO' group by applied;
exit
EOF

RETVAL=$?
[ $RETVAL -eq 0 ] && echo "success" || echo "failed"
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/oracle || RETVAL=1
fi
;;
'stop')
prog="listener"
echo -n $"Stopping $prog: "
su - oracle -c "lsnrctl stop" >> /var/log/oracle.log
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "success" || echo "failed"
echo
prog="oracle dataguard"
echo -n $"Stopping $prog: "
su - oracle -c "sqlplus /nolog" << EOF >> /var/log/oracle.log
connect / as sysdba
alter database recover managed standby database cancel;
shutdown immediate
exit
EOF
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "success" || echo "failed"
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/oracle
;;
'restart')

prog="oracle dataguard"
echo -n $"Stopping $prog: "
$0 stop

prog="oracle dataguard"
echo -n $"Starting $prog: "
$0 start
;;
'status')

su - oracle -c "lsnrctl status"
su - oracle -c "sqlplus /nolog" << EOF
connect / as sysdba
select name,open_mode,PROTECTION_MODE,DATABASE_ROLE from v\$database;
select process,status from v\$managed_standby;
exit
EOF
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
;;
esac

本文永久更新链接地址:

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文档

Oracle11gDataGuard自动启动服务

Oracle11gDataGuard自动启动服务:Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:oracledg #!/bin/bash #chkconfig: 2345 98 Oracle 11g DataGuard自动启动服务 只为了做的更好Just to do better script name:o
推荐度:
标签: 开启 运行 oracle
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top