逻辑DG之Standby角色转换

WBOY
풀어 주다: 2016-06-07 15:54:10
원래의
991명이 탐색했습니다.

Primary: 1.检查当前Primary数据库的初始化参数: SQL show parameter fal NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ fal_client string orcl_192.168.1.222 fal_server string orcls_192.168.1.2

Primary:
1.检查当前Primary数据库的初始化参数:
SQL> show parameter fal

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fal_client string orcl_192.168.1.222
fal_server string orcls_192.168.1.223
SQL> show parameter log_archive_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------

log_archive_dest_1 string location=/u01/arch_orcl

log_archive_dest_2 string service=orcls_192.168.1.223 lg
wr async valid_for=(online_log
files, primary_role) db_unique
_name=orclldg
2.修改log_archive_dest_1
SQL> alter system set log_archive_dest_1='location=/u01/arch_orcl valid_for=(online_logfiles,all_roles) db_unique_name=orclpre';

System altered.
Standby:
1.检查当前Standby数据库的初始化参数:
SQL> show parameter log_archive_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string location=/u01/arch_ldg valid_f
or=(online_logfiles,all_roles)
db_unique_name=orclldg
log_archive_dest_10 string
log_archive_dest_2 string service=orcl_192.168.1.222 arc
h valid_for=(online_logfiles,
primary_role) db_unique_name=o
rclpre
log_archive_dest_3 string location=/u01/arch_std valid_f
or=(standby_logfiles,standby_r
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
ole) db_unique_name=orclldg
2.修改log_archive_dest_2为lgwr async
SQL> alter system set log_archive_dest_2='service=orcl_192.168.1.222 lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=orclpre';

System altered.
3.log_archive_dest_2已经为异步传输
SQL> show parameter archive_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string location=/u01/arch_ldg valid_f
or=(online_logfiles,all_roles)
db_unique_name=orclldg
log_archive_dest_10 string
log_archive_dest_2 string service=orcl_192.168.1.222 lgw
r async valid_for=(online_logf
iles,primary_role) db_unique_n
ame=orclpre
log_archive_dest_3 string location=/u01/arch_std valid_f
or=(standby_logfiles,standby_r

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
ole) db_unique_name=orclldg
4.检查Primary是否配置了Standby Redologs
SQL> select * from v$standby_log;

no rows selected
添加:
SQL> alter database add standby logfile group 4 '/u01/app/oracle/oradata/orcl/stdredo01.log' SIZE 50m;

Database altered.

SQL> alter database add standby logfile group 5 '/u01/app/oracle/oradata/orcl/stdredo02.log' SIZE 50m;

Database altered.

SQL> alter database add standby logfile group 6 '/u01/app/oracle/oradata/orcl/stdredo03.log' SIZE 50m;

Database altered.
5.检查当前Primary数据库状态:
SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
把Primary置为准备转换状态:
SQL> alter database prepare to switchover to logical standby;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
再次查看状态变为准备中……,时刻准备着接受来自逻辑Standby数据库(未来新的Primary数据库)发来的REDO数据。
6.把当前的逻辑Standby转换为Primary
SQL> alter database prepare to switchover to primary;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
再次查看状态变为准备中……
7.查看Primary数据库
SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO LOGICAL STANDBY
此次检查结果关系到switchover转换是否能够成功。
8.把当前的Primary转换成逻辑Standby
SQL> alter database commit to switchover to logical standby;

Database altered.
9.逻辑Standby在接收到前Primary的转换消息,并完成相关的REDO数据之后,会自动暂停SQL应用。如果之前没有启动REDO应用,现在启动还不晚。
SQL> alter database start logical standby apply;

Database altered.

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER 等会……

SQL> select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY
10.转换逻辑Standby为新的Primary数据库
SQL> alter database commit to switchover to primary;

Database altered.
启动新的逻辑Standby(之前的Primary)SQL应用
SQL> alter database start logical standby apply immediate;

Database altered.
测试:
在新的Primary里面插入测试数据:
SQL> select * from scott.test;

ID
----------
1
2
3

SQL> insert into scott.test values(4);

1 row created.

SQL> commit;

Commit complete.

检查新的standby:
SQL> select * from scott.test;

ID
----------
1
2
3

SQL> select * from scott.test;

ID
----------
1
2
3

SQL> select * from scott.test;

ID
----------
1
2
3
可能会延迟……
SQL> select * from scott.test;

ID
----------
1
2
3
4
逻辑Standby角色转换成功……

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!