Oracle 11g R2 ADG 运维

--================ Oracle ADG 运维 ================

--========测试日志传输========

1.在primary上,查看最后归档的日志,强制日志切换

ALTER SESSION SET nls_date_format=‘DD-MON-YYYY HH24:MI:SS‘;

SELECT sequence#, first_time, next_time
FROM?? v$archived_log
ORDER BY sequence#;

ALTER SYSTEM SWITCH LOGFILE;

2.在standby上,查看新归档的日志已经到达standby,并应用。

ALTER SESSION SET nls_date_format=‘DD-MON-YYYY HH24:MI:SS‘;

SELECT sequence#, first_time, next_time, applied
FROM?? v$archived_log
ORDER BY sequence#;

--=========保护模式==========

primary database有三种保护模式:
???? 【Maximum availability】
???? Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If no standby location is available, it acts in the same manner as maximum performance mode until a standby becomes available again.

??? 【Maximum Performance】
???? Transactions on the primary commit as soon as redo information has been written to the online redo log. Transfer of redo information to the standby server is asynchronous, so it does not impact on performance of the primary.

??? 【Maximum Protection】
???? Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If not suitable standby location is available, the primary database shuts down.

默认,对于一个新创建的standby database,primary database是maximum performance模式。
select protection_mode from v$database;

可以使用以下命令切换。

-- Maximum Availability.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY;

-- Maximum Performance.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;

-- Maximum Protection.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=‘SERVICE=sicilybak AFFIRM SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak‘;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION;
ALTER DATABASE OPEN;

--========Switchover========

primary和standby切换角色,而不丢失数据或者reset of redo logs。

--在primary上执行以下命令

-- Convert primary database to standby
CONNECT / AS SYSDBA
ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY;

-- Shutdown primary database
SHUTDOWN IMMEDIATE;

-- Mount old primary database as standby database
STARTUP NOMOUNT;
ALTER DATABASE MOUNT STANDBY DATABASE;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

--在standby上执行以下命令

-- Convert standby database to primary
CONNECT / AS SYSDBA
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

-- Shutdown standby database
SHUTDOWN IMMEDIATE;

-- Open old standby database as primary
STARTUP;

完成后,像之前一样测试日志传输。如果都工作正常,可实施另一个switchover,也叫做switchback,将primary database切换回原来服务器。

--============Failover=============

如果primary database不可用,standby database可以使用如下语句激活为primary。
## alter database recover managed standby database finish force;
## alter database commit to switchover to primary;
## alter database open;

-- Note:Oracle Corporation recommends that you perform a failover operation
-- using the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement
-- with the FINISH or FINISH SKIP keywords rather than a forced failover operation whenever possible.
-- A forced failover operation renders other standby databases that
-- are not participating in the failover operation
-- unusable as standby databases to the newly activated primary database.
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

-- This statement performs a forced failover operation,
-- in which the primary database is removed from the Data Guard environment and
-- a standby database assumes the primary database role.
-- The standby database must be mounted before it can be activated with this statement.
ALTER DATABASE ACTIVATE STANDBY DATABASE;

因为standby database现在是primary database,应该立即备份。

原来的primary database等故障恢复后,可以配置为standby。

--===========DG Gap手动同步=============

select process,sequence#,status from v$managed_standby;
select * from v$archive_gap;
select sequence#,applied from v$archived_log order by sequence#;
select name from v$archived_log where thread#=1 and dest_id=1 and sequence# between 7 and 10;

scp *4* oracl[email protected]:/data/ora11g/archivelog

--单个文件注册
alter database register logfile ‘/data/ora11g/archivelog/arch_1_41_830282966.log‘;

