文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

Oracle DG主备启动和关闭流程

2024-04-02 19:55

关注

环境:

Oracle 11g RAC和DG


关闭操作流程

RAC节点:

关闭primary主机:

SQL>shutdown immediate

无法shutdown immediate

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup restrict;

ORACLE instance started.

SQL> shutdown

Database closed.

Database dismounted.

ORACLE instance shut down.


关闭standby主机:

SQL>alter database recover managed standby database cancel;

SQL>shutdown immediate


开启操作流程

开启standby主机:


SQL> startup mount;
ORACLE instance started.

Total System Global Area 1.7103E+10 bytes
Fixed Size                  2245480 bytes
Variable Size            2181041304 bytes
Database Buffers         1.4898E+10 bytes
Redo Buffers               21708800 bytes
Database mounted.
SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;

RECOVERY_MODE
-----------------------
IDLE
IDLE
IDLE

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.
开启primary主机:
primary主机是RAC,会自动拉起来。
primary主机RAC一切正常。

发现standby主机监听不正常:
重启监听。
[oracle@dg ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:16


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused


[oracle@dg ~]$ lsnrctl stop


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:37


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@dg ~]$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:12:44


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...


TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                11-DEC-2017 15:12:45
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@dg ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-DEC-2017 15:13:29


Copyright (c) 1991, 2011, Oracle.  All rights reserved.


Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                11-DEC-2017 15:12:45
Uptime                    0 days 0 hr. 0 min. 44 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/dg/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg)(PORT=1521)))
Services Summary...
Service "DG" has 1 instance(s).
  Instance "DG", status READY, has 1 handler(s) for this service...
The command completed successfully

开启standby主机的只读功能:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; 


Database altered.


SQL> alter database open read only;


Database altered.


SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;


RECOVERY_MODE
-----------------------
IDLE
IDLE
IDLE
IDLE


SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


Database altered.


SQL> select RECOVERY_MODE from v$archive_dest_status where rownum<5;


RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY
IDLE
IDLE
IDLE

主备的alert日志正常:
RAC01  alert日志:
Thread 1 advanced to log sequence 35614 (LGWR switch)
  Current log# 2 seq# 35614 mem# 0: +DATA/prd/onlinelog/group_2.257.929893623
Mon Dec 11 15:50:16 2017
LNS: Standby redo logfile selected for thread 1 sequence 35614 for destination LOG_ARCHIVE_DEST_2
Mon Dec 11 15:50:16 2017
Archived Log entry 94045 added for thread 1 sequence 35613 ID 0x35485ff1 dest 1:

RAC02  alert日志:
Thread 2 advanced to log sequence 18461 (LGWR switch)
  Current log# 3 seq# 18461 mem# 0: +DATA/prd/onlinelog/group_3.261.929893729
Mon Dec 11 15:32:10 2017
LNS: Standby redo logfile selected for thread 2 sequence 18461 for destination LOG_ARCHIVE_DEST_2
Mon Dec 11 15:32:11 2017
Archived Log entry 94043 added for thread 2 sequence 18460 ID 0x35485ff1 dest 1:


DG  alert日志:
Media Recovery Waiting for thread 2 sequence 18461 (in transit)
Recovery of Online Redo Log: Thread 2 Group 8 Seq 18461 Reading mem 0
  Mem# 0: /oracle/oradata/standby08.log
Mon Dec 11 15:50:16 2017
RFS[4]: Selected log 6 for thread 1 sequence 35614 dbid 893924085 branch 929893623
Mon Dec 11 15:50:16 2017
Media Recovery Waiting for thread 1 sequence 35614 (in transit)
Recovery of Online Redo Log: Thread 1 Group 6 Seq 35614 Reading mem 0
  Mem# 0: /oracle/oradata/standby06.log
Mon Dec 11 15:51:44 2017
Archived Log entry 40467 added for thread 1 sequence 35613 ID 0x35485ff1 dest 1:


如果通过重启监听无法解决DG节点的监听问题,可以通过动态注册监听来解决

alter system register









阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