关于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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

Oracle views can be exported through the EXP utility: Log in to the Oracle database. Start the EXP utility, specifying the view name and export directory. Enter export parameters, including target mode, file format, and tablespace. Start exporting. Verify the export using the impdp utility.
