Download Data Synchronization Between Two Securent Databases

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Global serializability wikipedia , lookup

Commitment ordering wikipedia , lookup

Microsoft Access wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup

Serializability wikipedia , lookup

IMDb wikipedia , lookup

Btrieve wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Ingres (database) wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

Versant Object Database wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
Securent Entitlement Management Solution
v 3.1.4
Data Synchronization
Between Two Securent Databases
Using Oracle 10g Streams
2-Way Replication
Copyright
Copyright © 2006-2007 Securent, Inc. All Rights Reserved.
Restricted Rights
This software and documentation is subject to and made available only pursuant to the terms of
the Securent Inc. License Agreement and may be used or copied only in accordance with the
terms of that agreement. It is against the law to copy the software except as specifically
allowed in the agreement. This document may not, in whole or in part, be copied, photocopied,
reproduced, translated, or reduced to any electronic medium or machine-readable form
without prior consent, in writing, from Securent, Inc.
THE SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. FURTHER, Securent DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
REPRESENTATIONS REGARDING THE USE, OR THE RESULTS OF THE USE, OF THE SOFTWARE OR
WRITTEN MATERIAL IN TERMS OF CORRECTNESS, ACCURACY, RELIABILITY, OR OTHERWISE.
Content
Overview ................................................................................................................ 1
Using Database Scripts ............................................................................................. 1
Step 1: Configure archive log mode .................................................................. 2
Step 2: Set up tnsnames.ora ........................................................................... 2
Step 3: SECURENT DB-1 and Securent DB-2 Application schema .......................... 2
Step 4: Execution of Streams_2wayRep_SingleScript.sql script:............................ 2
Conclusion .............................................................................................................. 4
Overview
Replication can be done using the Oracle 10g Streams feature between any two
databases of Oracle10g. Policy data present in the SECURENT DB-1 database can be
replicated and synchronized with the Securent DB-2 database using the Oracle 10g
Streams feature. Oracle Streams enables the propagation and management of data,
transactions and events from one database to another. Here, SECURENT DB-1
database acts as a Source as well as Destination and Securent DB-2 database also
acts as a Destination as well as Source database. Oracle Streams consists of the
following components:
Capture:
Data is captured from the redo logs and packaged into Logical Change Records (LCR).
The LCRs are then moved into the Staging environment. Data and events may be
changed or formatted by a predefined set of rules before they are packaged into an
LCR.
Stage:
LCRs are stored in the Staging environment until a subscriber picks them up to be used
or consumed. The subscriber may be another staging environment or a user application.
Apply:
During the ‘apply/consumption’ phase, LCRs are picked up and applied to a database.
Consumption allows the LCR to be modified before it is applied to the database.
For more information about Oracle Streams, refer to the Oracle website:
http://www.oracle.com/technology/products/dataint/htdocs/streams_fo.html
This document explains the process to achieve SECURENT DB-1 - SECURENT DB-2
data replication and synchronization using the custom database scripts.
Using Database Scripts
You can achieve SECURENT DB-1 - SECURENT DB-2 data replication
synchronization process by executing the database scripts as explained below.
and
Oracle Streams Environment:
Database Role
SECURENT DB-1
SECURENT DB-2
Host Name
testorcl-1
testorcl-2
Instance
Name
testorcl1
testorcl2
Global Database
Name
testorcl1.world
testorcl2.world
Following are the steps for enabling the streams environment:
Step 1: Configure archive log mode
Step 2: Set up tnsnames.ora
Step 3: Source and Destination Application schema
Step 4: Execution of Streams_2wayRep_SingleScript.sql script
Proprietary & Confidential
1
Note: Following scripts are used to perform the SECURENT DB-1 - SECURENT DB-2
data replication:
1. Streams_2wayRep_SingleScript.sql
2. ALTER_SEQ_CHANGESTART.SQL
3. Conflict handling.sql
The directory where you can find these scripts is ...\SECURENT_HOME\db\scripts\oracle
\streamscripts_2way.
Step 1: Configure archive log mode
Verify testorcl1 in archive log mode. Archived redo logs are required by the capture
process to capture changes.
Step 2: Set up tnsnames.ora
Add the following TNS entries on testorcl-1 and testorcl-2:
testorcl1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = testorcl-1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testorcl1)
)
)
testorcl2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = testorcl-2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = testorcl2)
)
)
Step 3: Securent DB-1 and Securent DB-2 Application schema
Let’s assume that there exist same securent application schema in both the databases testorcl1 (SECURENT DB-1 ) and testorcl2 ( SECURENT DB-2 ) with same tablespace
names. Else, create the application schema with same tablespace names as mentioned
in SECURENT DB-1 database, in the Securent DB-2 database.
Note: To handle the Uniqueness Conflicts related to Primary keys, when sequences are
used, run the following scripts to Alter the existing sequences. Run
ALTER_SEQ_CHANGESTART.SQL at Securent DB-2 database, which start the sequences
with new range.
Step 4: Execution of Streams_2wayRep_SingleScript.sql script:
This script will prompt for the Database names and the Sysadmin username, password
of both Databases, as shown
Enter DB Name of first site:
Enter SYS user of first site:
Enter password of SYS user of first site:
Enter DB Name of second site:
Proprietary & Confidential
Enter SYS user of second site:
Enter password of SYS user of second site:
Enter SECURENT user:
This SQL script creates streams admin user, sets up the streams for 2Way replication
between two databases and start the replication. Following processes will be occurred
internally during execution of the above script:
Process 1: Set up Capture and Propagation at SECURENT DB-1
Create a Streams administrator, named strmadmin, with the required administrator
privileges on testorcl1 and testorcl2. You should create a tablespace on testorcl2 to
exclusively house the Streams administrator’s tables and indexes. The strmadmin user
on testorcl1 however, does not create any database objects. The account is used to
perform administrative tasks such as objects instantiation and obtaining the first
System Change Number (SCN) for the capture process at the downstream database.
Following operations are performed when Streams_2wayRep_SingleScript.sql script
executed.
•
Create database link
As the Streams administrator, create a private database link from testorcl2 to
testorcl1. The Streams administrator uses the database link to perform
administrative tasks on testorcl1.
•
Create Streams queues
Database changes are captured in queues and propagated to other databases.
Create the capture queue on the source database and the apply queue on the
destination database.
•
Setup Capture and Propagate Rules at SECURENT DB-1
Setup Schema level Capture and Propagation Rules at database - SECURENT DB-1.
The configuration for the propagation process is similar to the capture process. We
add rules to the positive rule set and specify the source queue name and destination
queue name. Changes are propagated from the source queue to the destination
queue.
•
Setup Apply Rules at SECURENT DB-1
Setup Schema level Apply Rules at database (testorcl1).
•
Setup Update Conflict handlers
Setup Update Conflict handlers
Conflict_handler_script.sql script.
at
database
(testorcl1)
by
executing
Process 2: Set up Capture and Propagation at Securent DB-2
Create a Streams administrator, strmadmin, with the required administrator privileges
on testorcl1 and testorcl2. You should create a tablespace on testorcl2 to exclusively
house the Streams administrator’s tables and indexes. The strmadmin user on testorcl1
however, does not create any database objects. The account is used to perform
administrative tasks such as objects instantiation and obtaining the first System Change
Number (SCN) for the capture process at the downstream database. Following
operations are performed when
Streams_2wayRep_SingleScript.sql script executed.
Proprietary & Confidential
•
•
•
•
•
Create database link
As the Streams administrator, create a private database link from testorcl2 to
testorcl1. The Streams administrator uses the database link to perform
administrative tasks on testorcl1.
Create Streams queues
Database changes are captured in queues and propagated to other databases.
Create the capture queue on the source database and the apply queue on the
destination database.
Setup Capture and Propagate Rules at Securent DB-2
Setup Schema level Capture and Propagation Rules at database - Securent DB-2.
The configuration for the propagation process is similar to the capture process. We
add rules to the positive rule set and specify the source queue name and destination
queue name. Changes are propagated from the source queue to the destination
queue.
Setup Apply Rules at Securent DB-2
Setup Schema level Apply Rules at database (testorcl2).
Setup Update Conflict handlers
Setup Update Conflict handlers at database (testorcl2) by executing
Conflict_handler_script.sql script.
Process 3: Export- Import process
Log in as STRMADMIN at Securent DB-2 database (testorcl2). Use Data Pump to copy
the Securent schema on destination. These operations are performed when
Streams_2wayRep_SingleScript.sql script executed.
Process 4: Configure apply process and Start apply process
Create the apply process and add rules to the positive rule set. The apply process
dequeues the LCR events and applies the changes to the destination schema.
Start the apply process at both SECURENT DB-1 and Securent DB-2 databases.
These operations are performed when Streams_2wayRep_SingleScript.sql script
executed.
Process 5: Start capture process
Start the capture process at both SECURENT DB-1 and Securent DB-2 databases.
These operations are performed when Streams_2wayRep_SingleScript.sql script
executed.
Conclusion
After executing the Streams_2wayRep_SingleScript.sql script by passing the relevant
required inputs at the prompts the Two Way Replication using Streams setup is created
in above mentioned steps and start the propagation and apply processes. The
SECURENT DB-1 policy data is replicated and synchronized in the Securent DB-2
Oracle database and vise versa.
Proprietary & Confidential