Oracle简单stream一个用户单向复制配置
如果STATUS状态是ENABLED,表示Apply进程运行正常; 如果STATUS状态是DISABLED,表示Apply进程处于停止状态,只需重新启动
以下我做streamm同步两台机器间的某一个用户的操作步骤。很简单,看到stream还有很多要看的。
1.环境介绍
主数据库SID : obpm
操作系统 : win 2003
IP地址 : 192.168.0.1
Global_name :
Oracle version: 10.2.0.1
从数据库SID: orcl
操作系统 : win 2003
IP地址 : 192.168.0.2
Global_name :
oracle version: 10.2.0.1
2.在主/从数据库设置初始化参数(在主从数据库都执行以下操作)
1) sqlplus / as sysdba ----以dba身份登录
2)alter system set aq_tm_processes=2 scope=both; ---启用对队列消息的时间监视
alter system set global_names=true scope=both; ---设置全局名称为true
---alter system set job_queue_processes=10 scope=both; --设置定时作业进程最大为10个,默认是10
alter system set undo_retention=3600 scope=both; --设置回滚段时间,默认是900
alter system set streams_pool_size=25M scope=spfile; --sga设置为自动调整情况下不需设置该参数
3)重启动两个数据库
3.设置主数据库为归档mode
1)archive log list; --查是否归档,如是归档,请忽略第3点
2)shutdown immediate;
startup mount;
alter database archivelog;
alter system set LOG_ARCHIVE_DEST_1='LOCATION=D:\arc\'; ---设置归档目录
alter system switch logfile; --相应目录检查是否生成arc文件
alter database open;
4.主/从数据新建stream管理用户(在主从数据库都执行以下操作)
1)sqlplus / as sysdba;
2)create tablespace tbs_stream datafile 'E:\tbs_stream01.dbf' size 100m autoextend on maxsize unlimited segment space management auto; ---创建主环境的Stream专用表空间
3)execute dbms_logmnr_d.set_tablespace('tbs_stream'); --将logminer的数据字典从system表空间转移到新建的表空间,,防止撑满system表空间
4)create user strmadmin identified by strmadmin default tablespace tbs_stream temporary tablespace temp; --创建用户
5)grant dba to strmadmin;---直接给dba权限.
5.主数据库网络环境设置
1)主数据库(tnsnames.ora)中添加从数据库的配置。(也可以通过oracle图形工具net manager配置)
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
2)测试是否连的通(cmd下面输入以下命令)
sqlplus strmadmin/strmadmin@orcl
3)新建orcl的dblink
sqlplus strmadmin/strmadmin
create database link orcl connect to strmadmin identified by strmadmin using 'orcl';
----global_names为true的情况下,主数据库建立的数据库链的名字必须和从数据库的global_name相同
select sysdate from dual@orcl; --测试dblink是否有效
6.从数据库网络环境设置
1)从数据库(tnsnames.ora)中添加主数据库的配置。(也可以通过oracle图形工具net manager配置)
obpm =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = obpm)
)
)
2)测试是否连的通(cmd下面输入以下命令)
sqlplus strmadmin/strmadmin@obpm
3)新建obpm的dblink
sqlplus strmadmin/strmadmin
create database link obpm connect to strmadmin identified by strmadmin using 'obpm';
----global_names为true的情况下,主数据库建立的数据库链的名字必须和从数据库的global_name相同
select sysdate from dual@obpm; --测试dblink是否有效

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.

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

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.

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

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

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

The steps to open an Oracle database are as follows: Open the Oracle database client and connect to the database server: connect username/password@servername Use the SQLPLUS command to open the database: SQLPLUS
