热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

通过Oracle逻辑DG实现数据库滚动升级

通过Oracle逻辑DG实现数据库滚动升级系统环境:操作系统:RedHatEL5Oracle:Oracle10gR2对于Oracle数据库的升级,一般需要长时间shutdowndatabase;升级的时间会

通过Oracle逻辑DG实现数据库滚动升级系统环境:操作系统:RedHatEL5Oracle:Oracle10gR2对于Oracle数据库的升级,一般需要长时间shutdowndatabase;升级的时间会

三、主备库Switchover

注意:对于升级完成的备库,以下参数不能修改(全部升级完成后再修改)

升级后的版本:

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod

PL/SQL Release 10.2.0.4.0 - Production

CORE 10.2.0.4.0 Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

如果修改后,在做switchover时会出现以下错误:

wKioL1NM43zTjTbTAAQgGx0bdFM097.jpg

switchover 前准备:

查看主备库是否同步:

主库:

14:38:08 SYS@ test1>select count(*) from scott.emp1;

COUNT(*)

----------

33

Elapsed: 00:00:00.00

14:38:13 SYS@ test1>alter system switch logfile;

System altered.

Elapsed: 00:00:05.03

14:38:22 SYS@ test1>select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

TEST1 PRIMARY MAXIMUM PERFORMANCE TO STANDBY

Elapsed: 00:00:00.13

14:40:27 SYS@ test1>

备库:

SQL> alter database start logical standby apply immediate;

Database altered.

SQL> show parameter comp

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

compatible string 10.2.0

nls_comp string

plsql_compiler_flags string INTERPRETED, NON_DEBUG

plsql_v2_compatibility boolean FALSE

SQL> select count(*) from scott.emp1;

COUNT(*)

----------

30

SQL> /

COUNT(*)

----------

33

SQL> select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

SHDB LOGICAL STANDBY MAXIMUM PERFORMANCE NOT ALLOWED

备库切换前准备:

SQL> alter database prepare to switchover to primary;

Database altered.

SQL> select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

SHDB LOGICAL STANDBY MAXIMUM PERFORMANCE PREPARING SWITCHOVER

SQL>

主库切换前准备:

14:40:27 SYS@ test1>alter database prepare to switchover to logical standby;

Database altered.

Elapsed: 00:00:00.04

14:42:06 SYS@ test1>select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

TEST1 PRIMARY MAXIMUM PERFORMANCE PREPARING SWITCHOVER

Elapsed: 00:00:00.00


在备库做prepare switchover 后,主库状态:


14:42:11 SYS@ test1>/

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

TEST1 PRIMARY MAXIMUM PERFORMANCE TO LOGICAL STANDBY

Elapsed: 00:00:00.01

14:43:38 SYS@ test1>

主库切换:

14:43:38 SYS@ test1>alter database commit to switchover to logical standby;

Database altered.

Elapsed: 00:00:31.50

14:45:01 SYS@ test1>

14:45:01 SYS@ test1>select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

TEST1 LOGICAL STANDBY MAXIMUM PERFORMANCE NOT ALLOWED

切换过程主库告警日志:

ALTER DATABASE COMMIT TO SWITCHOVER TO LOGICAL STANDBY (test1)

Tue Apr 15 14:44:30 2014

LOGSTDBY: Ensuring no active hot backups.

LOGSTDBY: Disabling job queue processes.

LOGSTDBY: Enabling database guard to prevent new transactions.

Tue Apr 15 14:44:30 2014

Waiting for transactions in flight at scn 0x0000.0004ebee to complete

LNS1 started with pid=16, OS id=3161

Tue Apr 15 14:44:37 2014

Thread 1 advanced to log sequence 69

Current log# 3 seq# 69 mem# 0: /u01/app/oracle/oradata/test1/redo03a.log

Tue Apr 15 14:44:37 2014

ARCH: LGWR is actively archiving destination LOG_ARCHIVE_DEST_2

ARCH: Standby redo logfile selected for thread 1 sequence 68 for destination LOG_ARCHIVE_DEST_2

Tue Apr 15 14:44:37 2014

LOGSTDBY: Waiting for pending archivals to dest [2].

Tue Apr 15 14:44:37 2014

LNS: Standby redo logfile selected for thread 1 sequence 69 for destination LOG_ARCHIVE_DEST_2

LNS1 started with pid=16, OS id=3163

Tue Apr 15 14:44:43 2014

ARCH: LGWR is actively archiving destination LOG_ARCHIVE_DEST_2

Tue Apr 15 14:44:43 2014

Thread 1 advanced to log sequence 70

Current log# 1 seq# 70 mem# 0: /u01/app/oracle/oradata/test1/redo01a.log

