Workflow for gdb replication

6251
18
01-21-2016 08:09 AM
mpboyle
Occasional Contributor III

This is my first go around with gdb replication and am looking to create a 1-way replica from a sde gdb to either another sde gdb or a file gdb.  I was hoping to get an idea of the best practices and workflows for keeping the two gdbs in sync?

My assumption is you start with the Create Replica tool in order to replica data from parent to child, is that right?

After that is done, I have a few questions about workflow and best practices...

1) How do you add a feature class to the child gdb after the replication process is in effect?

2) If a feature class is deleted from the parent gdb, how do you delete the feature class in the child?...do you simply delete it through ArcCatalog?

3) If a field is added or removed in a feature class within the parent gdb, how do you send that change to the child gdb?...can it be automated or is it manual?

4) If a domain is added / altered / removed, how do you send those changes to the child?...can it be automated or is it manual?

5) What is a good 'routing' for syncing changes?  Do you first reconcile and post edits in the parent gdb, then sync changes?  Should some processes, like comparing schema be done first before syncing changes?

I'm looking to get an idea of what workflows others use that have been successful, easy to manage, and keeps your data in sync.

Thanks!

18 Replies
mpboyle
Occasional Contributor III

Jacob Boyle​,

I'm using the .xml file produced after comparing the schemas.  I just added a field in my editing gdb and it is added to the child gdb after running my script.  Below is a skeleton of the python code I'm using...

import arcpy
import datetime
import os

def compare_replica_schemas(gdb_1, gdb_2, replica_name, output_file_folder):
    # gdb 1 is editing gdb
    # gdb 2 is child gdb
    run_time = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')  # used for creating unique file name
    schema_file_parent = os.path.join(output_file_folder, run_time + '_schemaParent.xml')
    schema_file_compare = os.path.join(output_file_folder, run_time + '_schemaCompare.xml')
    # export schema from editing gdb
    arcpy.ExportReplicaSchema_management(gdb_1, schema_file_parent, replica_name)
    # compare replica schemas
    arcpy.CompareReplicaSchema_management(gdb_2, schema_file_parent, schema_file_compare)
    # import replica schema to child gdb
    arcpy.ImportReplicaSchema_management(gdb_2, schema_file_compare)
0 Kudos
JacobBoyle
Occasional Contributor III

The Python looks right, logically. What happens if you do it manually? same result of the field not being deleted?

0 Kudos
mpboyle
Occasional Contributor III

Nope...field (Field2) still exists.

Child gdb is on left, editing gdb is on right.

0 Kudos
mpboyle
Occasional Contributor III

Jacob Boyle

When I right-click on the child gdb, go to Distributed Geodatabase, and Import Schema Changes...I am presented with a wizard that gives the option to confirm the deletion of 'Field2'.  It is unchecked by default, which is what I'm guessing is being done through scripting...the field not being confirmed for deletion.  I only get this wizard when doing the workflow I describe.  If I use python or even the tools from the toolbox, I'm not presented with this.

This seems very annoying when trying to automate a process that would be run during off hours when users are not connected to a gdb and have locks established.  I'm wondering why adding a field doesn't get the same result; it is added through scripting, while deleting a field is not removed through scripting.

JacobBoyle
Occasional Contributor III

check the ArcPy documentation for a parameter to set that value to true, I'd bet it's there. If not, maybe someone from the GDB team that's been added can chime in.

Like I said previously, we've found that the manual process was all we've needed, so i'm not familiar with scripting this process.

0 Kudos
Brownschuh
Occasional Contributor II

Matthew, stumbled upon this same issue you are experiencing yesterday.  Check out this thread; same scenario ... 

0 Kudos
ChrisDonohue__GISP
MVP Alum

Adding some ESRI folks to the mix so they get a notification in case they have insights to add:

Jake Skinner

Vince Angelo

Asrujit SenGupta

Chris Donohue, GISP

0 Kudos
BenDrury
Occasional Contributor

I was hoping to fine a more convenient answer to this question. We are always having some department wanting to add a feature class or delete on form here. I was hoping for some other way to do this and not break the replication, but looks as if there is no other way. Thanks for the information posted in this thread. 

0 Kudos
George_Thompson
Esri Frequent Contributor

Here is a blog that gives detailed information GDB replication and schema changes:

Simplify Your Life: Working with Schema Changes in Replicas | Support Services Blog

Geodatabase

--- George T.
0 Kudos