select max(sequence#) from v$archived_log;

--多个文件注册
scp gap* [email protected]:/data/ora11g/archivelog/
rman target /
catalog start with ‘/data/ora11g/archivelog/‘;

原文地址:http://blog.51cto.com/ultrasql/2148893

时间: 2024-10-07 21:43:09

Oracle 11g R2 ADG 运维的相关文章

Oracle 11g R2 ADG 搭建

--============Oracle ADG搭建============== --==========准备阶段========= 1.检查primary为archivelog模式.select log_mode from v$database; 如果为noarchivelog模式,切换到archivelog模式.shutdown immediate;startup mount;alter database archivelog;alter database open; 执行forced lo

Oracle 11g R2 Rman、数据泵、闪回备份与恢复

Oracle 11g R2 Rman备份备份与恢复的定义及分类 备份的定义及分类: 备份就是把数据库复制到转储设备的过程.其中,转储设备是指用于放置数据库副本的磁带或磁盘.通常也将存放于转储设备中的数据库的副本称为原数据库的备份或转储.备份是一份数据副本,从不同的角度分类如下: 从物理与逻辑的角度来分类: 从物理与逻辑的,备份可以分为物理备份和逻辑备份. 物理备份:对数据库操作系统的物理文件(数据文件,控制文件和日志文件)的备份.物理备份又可以分为脱机备份(冷备份)和联机备份(热备份),前者是在

Oracle 11g R2 备份与恢复

Oracle 11g R2 Rman备份 1. 备份与恢复的定义及分类 备份的定义及分类: 备份就是把数据库复制到转储设备的过程.其中,转储设备是指用于放置数据库副本的磁带或磁盘.通常也将存放于转储设备中的数据库的副本称为原数据库的备份或转储.备份是一份数据副本,从不同的角度分类如下: 从物理与逻辑的角度来分类: 从物理与逻辑的,备份可以分为物理备份和逻辑备份. 物理备份:对数据库操作系统的物理文件(数据文件,控制文件和日志文件)的备份.物理备份又可以分为脱机备份(冷备份)和联机备份(热备份),

Oracle 11g R2 for Win7旗舰版(64位)的安装步骤

数据库有好多版本,我应该学习哪个? 万物一理,数据库的版本虽然多,本质是一样的,变化的只是表象,你是oracle7的专家,一定也是oracle11g的专家.Oracle数据库越来越受欢迎,下面介绍一下Oracle 11g R2 for Win7旗舰版(64位)的安装步骤: 1. 下载Oracle 11g R2 for Windows的版本 下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/in

CentOS6安装 Oracle 11g R2

选型:32位的内存是个瓶颈,已经是64位的时代了.使用64位的CentOS6 和 64位的Oracle 11g R2在虚拟机器安装,采用hostonly方式设置网络注意:能上网的网卡要设置一下ICS(Internet连接共享)给VMware Network Adapter VMnet1这样对于虚拟机,网关是192.168.137.1,IP地址请也要设置在192.168.137.0/24段硬盘40G,内存2G 1.下载软件1.1.CentOS 6(x86_64)http://mirrors.163

Oracle 11g R2安装手册(图文教程)For Windows

1.Oracle 11g R2安装手册(图文教程)For Windows 1.下载Oracle 11g R2 for Windows版本,下载地址如下 官方网站: http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_database_1of2.zip http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_database_2of2.zip 2.解压两个

oracle 11g R2 标准版 64位linux安装

安装环境: Redhat es 5.5 64位 ,系统内存8G,swap 10G ,oracle 11G R2 标准版 一,Oracle 安装前的准备 检查一下包,必须全部安装: binutils-2.17.50.0.6 compat-libstdc++-33-3.2.3 compat-libstdc++-33-3.2.3 (32 bit) elfutils-libelf-0.125 elfutils-libelf-devel-0.125 gcc-4.1.1 gcc-c++-4.1.1 glib

oracle 11g R2 64位 安装详细步骤

(oracle 11g R2 64位 + PLSQLDeveloper安装说明以及PLSQL Developer+ ORCALE11-instantclient-basic-win32-11.2.0.1.0连接oracle 11g R2 64位详细步骤) 第一步: 准备工具 1.oracle 11g R2 64位安装包 2.PLSQL Developer v11.0.2.1766 官方中文版(内含PLSQL Developer安装程序.汉化程序.PLSQL Developer注册程序.PLSQL

oracle 11g r2 rac ssh两节点互信对等配置Permission denied (publickey,gssapi-with-mic,password)

问题:安装oracle 11g r2 RAC grid 时,配置两节点ssh互信对等配置不成功,具体错误信息如下: ------------------------------------------------------------------------ Verifying SSH connectivity has been setup from rac1 to rac1 -----------------------------------------------------------