Tue Apr 15 14:44:43 2014

ARCH: Standby redo logfile selected for thread 1 sequence 69 for destination LOG_ARCHIVE_DEST_2

LOGSTDBY: Verifying receipt of EOR logfile on log archive destination [2].

Tue Apr 15 14:44:43 2014

LOGSTDBY: Verified EOR logfile archival to dest [2].

Tue Apr 15 14:44:44 2014

LNS: Standby redo logfile selected for thread 1 sequence 70 for destination LOG_ARCHIVE_DEST_2

Tue Apr 15 14:44:55 2014

Thread 1 cannot allocate new log, sequence 71

Checkpoint not complete

Current log# 1 seq# 70 mem# 0: /u01/app/oracle/oradata/test1/redo01a.log

LNS1 started with pid=16, OS id=3166

Tue Apr 15 14:45:01 2014

Shutting down archive processes

Tue Apr 15 14:45:01 2014

Thread 1 advanced to log sequence 71

Current log# 2 seq# 71 mem# 0: /u01/app/oracle/oradata/test1/redo02a.log

Tue Apr 15 14:45:01 2014

LOGSTDBY: Switchover complete (test1)

Tue Apr 15 14:45:01 2014

Completed: alter database commit to switchover to logical standby

Tue Apr 15 14:45:02 2014

LNS: Standby redo logfile selected for thread 1 sequence 71 for destination LOG_ARCHIVE_DEST_2

Tue Apr 15 14:45:06 2014

ARCH shutting down

ARC3: Archival stopped

备库切换过程告警日志:

RFS[1]: Possible network disconnect with primary database

Tue Apr 15 14:44:37 2014

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[4]: Assigned to RFS process 3189

RFS[4]: Identified database type as 'logical standby'

Tue Apr 15 14:44:37 2014

RFS LogMiner: Client enabled and ready for notification

RFS[4]: Successfully opened standby log 5: '/u01/app/oracle/oradata/sh/std_redo05a.log'

Tue Apr 15 14:44:37 2014

RFS LogMiner: Client enabled and ready for notification

Tue Apr 15 14:44:37 2014

LOGMINER: Archived logfile found, transition to mining logfile: /u01/arch_sh1arch_1_68_797856158.log

Tue Apr 15 14:44:37 2014

RFS LogMiner: Registered logfile [/u01/arch_sh1arch_1_68_797856158.log] to LogMiner session id [21]

Tue Apr 15 14:44:37 2014

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[5]: Assigned to RFS process 3191

RFS[5]: Identified database type as 'logical standby'

Tue Apr 15 14:44:37 2014

RFS LogMiner: Client enabled and ready for notification

RFS[5]: Successfully opened standby log 4: '/u01/app/oracle/oradata/sh/std_redo04a.log'

RFS[5]: Possible network disconnect with primary database

Tue Apr 15 14:44:37 2014

LOGMINER: End mining logfile: /u01/arch_sh1arch_1_68_797856158.log

Tue Apr 15 14:44:37 2014

LOGMINER: Log Auto Delete - deleting: /u01/arch_sh1arch_1_67_797856158.log

Deleted file /u01/arch_sh1arch_1_67_797856158.log

Tue Apr 15 14:44:43 2014

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[6]: Assigned to RFS process 3193

RFS[6]: Identified database type as 'logical standby'

Tue Apr 15 14:44:43 2014

RFS LogMiner: Client enabled and ready for notification

RFS[6]: Successfully opened standby log 4: '/u01/app/oracle/oradata/sh/std_redo04a.log'

Tue Apr 15 14:44:43 2014

RFS LogMiner: Client enabled and ready for notification

Tue Apr 15 14:44:43 2014

LOGMINER: Begin mining logfile for session 21 thread 1 sequence 69, /u01/app/oracle/oradata/sh/std_redo04a.log

Tue Apr 15 14:44:43 2014

LOGMINER: End mining logfile: /u01/app/oracle/oradata/sh/std_redo04a.log

Tue Apr 15 14:44:43 2014

RFS LogMiner: Registered logfile [/u01/arch_sh1arch_1_69_797856158.log] to LogMiner session id [21]

Tue Apr 15 14:44:43 2014

LOGSTDBY: Shutdown acknowledged

LOGSTDBY Analyzer process P003 pid=27 OS id=3153 stopped

LOGSTDBY Apply process P004 pid=28 OS id=3155 stopped

LOGSTDBY Apply process P005 pid=29 OS id=3157 stopped

LOGSTDBY Apply process P006 pid=30 OS id=3159 stopped

LOGSTDBY Apply process P007 pid=31 OS id=3161 stopped

LOGSTDBY Apply process P008 pid=32 OS id=3163 stopped

