Home Database Mysql Tutorial Oracle数据库集复制方法浅议

Oracle数据库集复制方法浅议

Jun 07, 2016 pm 06:04 PM

Oracle数据库集复制方法浅议

正在看的ORACLE教程是:Oracle数据库集复制方法浅议。前言

  日益增长的分布式应用需求要求实现更好分布式的软件环境,不断推动着分布式技术的进步。Oracle数据复制是实现分布式数据环境的一种技术,通过在不同的物理站点拷贝数据来建立分布式数据环境。它与分布式数据库不同,在分布式数据库中,虽然每个数据对象也对所有的站点可用,但是特定的数据对象只存在于一个特定的站点中。而数据复制实现所有的站点都有相同数据对象的可用拷贝。

  在一个典型的分布式商业应用中经常需要把个地区的数据备份到总部的数据库中,一方面可以作为一种备份方式,另一方面也方便总部应用中的综合统计。这是Oracle数据复制中的简单应用,本文将以这样一个例子,讲述如何实现Oracle数据复制。

  实际情况是,A公司总部在北京,有三个营业部分别位于上海(ORACLE.SHANGHAI.COM)、杭州(ORACLE.HANGZHOU.COM)和武汉(ORACLE.
WUHAN.COM)。三个营业部的软件系统相同,数据库结构也相同。现在需要把三个营业部的数据全部备份到总部的数据库中。

  准备工作

  在进行复制之前需要准备的东西很多,当然最基础就是网络必须畅通,之后需要收集一些复制环境的基本信息:

  1. 需要复制的数据库站点的数量

  2. 每个站点的Oracle版本号

  3. 每个需要复制的数据库的大小

  4. 每个数据库所使用的字符集

  5. 每个需要复制的数据所用的方案名

  收集完环境信息,可以开始建立总部的集中数据库,集中数据库要求版本高于所有主战点的版本,最好所有的数据库都是用相同的字符集。建好库后为每个主站点的备份数据分别建一个表空间,表空间大于需要复制的数据量,至于预留以后的发展空间视实际情况而定。

  为每个主站点的对应复制数据建立方案,如果各个主站点所使用的方案名不同,在集中数据库站点分别建立名称相同的对应方案。否则为各主站点的复制数据分别建立相应的方案名。实际情况是后者,各营业部的数据库都是用Oracle的方案名,这里我们建立三个对应方
案:SHORACL、HZORACL 和WHORACL。所有数据库的版本都是9i。

  基本概念

  复制之前先解释一下复制中的几个概念:

  1.主站点(Mater Site):在复制过程中提供数据源的站点。如上图中的上海数据库站点。

  2.实体化视图站点(Materialized View Site):实体化视图复制中的目标站点。如上图中的北京数据库站点。

  3.多主体站点复制(Multimaster Replication):复制环境中的站点都是主站点,对复制的数据库对象有相同的管理权限。

  4.实体化视图复制(Materialized View Replication): 一个主体站点提供源复制对象,一个实体化视图站点拷贝主站点数据。

  5.实体化视图(Materialized View):在实体化视图站点为每个复制表或者视图建立一个对应的表保存相应的数据,该表只能通过Oracle的复制机制进行增删改数据的操作。

  6. 快速刷新、完全刷新和强制刷新:复制过程中的三种刷新方式。快速刷新只复制源数据对象的改变部分;完全刷新每次都拷贝一遍源数据对象;强制刷新是数据库的一个折衷方案,如果快速刷新失败则使用完全刷新。

  7. 主体组(Master Group):主体站点中被复制的源数据对象的集合。

  8. 实体化视图组(Materialized View Site):实体化视图站点中复制对象的集合。

  9. 实体化视图日志(Materialized View Log):实体化视图复制中使用快速刷新时记录主体源数据对象操作日志的表。

  同步复制和异步复制就不解释了,本例采用每天一次的异步复制。

  进行复制

  配置好本地服务名分别为:上海站点:SH,杭州站点:HZ,武汉站点:WH,北京站点:BJ,进入没有登录的sqlplus,让我们开始复制!

  一.设置主站点。

  这里以上海主站点设置为例。

  1.连接主站点,创建复制管理员并授予相应的权限,复制管理员是管理整个复制环境并创建复制对象的用户。只有数据管理员可以建立主体组和实体化视图组。


  后面的两个grant语句使复制管理员可以为任何表建立实体化视图日志。如果想改用户可以使用视图管理器,还需要下面的命令:


  2.注册传播方,传播方会将主体站点的延迟事务队列推入其他主体站点或者实体化视图站点。


  3.调度清除作业,该作业会定时清除延迟事务队列并用传播方将延迟事务推入其他主体站点或者实体化视图站点。先更换用户:


  next_date:下一次执行日期,sysdate表示立即。

  interval:间隔时段,sysdate + 1表示间隔一天,sysdate+ 1/24表示间隔一小时

  delay_seconds:当延迟队列没有延迟事件时停止被次清除操作的延迟时间。

  4.为实体化视图站点建立复制代理。创建复制代理用户并授予视图接受方权限。复制代理是复制接收方连接主体站点的用户


  5. 创建主体组。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

When might a full table scan be faster than using an index in MySQL? When might a full table scan be faster than using an index in MySQL? Apr 09, 2025 am 12:05 AM

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

Can I install mysql on Windows 7 Can I install mysql on Windows 7 Apr 08, 2025 pm 03:21 PM

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

Difference between clustered index and non-clustered index (secondary index) in InnoDB. Difference between clustered index and non-clustered index (secondary index) in InnoDB. Apr 02, 2025 pm 06:25 PM

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values ​​and pointers to data rows, and is suitable for non-primary key column queries.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

See all articles