关于OracleStream的安装、配置和使用
因项目预研需要,所以想找一个能够满足内外网数据库同步方案,前面先是测试了一下Oracle的高级复制功能,未果;才转而进行Oracle
因项目预研需要,所以想找一个能够满足内外网数据库同步方案,前面先是测试了一下Oracle的高级复制功能,未果;才转而进行Oracle Stream的测试,,大概是我水平太差了,前后测试了3.5遍总算把Oracle Stream运行正常起来了。
错误的原因其实称不上原因,无他,读文档读的不细致,手误、本身对这方面也缺乏理论认识。
关于Oracle流的原理
Oracle 流能够共享信息。Oracle流每个单元的共享信息来自于消息,我们可以在流中共享这些消息。流可以在同一个数据库或不同数据库之间传播信息。”流路由”指定信息到达特定的目的地。流比起传统的在不同数据库之间捕获、管理、共享消息的解决方案,有着更强大的功能和灵活性。流提供的功能可用于分布式企业程序、数据仓库和高可用性解决方案。我们可以在同一时刻使用oracle流的所有功能。我们可以使用流的新功能而不会严重影响数据库的性能。
使用Oracle流,我们可以控制流里的信息,流的流向,流进入目标数据库时,消息怎样运作,中止流。通过配置流,可以满足我们的特殊需求。基于我们的特殊情况,流可以在数据库里自动捕获、传播和管理DML、DDL消息。我们可以把用户定义的消息放入流中,流可以自动把信息传播到其它数据库或应用程序。当消息到达目的数据库时,流可以根据我们的设定应用它们。
本文主要参考文档《Step by step 配置Oracle Stream》杨宝秋(hrb_qiuyb)
《stream_concepts_administration_读书笔记.doc》
试验环境采用虚拟机方式,操作系统Windows2003,Oracle版本10.2.0
数据源机器配置
目标机器配置
计算机名
Source
Dest
IP地址
192.168.23.130
192.168.23.131
SID
Source
Dest
第一步:进行Stream前的参数配置,Source和Dest机器上均运行,运行命令可完全一致
SQL> conn sys/inxite as sysdba;
已连接。
SQL> alter system set aq_tm_processes=2 scope=both;
系统已更改。
SQL> alter system set global_names=true scope=both;
系统已更改。
SQL> alter system set job_queue_processes=20 scope=both;
系统已更改。
SQL> alter system set parallel_max_servers=20 scope=both;
系统已更改。
SQL> alter system set undo_retention=3600 scope=both;
系统已更改。
SQL> alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
系统已更改。
SQL> alter system set streams_pool_size=25M scope=spfile;
系统已更改。
SQL> alter system set utl_file_dir='*' scope=spfile;
系统已更改。
SQL> alter system set open_links=4 scope=spfile;
系统已更改。
SQL> alter system set log_archive_dest='e:/OracleDB/arch' scope=spfile;
系统已更改。
SQL> alter system set log_archive_start=TRUE scope=spfile;
系统已更改。
SQL> alter system set log_archive_format='arch%t_%s_%r.arc' scope=spfile;
系统已更改。
第二步:查看系统归档状态(双机可以同时检查,检查方式完全一致)
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE 例程已经启动。
Total System Global Area
167772160 bytes
Fixed Size
1247900 bytes
Variable Size
92276068 bytes
Database Buffers
71303168 bytes
Redo Buffers
2945024 bytes
数据库装载完毕。
SQL> alter database archivelog;
数据库已更改。
SQL> alter database open;
数据库已更改。
SQL> archive log list;
数据库日志模式
存档模式
自动存档
启用
存档终点
USE_DB_RECOVERY_FILE_DEST
最早的联机日志序列
1
下一个存档日志序列
2
当前日志序列
2
SQL>
第三步:创建Stream用户和表空间(双机可以同时设置,设置方式完全一致)
#创建主环境的Stream专用表空间
SQL> create tablespace tbs_stream datafile 'e:/OracleDB/tbs_stream01.dbf'
2
size 100m autoextend on next 100m maxsize 1000m segment space management auto;
表空间已创建。
#将logminer 的数据字典从system表空间转移到新建的表空间,防止撑满system表空间
SQL> execute dbms_logmnr_d.set_tablespace('tbs_stream');
PL/SQL 过程已成功完成。
#创建Stream管理用户
SQL> create user strmadmin identified by strmadmin default tablespace tbs_stream
temporary tablespace temp;
用户已创建。
#授权Stream管理用户
SQL> grant connect,resource,dba,aq_administrator_role to strmadmin;
授权成功。
SQL> begin
2
dbms_streams_auth.grant_admin_privilege(
3
grantee => 'strmadmin',
4
grant_privileges => true);
5
end;
6
/
PL/SQL 过程已成功完成。
第四步:配置各自双方的数据库连接
在source机器上添加dest数据源,名称为dest
在dest机器上添加source数据源,名称为source

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The function in Oracle to calculate the number of days between two dates is DATEDIFF(). The specific usage is as follows: Specify the time interval unit: interval (such as day, month, year) Specify two date values: date1 and date2DATEDIFF(interval, date1, date2) Return the difference in days

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

The INTERVAL data type in Oracle is used to represent time intervals. The syntax is INTERVAL <precision> <unit>. You can use addition, subtraction, multiplication and division operations to operate INTERVAL, which is suitable for scenarios such as storing time data and calculating date differences.

In Oracle, you can use the nested INSTR function to determine whether a string contains two substrings at the same time: when INSTR(string1, string2a) is greater than 0 and INSTR(string1, string2b) is greater than 0, it is included; otherwise, it is not included.

To find the number of occurrences of a character in Oracle, perform the following steps: Get the total length of a string; Get the length of the substring in which a character occurs; Count the number of occurrences of a character by subtracting the substring length from the total length.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.