Tue Apr 15 14:44:44 2014

LOGMINER: Log Auto Delete - deleting: /u01/arch_sh1arch_1_68_797856158.log

Deleted file /u01/arch_sh1arch_1_68_797856158.log

Tue Apr 15 14:44:44 2014

LOGSTDBY status: ORA-16257: Switchover initiated stop apply successfully completed

Tue Apr 15 14:44:44 2014

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[7]: Assigned to RFS process 3195

RFS[7]: Identified database type as 'logical standby'

Primary database is in MAXIMUM PERFORMANCE mode

Tue Apr 15 14:44:44 2014

RFS LogMiner: Client enabled and ready for notification

Primary database is in MAXIMUM PERFORMANCE mode

RFS[7]: Successfully opened standby log 4: '/u01/app/oracle/oradata/sh/std_redo04a.log'

RFS[7]: Possible network disconnect with primary database

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[8]: Assigned to RFS process 3197

RFS[8]: Identified database type as 'logical standby'

Primary database is in MAXIMUM PERFORMANCE mode

Tue Apr 15 14:45:02 2014

RFS LogMiner: Client enabled and ready for notification

Primary database is in MAXIMUM PERFORMANCE mode

RFS[8]: Successfully opened standby log 5: '/u01/app/oracle/oradata/sh/std_redo05a.log'

主库切换完成后,备库状态:

SQL> select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

SHDB LOGICAL STANDBY MAXIMUM PERFORMANCE PREPARING SWITCHOVER

SQL> /

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

SHDB LOGICAL STANDBY MAXIMUM PERFORMANCE TO PRIMARY

SQL>


备库切换:

SQL> alter database commit to switchover to primary;

Database altered.

SQL> select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

SHDB PRIMARY MAXIMUM PERFORMANCE SESSIONS ACTIVE

SQL>


备库切换过程告警日志:

ALTER DATABASE SWITCHOVER TO PRIMARY (sh)

Tue Apr 15 14:48:31 2014

RFS LogMiner: Client enabled and ready for notification

Tue Apr 15 14:48:31 2014

LOGMINER: WARNING: registered partial log file /u01/arch_sh1arch_1_70_797856158.log

Tue Apr 15 14:48:31 2014

RFS LogMiner: Registered logfile [/u01/arch_sh1arch_1_70_797856158.log] to LogMiner session id [21]

LOGSTDBY Event: Starting SCN of new stream from seeded lockdown [0x0000.00071f8b]

LOGSTDBY Event: Successful close of the current log stream:

LOGSTDBY Event: primary: [1174898526]

LOGSTDBY Event: first scn: [0x0000.00046d38]

LOGSTDBY Event: end scn: [0x0000.0004ebf8]

LOGSTDBY Event: processed scn: [0x0000.0004ebf9]

LNS1 started with pid=20, OS id=3209

Tue Apr 15 14:48:34 2014

ARCH: LGWR is scheduled to archive destination LOG_ARCHIVE_DEST_2 after log switch

Tue Apr 15 14:48:34 2014

ARC0: STARTING ARCH PROCESSES

Tue Apr 15 14:48:34 2014

Thread 1 advanced to log sequence 30 (LGWR switch)

Current log# 3 seq# 30 mem# 0: /u01/app/oracle/oradata/sh/redo03a.log

Tue Apr 15 14:48:34 2014

ARC3: Archival started

ARC0: STARTING ARCH PROCESSES COMPLETE

ARC3 started with pid=20, OS id=3211

Tue Apr 15 14:49:24 2014

ARCH: Standby redo logfile selected for thread 1 sequence 29 for destination LOG_ARCHIVE_DEST_2

Completed: alter database commit to switchover to primary

Tue Apr 15 14:49:28 2014

Starting background process CJQ0

CJQ0 started with pid=23, OS id=3215

主库日志:

RFS[4]: Assigned to RFS process 3177

RFS[4]: Identified database type as 'logical standby'

Tue Apr 15 14:48:34 2014

RFS LogMiner: Client enabled and ready for notification

Tue Apr 15 14:49:24 2014

RFS[4]: Successfully opened standby log 4: '/u01/app/oracle/oradata/test1/std_redo04a.log'

Tue Apr 15 14:49:25 2014

RFS LogMiner: Client enabled and ready for notification

Tue Apr 15 14:49:29 2014

RFS LogMiner: Registered logfile [/disk1/arch_test1/arch_1_29_844857742.log] to LogMiner session id [21]


四、switchover 成功后,升级原主库:


原主库:

14:47:27 SYS@ test1>select name,database_role,protection_mode,switchover_status from v$database;

NAME DATABASE_ROLE PROTECTION_MODE SWITCHOVER_STATUS

