当前位置:Gxlcms > mysql > Oracle之steam主从数据库同步

Oracle之steam主从数据库同步

时间:2021-07-01 10:21:17 帮助过:81人阅读

#启用Database 追加日志SQLgt; alter database add supplemental log data ;数据库已更改。#启用Table追加日志SQLgt; ALTER DA

1、 修改系统参数

alter system set aq_tm_processes=2 scope=both;
alter system set global_names=true scope=both;
alter system set job_queue_processes=20 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=25M scope=spfile;
alter system set utl_file_dir=’*’ scope=spfile;
alter system set open_links=4 scope=spfile;
alter system set log_archive_dest=’/founder/Oracle/arch’ scope=spfile;
alter system set log_archive_start=TRUE scope=spfile;
alter system set log_archive_format=’arch%t_%s_%r.arc’ scope=spfile;

#启用Database 追加日志
SQL> alter database add supplemental log data ;
数据库已更改。
#启用Table追加日志
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY, UNIQUE, FOREIGN KEY) COLUMNS;

2、修改各自的global_name

– 检查全局名
select * from global_name;
–如果不正确修改
alter database rename global_name to wap.com.cn
–修改完上述变量以后重启 SHUTDOWN IMMEDIATE

3、在从数据上创建和主数据库一样的表空间和用户

详细步骤就不写了,地球人都知道

4、创建复制用户

– 创建复制用户
create user stradmin identified by password
default tablespace CMSTABLE quota unlimited on CMSTABLE;
grant connect, resource, dba to stradmin;

– 创建归档目录
– primary
create directory dir_primary as ‘/xxxxxxxx/gmw_yunmei/’;
– standby
create directory dir_standby as ‘/xxxxxxxxxxxxx/gmw_yunmei/’;

6、启动各自的EM

emctl status dbconsole

然后访问:1158/em/

然后使用SYSTEM登陆

7、在【维护】-【流】-【设置】

使用图形化的界面进行添加任务,,然后可以在图形界面上进行管理和配置Stream的管理和监控

8、错误查询

select CAPTURE_NAME,QUEUE_NAME,START_SCN,STATUS,CAPTURE_TYPE from dba_capture;

主数据库最好每个表都有主键

要保持主从数据库的同步之前的唯一性

linux

人气教程排行