Create Replica (Production Mapping)

Summary

A replica is a copy of an enterprise geodatabase dataset. You can work independently with replicas and synchronize changes with the data's original geodatabase.

This tool creates a replica in a personal, file, or enterprise geodatabase from a specified list of feature classes, layers, datasets, or tables. Optionally, you can use a filter geometry from another feature layer to replicate features within an area of interest.

Usage

Syntax

CreateReplica_production (in_datasets, in_replicatype, in_childworkspace, in_replicaname, {in_reuse_schema}, {in_usefilter}, {in_filtertype}, {in_features}, {in_access_type}, {in_use_archiving})
ParameterExplanationData Type
in_datasets
[in_datasets,...]

The data to replicate. This can consist of individual feature classes and tables or entire datasets.

Feature Layer; Table View; Dataset
in_replicatype

The type of replica to create:

  • CHECKOUTCreates a replica in which the changes can be checked back into the parent geodatabase from the child. This is the default.
  • ONE_WAYCreates a replica in which changes cannot be transferred from the child to the parent, but changes can be continually synchronized from the parent to the child.
  • TWO_WAYCreates a replica in which changes can be transferred from the parent to the child and vice versa.
String
in_childworkspace

The path to and name of the workspace that is going to contain the replicated data.

Workspace; GeoDataServer
in_replicaname

The name of the replica you are going to create.

String
in_reuse_schema
(Optional)

Indicates whether to reuse the schema of existing data in in_childworkspace. This option can reduce the time required to replicate data by not recreating existing schemas in in_childworkspace. in_reuse_schema is most efficient when used to replicate data into empty schemas in in_childworkspace. This option is only available for check-out replicas.

  • DO_NOT_REUSEDo not reuse schema. This is the default.
  • REUSEReuse schema.
String
in_usefilter
(Optional)

Replicates features that either intersect or are contained by features in the in_features feature layer.

  • TRUEApplies the filter set in in_filtertype. You must set in_filtertype and in_features.
  • FALSEDoes not apply the spatial filter. This is the default.
Boolean
in_filtertype
(Optional)

Specifies the spatial relationship between in_datasets and in_features.

  • INTERSECTSExtract features from in_datasets that intersect features in in_features. This is the default.
  • CONTAINSExtract features from in_datasets that are contained by the selected feature in the in_features.
String
in_features
(Optional)

Feature layer with one selected feature.

Layer
in_access_type
(Optional)

Indicates the feature information model type to replicate. Model type specifies either simple or complex features.

  • FULLReplicates complex types (topologies and geometric networks) to complex types in in_childworkspace. This option requires versioned data. This is the default.
  • SIMPLEReplicates all data, including complex types, to simple types in in_childworkspace. The data on the child is not versioned if replicated to an ArcSDE geodatabase. This allows the replica to be interoperable with simple feature viewers and editors that are not based on the ArcGIS engine.
String
in_use_archiving
(Optional)

Specifies whether to use the archive class to track changes instead of using the versioning delta tables. This is only available for one-way replicas. in_replicatype must be created from the DEFAULT version.

  • ARCHIVINGUses archiving to track changes.
  • NO_ARCHIVINGDoes not use archiving to track changes. This is the default.
Boolean

Code Sample

CreateReplica example 1 (Stand–alone Python script)

This script demonstrates the use of the Production Mapping CreateReplica tool. The script creates a replica of Production Mapping SoCal sample data stored in ArcSDE. The script selects a single feature in the CoastA feature class. The script creates a replica of all TreesA features that intersect the selected feature in CoastA. Replicated features are written to a file geodatabase.

# Name: CreateReplica.py
# Description: Creates a checkout replica from the SoCal sample data
# Author: ESRI
# Date: March 2010

import arcpy

# check out a foundation license
arcpy.CheckOutExtension("Foundation")

# import the production mapping toolbox - you may have to change this path
arcpy.ImportToolbox(r'C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx')

# set our workspace to an sde connection file
arcpy.env.workspace = "c:/data/SoCal.sde"

# fully qualified name to an ArcSDE feature class (dataset/feature class)
coastpath = "socal.GIS.SoCal/socal.GIS.CoastA"

# make a feature layer from islands in the CoastA feature class in the
# prod mapping sample data 
if arcpy.Exists("Coast") == False:
    arcpy.MakeFeatureLayer_management(coastpath,"Coast")

# select an island - verify that objectid 84 is an island in your data
arcpy.SelectLayerByAttribute_management("Coast","NEW_SELECTION","objectid=84")

checkoutDb = "c:/data/SoCalIslandTrees.gdb"

# make a new geodatabase
if arcpy.Exists(checkoutDb) == False:
    arcpy.CreateFileGDB_management("c:/data","SoCalIslandTrees.gdb")    

# another fully qualified ArcSDE name (dataset/feature class)
treespath="socal.GIS.SoCal/socal.GIS.TreesA"

# check out some data into the new file gdb
arcpy.CreateReplica_production(treespath,"CHECKOUT",checkoutDb,"islandTrees","TRUE","INTERSECTS","Coast")

# check the extension in
arcpy.CheckInExtension("Foundation")

CreateReplica example 2 (Python window)

This ArcGIS Python window example demonstrates how to use the CreateReplica tool with the ONE_WAY replica type. The script replicates production mapping SC_Index sample data from an Oracle instance to an SQL Server Instance.

sourceDb=r'c:\data\Socal_sample_oracle.sde\SOCAL_DATA.SC_Index'
targetDb=r'C:\data\SoCal.sde'
# import the production mapping toolbox - you may have to change this path
arcpy.ImportToolbox(r'C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Production Mapping Tools.tbx')
arcpy.CreateReplica_production(sourceDb,"ONE_WAY",targetDb,"indexRepl1","NO_FILTER_BY_GEOMETRY","INTERSECTS","")

Environments

Related Topics

Licensing Information

ArcView: No
ArcEditor: Requires Production Mapping
ArcInfo: Requires Production Mapping

5/4/2011