oracle数据库基于(streams流复制)的双机热备配置手册
-------------------------------------------------------------------------------
主数据库:
操作系统:windows 2012
IP地址:192.168.160.122
数据库:Oracle 11.2.0.2.0
ORACLE_SID:orcl
Global_name:orcl
从数据库:
操作系统:windows 2012
IP地址:192.168.160.123
数据库:Oracle 11.2.0.2.0
ORACLE_SID:orcl
Global_name:orcl
alter system set deferred_segment_creation=false scope=both;
alter system set sec_case_sensitive_logon=false scope=both;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
主数据库配置
archive log list;
select supplemental_log_data_min from v$database;
shutdown immediate;
startup mount;
alter database archivelog;
alter database add supplemental log data;
archive log list;
select supplemental_log_data_min from v$database;
alter database open;
设置参数
alter system set aq_tm_processes=2 scope=both;
alter system set global_names=true scope=both;
alter system set job_queue_processes=10 scope=both;
alter system set parallel_max_servers=20 scope=both;
alter system set undo_retention=3600 scope=both;
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
alter system set streams_pool_size=100M scope=spfile;
alter system set utl_file_dir='*' scope=spfile;
alter system set open_links=4 scope=spfile;
alter system set statistics_level='TYPICAL' scope=both;
alter system set utl_file_dir='*' scope=spfile;
alter system set "_job_queue_interval"=1 scope=spfile;
alter system set global_names=false scope=both;
shutdown immediate;
startup;
create user hytera identified by hytera account unlock;
grant connect to hytera;
grant RESOURCE to hytera;
grant dba to hytera;
--alter system set logmnr_max_persistent_sessions=1 scope=spfile;
create tablespace streams_tbs datafile 'D:\app\Administrator\oradata\orcl\streams_tbs.dbf' size 100M autoextend on maxsize unlimited;
create user strmadmin identified by strmadmin default tablespace streams_tbs account unlock quota unlimited on streams_tbs;
grant dba to strmadmin;
grant connect to strmadmin;
exec dbms_streams_auth.grant_admin_privilege('strmadmin');
begin
dbms_streams_auth.grant_admin_privilege(
grantee=>'strmadmin',
grant_privileges=>TRUE);
end;
/
tnsnames.ora
SZXTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.160.123)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
conn strmadmin/strmadmin;
create database link SZXTDB connect to strmadmin identified by strmadmin using 'SZXTDB';
创建Master流队列
#以strmadmin身份,登录主数据库。
connect strmadmin/strmadmin;
begin
dbms_streams_adm.set_up_queue(
queue_table => 'source_queue_table',--队列表
queue_name => 'source_queue',--队列
queue_user =>'strmadmin'); --队列用户
end;
/
select owner,queue_table,name from dba_queues where owner='STRMADMIN';
创建数据捕获进程,捕获redo的改变
connect strmadmin/strmadmin;
begin
dbms_streams_adm.add_schema_rules(
schema_name => 'hytera', --捕获用户名 非sys或者system
streams_type => 'capture',
streams_name => 'capture_stream',
queue_name => 'strmadmin.source_queue',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'ORCL',
inclusion_rule => true);
end;
/
select capture_name,queue_name,start_scn,status,capture_type from dba_capture;
在源数据库上创建传播进程 相当于ogg里面的datapump数据传递
传播进程需要对应捕获规则分别创建table/schema/global的传播进程。
connect strmadmin/strmadmin;
begin
dbms_streams_adm.add_schema_propagation_rules(
schema_name => 'hytera',
streams_name => 'source_to_target',
source_queue_name => 'strmadmin.SOURCE_QUEUE',
destination_queue_name => 'strmadmin.TARGET_QUEUE@szxtdb',
include_dml => true,
include_ddl => true,
source_database => 'ORCL',
inclusion_rule => true,
queue_to_queue => true);
end;
/
select propagation_name,status from all_propagation;
直接设置SCN的方式进行实例化
查询源端的scn号
select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER() FROM dual;
启动捕获进程 相当于OGG里面的ext1
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_stream');
END;
/
停止捕获进程
BEGIN
DBMS_CAPTURE_ADM.STOP_CAPTURE(
capture_name => 'capture_stream');
END;
/
查看捕获进程状态
select capture_name,status from dba_capture;
表示实时传播lcr实时复制
begin
dbms_aqadm.alter_propagation_schedule(
queue_name => 'strmadmin.SOURCE_QUEUE',
destination => 'szxtdb',
destination_queue => 'TARGET_QUEUE',
latency => 0);
end;
/
-------------------------------------------------------------------------------------------------------------------------
备数据库配置
archive log list;
select supplemental_log_data_min from v$database;
shutdown immediate;
startup mount;
alter database archivelog;
alter database add supplemental log data;
archive log list;
select supplemental_log_data_min from v$database;
alter database open;
设置参数
alter system set aq_tm_processes=2 scope=both;
alter system set global_names=true scope=both;
alter system set job_queue_processes=10 scope=both;
alter system set parallel_max_servers=20 scope=both;
alter system set undo_retention=3600 scope=both;
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
alter system set streams_pool_size=100M scope=spfile;
alter system set utl_file_dir='*' scope=spfile;
alter system set open_links=4 scope=spfile;
alter system set statistics_level='TYPICAL' scope=both;
alter system set utl_file_dir='*' scope=spfile;
alter system set "_job_queue_interval"=1 scope=spfile;
alter system set global_names=false scope=both;
shutdown immediate;
startup;
--alter system set logmnr_max_persistent_sessions=1 scope=spfile;
create user hytera identified by hytera account unlock;
grant connect to hytera;
grant RESOURCE to hytera;
grant dba to hytera;
create tablespace streams_tbs datafile 'D:\app\Administrator\oradata\orcl\streams_tbs.dbf' size 100M autoextend on maxsize unlimited;
create user strmadmin identified by strmadmin default tablespace streams_tbs account unlock quota unlimited on streams_tbs;
grant dba to strmadmin;
grant connect to strmadmin;
exec dbms_streams_auth.grant_admin_privilege('strmadmin');
begin
dbms_streams_auth.grant_admin_privilege(
grantee=>'strmadmin',
grant_privileges=>TRUE);
end;
/
tnsnames.ora
SZXTDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.160.122)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
conn strmadmin/strmadmin;
create database link SZXTDB connect to strmadmin identified by strmadmin using 'SZXTDB';
创建备库流队列
#以strmadmin身份,登录主数据库。
connect strmadmin/strmadmin;
begin
dbms_streams_adm.set_up_queue(
queue_table => 'target_queue_table',--队列表
queue_name => 'target_queue',--队列
queue_user =>'strmadmin'); --队列用户
end;
/
select owner,queue_table,name from dba_queues where owner='STRMADMIN';
目标端数据库上创建Apply队列应用进程 相当于OGG中的rep1进程
connect strmadmin/strmadmin;
begin
dbms_streams_adm.add_schema_rules(
schema_name => 'hytera', --捕获用户名 非sys或者system
streams_type => 'apply',
streams_name => 'target_apply_stream',
queue_name => 'strmadmin.TARGET_QUEUE',
include_dml => true,
include_ddl => true,
include_tagged_lcr => false,
source_database => 'ORCL',
inclusion_rule => true);
end;
/
select apply_name,queue_name,status from dba_apply;
设置成跟源端一致的SCN号
源端查
select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER() FROM dual;
conn strmadmin/strmadmin;
BEGIN
DBMS_APPLY_ADM.SET_SCHEMA_INSTANTIATION_SCN(
source_schema_name => 'hytera',
source_database_name => 'ORCL',
instantiation_scn => 1097715);
END;
/
启动目的端的Apply应用进程相当于启动OGG里面的rep1
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'target_apply_stream');
END;
/
停止apply
BEGIN
DBMS_APPLY_ADM.STOP_APPLY(
apply_name => 'target_apply_stream');
END;
/
查看apply进程状态
select apply_name,queue_name,status from dba_apply;
--------------------------------------------------------------
查看捕获进程状态
select capture_name,status from dba_capture;
查看apply进程状态
select apply_name,queue_name,status from dba_apply;
在源数据库上创建传播进程 相当于ogg里面的datapump数据传递
select propagation_name,status from all_propagation;
select capture_name,status from dba_capture;
select apply_name,queue_name,status from dba_apply;
select capture_name,status from dba_capture;
select error_message from DBA_APPLY_ERROR;
源端查询 抓取进程和应用进程的SCN号是否一致,流复制是基于redolog 的scn号的
select capture_name,queue_name,status,captured_scn,applied_scn from dba_capture;
查看应用进程是否有错误
select apply_name,error_number,apply_captured,status from dba_apply;
------------------------------------------------------------------------------
启动捕获进程 相当于OGG里面的ext1
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_stream');
END;
/
停止捕获进程
BEGIN
DBMS_CAPTURE_ADM.STOP_CAPTURE(
capture_name => 'capture_stream');
END;
/
启动目的端的Apply应用进程相当于启动OGG里面的rep1
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'target_apply_stream');
END;
/
停止apply
BEGIN
DBMS_APPLY_ADM.STOP_APPLY(
apply_name => 'target_apply_stream');
END;
/
--------------------------------------------------------------------------------
create tablespace hytera datafile 'D:\app\Administrator\oradata\orcl\hytera.dbf' size 100M autoextend on maxsize unlimited;
alter user hytera default tablespace hytera;
--------------------------------------------------------------------------------
配置双向流复制
源端执行
解决ORA-26687问题
SELECT * FROM DBA_CAPTURE_PREPARED_TABLES;
BEGIN
DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN (
source_object_name => 'hytera.t',
source_database_name => 'ORCL',
instantiation_scn => 1094239);
END;
/
select error_message from DBA_APPLY_ERROR;--流复制错误信息
PURGE recyclebin;
解决 ORA-00942 问题
BEGIN
DBMS_APPLY_ADM.SET_PARAMETER(
apply_name => 'target_apply_stream',
parameter => 'disable_on_error',
value => 'n');
END;
/
--------------------------------------------------------------------------------
drop user hytera cascade;
create user hytera identified by hytera account unlock default tablespace hytera;
grant connect to hytera;
grant RESOURCE to hytera;
grant dba to hytera;
oracle数据库基于(streams流复制)的双机热备配置手册的更多相关文章
- SQLServer 2005 数据库定阅复制实现双机热备(主要是sharepoint 内容数据库)
原文:SQLServer 2005 数据库定阅复制实现双机热备(主要是sharepoint 内容数据库) 场景 公司最近的sharepoint的数据库服务器老是出问题,并且在一旦出现问题,就导致无法正 ...
- CentOS系统MySQL双机热备配置
1 概述 在集成项目中需要应对不同环境下的安装配置,主流操作系统大致可以分为三种:Linux.Windows以及UNIX.其中Linux备受青睐的主要原因有两个: 首先,Linux作为自由软件有两个 ...
- Mysql双机热备配置(超详细多图版)
一.双击热备介绍 1.基本概念 双机热备特指基于高可用系统中的两台服务器的热备(或高可用),双机高可用按工作中的切换方式分为:主-备方式(Active-Standby方式)和双主机方式(Active- ...
- 基于防火墙的VRRP技术--华为防火墙双机热备--VGMP
目录 主备备份双机热备配置 负载分担双机热备配置 为了解决多个VRRP备份组状态不一致的问题,华为防火墙引入VGMP(VRRP Group Management Protocol)来实现对VRRP备份 ...
- windows下使用mysql双机热备功能
一. 准备工作 1. 准备两台服务器(电脑),接入局域网中,使互相ping得通对方 2. 两台服务器都安装mysql-server-5.1,必须保证mysql的版本一致 3. 假设,服务器A:192. ...
- mysql双机热备的实现
转:http://blog.csdn.net/qq394829044/article/details/53203645 Mysql数据库没有增量备份的机制,当数据量太大的时候备份是一个很大的问题.还好 ...
- (转)mysql双机热备的实现
mysql双机热备的实现 原文:http://www.zjian.me/web/php/mysql%E5%8F%8C%E6%9C%BA%E7%83%AD%E5%A4%87%E7%9A%84%E5%AE ...
- mysql 主从复制(mysql双机热备的实现)
转:http://blog.csdn.net/qq394829044/article/details/53203645 Mysql数据库没有增量备份的机制,当数据量太大的时候备份是一个很大的问题.还好 ...
- Centos7 Mysql主从双机热备的实战记录
操作系统:centos7 服务器:主:172.19.242.69 从:172.19.242.70 1. 服务器 由于Mysql不同版本之间的(二进制日志)binlog格式可能会不太一样,因此最好的 ...
随机推荐
- MSMQ使用
Message Message是MSMQ的数据存储单元,我们的用户数据一般也被填充在Message的body当中,因此很重要,让我们来看一看其在.net中的体现,如图: 在图上我们可以看见,Messa ...
- struts2 404错误
action类必须放在xxxx.xxx.xxx.xxx.action 包下才可以.
- HGOI 20191107 题解
Problem A 树状数组 给出下列$C++$代码: 设区间加操作$modify(l,r)$为调用两次$update(r,1)$和$update(l-1,-1)$ 设$f(l,r)$表示在初始$cn ...
- 「CF724G」Xor-matic Number of the Graph「线性基」
题意 求所有点对\(u,v\),\(u\)到\(v\)所有不同的异或路径的异或值之和,对\(10^9+7\)取模 题解 求出一个dfs树,那么\(u\)到\(v\)的路径一定是树上路径异或一些环.这些 ...
- vue-cli 本地代理 造成session丢失 而登录不上去 解决办法
本地代理造成session丢失,登录不成功,是由于代理配置造成的 devServer: { port: 8000, proxy:{ '/qiantai':{ target:'线上地址/qiantai' ...
- sql到python正则
import urllib.requestimport re,timeresult=[]for i in range(100): urls ="http://xxx.com/-1%20 ...
- MySQL| MySQL关键字和保留字
MySQL 5.5 Keywords and Reserved Words The following list shows the keywords and reserved words in My ...
- tracert命令与tracert (IP地址)-d有什么区别?
他们的意义基本相同,都是路由追踪,返回从源到目标的路由情况:但tracert -d不解析各路由器的名称,只返回路由器的IP地址.而tracert 不仅返回各路由器的IP地址,而且返回其名称.简单来说, ...
- 【平台中间件】为什么用etcd而不用ZooKeeper?从应用场景到实现原理的全方位解读
前言 博主在工作过程中经常接触到ETCD,搜索相关资料的时候发现排名最高的是一篇图片全是404的转载文章,后来看到了原文,感觉有义务让更多的人看到这样的精品文章,所以进行了转载. 原文发布在infoQ ...
- 常用css模板
段落超出显示省略号(可单行多行) .p-content{ overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-b ...