--------- ---------------- -------------------- --------------------

TEST1 LOGICAL STANDBY MAXIMUM PERFORMANCE NOT ALLOWED

Elapsed: 00:00:00.00

数据库版本:

14:54:26 SYS@ test1>select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

原备库数据库版本:

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod

PL/SQL Release 10.2.0.4.0 - Production

CORE 10.2.0.4.0 Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production


@原主库的升级,本案例就不在重复讲述,切换成功后,,滚动升级应该到此已成功!


本文出自 “天涯客的blog” 博客,请务必保留此出处

推荐阅读
  • Hadoop入门与核心组件详解
    本文详细介绍了Hadoop的基础知识及其核心组件,包括HDFS、MapReduce和YARN。通过本文,读者可以全面了解Hadoop的生态系统及应用场景。 ... [详细]
  • MySQL缓存机制深度解析
    本文详细探讨了MySQL的缓存机制,包括主从复制、读写分离以及缓存同步策略等内容。通过理解这些概念和技术,读者可以更好地优化数据库性能。 ... [详细]
  • MySQL 数据库迁移指南:从本地到远程及磁盘间迁移
    本文详细介绍了如何在不同场景下进行 MySQL 数据库的迁移,包括从一个硬盘迁移到另一个硬盘、从一台计算机迁移到另一台计算机,以及解决迁移过程中可能遇到的问题。 ... [详细]
  • 本文由瀚高PG实验室撰写,详细介绍了如何在PostgreSQL中创建、管理和删除模式。文章涵盖了创建模式的基本命令、public模式的特性、权限设置以及通过角色对象简化操作的方法。 ... [详细]
  • 基于KVM的SRIOV直通配置及性能测试
    SRIOV介绍、VF直通配置,以及包转发率性能测试小慢哥的原创文章,欢迎转载目录?1.SRIOV介绍?2.环境说明?3.开启SRIOV?4.生成VF?5.VF ... [详细]
  • 深入探讨CPU虚拟化与KVM内存管理
    本文详细介绍了现代服务器架构中的CPU虚拟化技术,包括SMP、NUMA和MPP三种多处理器结构,并深入探讨了KVM的内存虚拟化机制。通过对比不同架构的特点和应用场景,帮助读者理解如何选择最适合的架构以优化性能。 ... [详细]
  • 本文详细介绍了Python编程语言的学习路径,涵盖基础语法、常用组件、开发工具、数据库管理、Web服务开发、大数据分析、人工智能、爬虫开发及办公自动化等多个方向。通过系统化的学习计划,帮助初学者快速掌握Python的核心技能。 ... [详细]
  • 作者:守望者1028链接:https:www.nowcoder.comdiscuss55353来源:牛客网面试高频题:校招过程中参考过牛客诸位大佬的面经,但是具体哪一块是参考谁的我 ... [详细]
  • PostgreSQL 10 离线安装指南
    本文详细介绍了如何在无法联网的服务器上进行 PostgreSQL 10 的离线安装,并涵盖了从下载安装包到配置远程访问的完整步骤。 ... [详细]
  • 本文详细介绍了美国最具影响力的十大财团,包括洛克菲勒、摩根、花旗银行等。这些财团在历史发展过程中逐渐形成,并对美国的经济、政治和社会产生深远影响。 ... [详细]
  • MySQL索引详解与优化
    本文深入探讨了MySQL中的索引机制,包括索引的基本概念、优势与劣势、分类及其实现原理,并详细介绍了索引的使用场景和优化技巧。通过具体示例,帮助读者更好地理解和应用索引以提升数据库性能。 ... [详细]
  • 解决JAX-WS动态客户端工厂弃用问题并迁移到XFire
    在处理Java项目中的JAR包冲突时,我们遇到了JaxWsDynamicClientFactory被弃用的问题,并成功将其迁移到org.codehaus.xfire.client。本文详细介绍了这一过程及解决方案。 ... [详细]
  • 本题通过将每个矩形视为一个节点,根据其相对位置构建拓扑图,并利用深度优先搜索(DFS)或状态压缩动态规划(DP)求解最小涂色次数。本文详细解析了该问题的建模思路与算法实现。 ... [详细]
  • 本题探讨如何通过最大流算法解决农场排水系统的设计问题。题目要求计算从水源点到汇合点的最大水流速率,使用经典的EK(Edmonds-Karp)和Dinic算法进行求解。 ... [详细]
  • 在网页开发中,页面加载速度是一个关键的用户体验因素。为了提升加载效率,避免在PageLoad事件中进行大量数据绑定操作,可以采用异步加载和特定控件来优化页面加载过程。 ... [详细]
author-avatar
翁向军_943
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有