This example copies the data that exists in a SQL Server database to an Oracle database (the Initial Load) and then keeps the two databases in sync. All the tables of the schema HumanResources are replicated, and the tables that do not exist in Oracle are created. The steps are the ones of Basic Replication Configuration. The data can also be synchronized from a backup of the Source instead of the Initial Load: see Database Sync from Backup, which compares the two ways.
Prepare the SQL Server database as a Source. housekeeping=1 installs a Repstance job that deletes the changes from the CDC tables after the Capture Process has read them (see SQL Server as Source):
repcli>prepare database=source dbtype=mssql server=db-src.example.com port=1433 user=repuser password=Passw0rd123 dbname=testDB housekeeping=1
[Completed]: Database [db-src.example.com:1433,testDB] has been prepared.Prepare the Oracle database as a Target. connectiontype=ezconnect says that the connection is made with the server, the port and the service name (see Oracle as Target):
repcli>prepare database=target dbtype=oracle connectiontype=ezconnect server=ora-tgt.example.com port=1521 servicename=ORA1 user=repuser password=Passw0rd123
[Completed]: Database has been preparedThe Capture Process sql2ora has the number 4. dmlinclude and ddlinclude select the tables whose changes are replicated. loadinclude=HumanResources.%:C selects the tables of the Initial Load: all the tables of the schema HumanResources, and :C creates a table in the Target Database when it does not exist there. The other options clean a table before the load (T, D), recreate it (R) or merge the rows into it (M), see Initial Load. A table has to be selected by dmlinclude too, otherwise it is not loaded.
repcli>prepare process=capture id=4 dbtype=mssql name=sql2ora server=db-src.example.com port=1433 user=repuser password=Passw0rd123 dbname=testDB dmlinclude=HumanResources.% ddlinclude=HumanResources.% loadinclude=HumanResources.%:C autostart=1
[Completed]: Capture 4 has been addedThe Initial Load runs when the Capture Process starts. autostart=1 starts the process as soon as it is created, and again every time the Repstance server starts. When the load is finished, Repstance removes loadinclude from the settings of the process (see Initial Load).
The Source and the Target are different databases, so the DDL statements of the Source cannot be replayed as they are. With ddlprocessing=map Repstance rebuilds them for the Target. The default, native, replays the text of the Source statement (see Oracle Apply Parameters):
repcli>prepare process=apply id=4 dbtype=oracle capturename=sql2ora connectiontype=ezconnect server=ora-tgt.example.com port=1521 servicename=ORA1 user=repuser password=Passw0rd123 ddlprocessing=map autostart=1
[Completed]: Apply 4 has been addedBoth processes start by themselves. The command status shows the Initial Load (see Status of any Capture or Apply Processes): while the tables are loaded, the Capture Process shows the lines Loading the Data, Average Load Speed (ops) and Loaded Objects, the number of the tables and of the rows that have been loaded. When the load is finished, the Apply Process keeps the Target in sync with the Source.
To check that the tables are the same in both databases, compare them: DATA COMPARISON. The command report shows what each process has done for every table (see Report Process).
Prev page:
Basic Replication ConfigurationNext page:
Multi-Target Replication