Command Line Sync Issue / Question

Discussion of open issues, suggestions and bugs regarding database management and development tools for Oracle
Post Reply
mfriend
Posts: 9
Joined: Thu 30 Oct 2014 15:26

Command Line Sync Issue / Question

Post by mfriend » Thu 01 Jun 2017 20:20

Hi Folks:

I have a local Oracle XE database on my laptop that I want to use the command line to sync with the main Oracle database.

I want to keep the data between the two in sync (right now just working on syching one direction). I have created a .bat file that calls the command line arguments file that I saved from the link in the "New Data Comparison" wizard. It works good - it compares the tables in both databases and in the CMD view shows what needs synced.

The problem: It doesn't actually sync anything ... it just compares them. I want it to compare them and then copy whatever rows do no exist on destination from the source. (I don't want it to ever delete any rows of data that may exist on the destination server since data may exist there from other sources).

My laptop is the source, the main database is the destination. I have pasted the contents from my command lines argument file below because I dont' see a way to attach a file here (minus my passwords).

I must be missing something...
Thanks for any help,
Matthew

Code: Select all

  
/datacompare

/source connection:"User Id=Friend;Password=11111;Server=APOLLODEV;Unicode=True;Connection Timeout=0;Pooling=False;Enlist=False;Transaction Scope Local=True"
/target connection:"User Id=sys;Password=11111;Server=APOLLOLIVE;Connect Mode=SysDba;Unicode=True;Connection Timeout=0;Pooling=False;Enlist=False;Transaction Scope Local=True"
/schemas:FARM,FARM
/IgnoreLobColumns:No
/MappingIgnoreSpaces:Yes
/CompareNamesOnlyForBFiles:Yes
/CompareMViews:No
/MappingIgnoreCase:No
/MappingIgnoreUnderscores:No
/IgnoreColumnsByMask:No
/ExcludeObjectsByMask:No
/IncludeObjectsByMask:FIELD*
/CompareTables:Yes
/CompareViews:No
/RoundFloatTypes:No
/IgnoreTrailingSpaces:No
/IgnoreCase:No
/IgnoreEndOfLine:No
/IsIgnoreTime:Yes
/CheckDifferent:Yes
/CheckOnlyInSource:Yes
/CheckOnlyInTarget:Yes
/CheckIdentical:Yes
/RestoreSessionParameters:No
/CompileMViews:No
/RollbackOnError:Yes
/UseSchemaNamePrefix:Yes
/UseSqlExtensionCommands:Yes
/DisableTriggers:Yes
/DisableForeignKeys:Yes
/DropKeys:No
/IncludePrintComments:No
/ExcludeComments:No

alexa

Re: Command Line Sync Issue / Question

Post by alexa » Fri 02 Jun 2017 09:00

In order to avoid deleting records from the Target, you have to perform the following:
- Invoke the comparison wizard and select two databases.
- Navigate to the 'Options' page.
- Unselect the 'Only in target records' option.
- Save the arguments file (/CheckOnlyInTarget:No).

The *.bat file has to contain the comparison and execution commands as follows:

Code: Select all

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /argfile:"D:\DataCompareArgs.txt" /sync:"D:\d_c_1 vs d_c_2 (MSSQL2012)_20170602-1058.sql"
"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /execute /connection:"Data Source=DBMSSQLx64\MSSQL2012;Encrypt=False;Enlist=False;Initial Catalog=d_c_2;Integrated Security=False;User ID=sa;Pooling=False;Transaction Scope Local=True" /inputfile:"D:\d_c_1 vs d_c_2 (MSSQL2012)_20170602-1058.sql"
pause

Post Reply