[20140422]使用dgmgrl管理dataguard(13)

简介: [20140422]使用dgmgrl管理dataguard(13).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.

[20140422]使用dgmgrl管理dataguard(13).txt

参考链接:
http://blog.itpub.net/267265/viewspace-1142649/
http://blog.itpub.net/267265/viewspace-1143027/
http://blog.itpub.net/267265/viewspace-1143058/
http://blog.itpub.net/267265/viewspace-1143126/
http://blog.itpub.net/267265/viewspace-1143480/
http://blog.itpub.net/267265/viewspace-1144742/
http://blog.itpub.net/267265/viewspace-1145573/
http://blog.itpub.net/267265/viewspace-1145697/
http://blog.itpub.net/267265/viewspace-1145727/
http://blog.itpub.net/267265/viewspace-1146558/
http://blog.itpub.net/267265/viewspace-1146575/
http://blog.itpub.net/267265/viewspace-1147481/

-- 我的测试环境:primary的tnsnames别名test,standby主机的tnsnames别名testdg。数据库版本:11GR2.
-- 今天做一个SNAPSHOT STANDBY的测试.

--有时候开发要做一些测试,测试环境要比较真实的反应生产系统的情况,使用备用库比较合适,但是11G下虽然打开apply read only模式,
--但是往往还包含一些dml语句,必须打开读写模式.这样要求转换备用库到SNAPSHOT STANDBY.完成后在转换回来.

DGMGRL> show configuration
Configuration - study

  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - (*) Physical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS

SYS@testdg> select database_role,open_mode,protection_mode,force_logging,FLASHBACK_ON from v$database;

DATABASE_ROLE    OPEN_MODE            PROTECTION_MODE      FOR FLASHBACK_ON
---------------- -------------------- -------------------- --- ------------------
PHYSICAL STANDBY READ ONLY WITH APPLY MAXIMUM PERFORMANCE  YES YES

--使用sqlplus要执行如下:SQL> ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;这个测试忽略,使用dgmgrl看看.

DGMGRL> convert database testdg to SNAPSHOT STANDBY;
Converting database "testdg" to a Snapshot Standby database, please wait...
Error: ORA-16668: operation cannot be performed on the fast-start failover target standby database

Failed.
Failed to convert database "testdg"
--不能打开fast-start failover.关闭fast-start failover,继续测试.

DGMGRL> disable fast_start failover ;
Disabled.
DGMGRL> show configuration

Configuration - study

  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS


DGMGRL> convert database testdg to SNAPSHOT STANDBY;
Converting database "testdg" to a Snapshot Standby database, please wait...
Database "testdg" converted successfully
--OK完成.


SYS@testdg> Select database_role,open_mode,protection_mode,force_logging,FLASHBACK_ON,resetlogs_change#,prior_resetlogs_change# from v$database;

DATABASE_ROLE    OPEN_MODE            PROTECTION_MODE      FOR FLASHBACK_ON       RESETLOGS_CHANGE# PRIOR_RESETLOGS_CHANGE#
---------------- -------------------- -------------------- --- ------------------ ----------------- -----------------------
SNAPSHOT STANDBY READ WRITE           MAXIMUM PERFORMANCE  YES YES                       3269794846              3269769399

--已经打开了读写模式.
SYS@testdg> select * from v$restore_point;
       SCN DATABASE_INCARNATION# GUA STORAGE_SIZE TIME                           RESTORE_PO PRE NAME
---------- --------------------- --- ------------ ------------------------------ ---------- --- --------------------------------------------------
3269794844                     8 YES     52428800 2014-04-23 09:46:06.000000000             YES SNAPSHOT_STANDBY_REQUIRED_04/23/2014 09:46:06

--数据库记录了转成SNAPSHOT STANDBY的scn.做一些DML操作.

SCOTT@testdg> select * from scott.dept1 where deptno=60;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        60 MMMM           DDDDDx

SCOTT@testdg> update SCOTT.dept1 set loc='EEEEEE' where deptno=60;
1 row updated.

SCOTT@testdg> commit ;
Commit complete.

--转换回来.使用sqlplus的命令是alter database convert to physical standby;这个测试忽略,使用dgmgrl看看.

DGMGRL> show configuration
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Snapshot standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

DGMGRL> convert database testdg to physical STANDBY;
Converting database "testdg" to a Physical Standby database, please wait...
Operation requires shutdown of instance "testdg" on database "testdg"
Shutting down instance "testdg"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "testdg" on database "testdg"
Starting instance "testdg"...
ORACLE instance started.
Database mounted.
Continuing to convert database "testdg" ...
Operation requires shutdown of instance "testdg" on database "testdg"
Shutting down instance "testdg"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "testdg" on database "testdg"
Starting instance "testdg"...
ORACLE instance started.
Database mounted.
Database "testdg" converted successfully

DGMGRL> show configuration

Configuration - study

  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS


--查看testdg的情况

SCOTT@testdg> Select database_role,open_mode,protection_mode,force_logging,FLASHBACK_ON,resetlogs_change#,prior_resetlogs_change# from v$database;
DATABASE_ROLE    OPEN_MODE            PROTECTION_MODE      FOR FLASHBACK_ON       RESETLOGS_CHANGE# PRIOR_RESETLOGS_CHANGE#
---------------- -------------------- -------------------- --- ------------------ ----------------- -----------------------
PHYSICAL STANDBY READ ONLY WITH APPLY MAXIMUM PERFORMANCE  YES YES                       3269769399              3269705600

SCOTT@testdg> select * from scott.dept1 where deptno=60;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        60 MMMM           DDDDDx

--可以发现dml的信息已经还原.

总结:
--做SNAPSHOT STANDBY,无论是sqlplus还是dgmgrl都是很简单的.命令如下:
ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;
alter database convert to physical standby;

convert database testdg to SNAPSHOT STANDBY;
convert database testdg to physical STANDBY;

目录
相关文章
|
21小时前
|
云安全 数据采集 人工智能
古茗联名引爆全网,阿里云三层防护助力对抗黑产
阿里云三层校验+风险识别,为古茗每一杯奶茶保驾护航!
古茗联名引爆全网,阿里云三层防护助力对抗黑产
|
4天前
|
Kubernetes 算法 Go
Kubeflow-Katib-架构学习指南
本指南带你深入 Kubeflow 核心组件 Katib,一个 Kubernetes 原生的自动化机器学习系统。从架构解析、代码结构到技能清单与学习路径,助你由浅入深掌握超参数调优与神经架构搜索,实现从使用到贡献的进阶之旅。
271 139
|
4天前
|
人工智能 中间件 API
AutoGen for .NET - 架构学习指南
《AutoGen for .NET 架构学习指南》系统解析微软多智能体框架,涵盖新旧双架构、核心设计、技术栈与实战路径,助你从入门到精通,构建分布式AI协同系统。
282 142
|
16天前
|
存储 关系型数据库 分布式数据库
PostgreSQL 18 发布,快来 PolarDB 尝鲜!
PostgreSQL 18 发布,PolarDB for PostgreSQL 全面兼容。新版本支持异步I/O、UUIDv7、虚拟生成列、逻辑复制增强及OAuth认证,显著提升性能与安全。PolarDB-PG 18 支持存算分离架构,融合海量弹性存储与极致计算性能,搭配丰富插件生态,为企业提供高效、稳定、灵活的云数据库解决方案,助力企业数字化转型如虎添翼!
|
11天前
|
缓存 并行计算 PyTorch
144_推理时延优化:Profiling与瓶颈分析 - 使用PyTorch Profiler诊断推理延迟,优化矩阵运算的独特瓶颈
在2025年的大模型时代,推理时延优化已经成为部署LLM服务的关键挑战之一。随着模型规模的不断扩大(从数亿参数到数千亿甚至万亿参数),即使在最先进的硬件上,推理延迟也常常成为用户体验和系统吞吐量的主要瓶颈。
356 147
|
5天前
|
人工智能 移动开发 自然语言处理
阿里云百炼产品月刊【2025年9月】
本月通义千问模型大升级,新增多模态、语音、视频生成等高性能模型,支持图文理解、端到端视频生成。官网改版上线全新体验中心,推出高代码应用与智能体多模态知识融合,RAG能力增强,助力企业高效部署AI应用。
274 1
|
11天前
|
机器学习/深度学习 存储 缓存
92_自我反思提示:输出迭代优化
在大型语言模型(LLM)应用日益普及的今天,如何持续提升模型输出质量成为了业界关注的核心问题。传统的提示工程方法往往依赖一次性输入输出,难以应对复杂任务中的多轮优化需求。2025年,自我反思提示技术(Self-Reflection Prompting)作为提示工程的前沿方向,正在改变我们与LLM交互的方式。这项技术通过模拟人类的自我反思认知过程,让模型能够对自身输出进行评估、反馈和优化,从而实现输出质量的持续提升。
418 136
|
14天前
|
存储 人工智能 搜索推荐
终身学习型智能体
当前人工智能前沿研究的一个重要方向:构建能够自主学习、调用工具、积累经验的小型智能体(Agent)。 我们可以称这种系统为“终身学习型智能体”或“自适应认知代理”。它的设计理念就是: 不靠庞大的内置知识取胜,而是依靠高效的推理能力 + 动态获取知识的能力 + 经验积累机制。
410 135
|
14天前
|
存储 人工智能 Java
AI 超级智能体全栈项目阶段二:Prompt 优化技巧与学术分析 AI 应用开发实现上下文联系多轮对话
本文讲解 Prompt 基本概念与 10 个优化技巧,结合学术分析 AI 应用的需求分析、设计方案,介绍 Spring AI 中 ChatClient 及 Advisors 的使用。
538 133
AI 超级智能体全栈项目阶段二:Prompt 优化技巧与学术分析 AI 应用开发实现上下文联系多轮对话