You are on page 1of 28

ArcSDE Schema Maintenance

Rob McPherson

In this hour.
Use of the case tools for schema design Maintenance of the schema Migration of the schema

ArcGIS Architecture

Overriding Idea. The more use we make of the Geodatabase functionality, the more important it is that the Geodatabase schema is managed using ArcCatalog and not the underlying database tools.

Using UML to model a Geodatabase Why should I use case tools?


Documentation Understandable visualisation Configuration Management Easy generation of similar classes Reusability of objects Maintainability Repeatable results Published templates for domains

Design UML in Visio


Need ArcGIS component and Microsoft XMI component
Note there are different components for Visio 2002 and 2003

ESRI kb article describes set up http://support.esri.com/index.cfm?fa=knowledg ebase.techarticles.articleShow&d=26105 Open new document using ESRI template

Creating a UML model


Use UML to model
Feature Classes Feature Datasets Subtypes Domains Relationship classes Network Classes

Creating a UML Model


Use Abstract classes to create common templates The Generalisation shape represents inheritance The Binary Association shape represents relationship classes and Subtyping Tagged values allow specification of class and field level attribution, e.g. GeometryType, ConfigKeyword, Length, Alias

Creating a UML Model


What we cannot model
Projection information on classes and feature datasets Permissions Topologies Annotation and Dimensions Versioning Raster Datasets

UML Demo

Maintaining the schema


Use ArcCatalog for
Any schema changes Permission setting Versioning Topology and Network Creation

Use the Database tools for


User Creation and system privileges Role Creation

Use ArcSDE Command line for


SDE View creation and deletion

ArcSDE repository
ArcCatalog/ArcSDE may have created entries in Table_Registry, Layers, Geometry_Columns, Spatial_references, GDB_Objectclasses, GDB_FeatureClasses, GDB_FieldInfo, Column_registry, GDB_Tables_Last_Modified, GDB_Subtypes, GDB_RelClasses, GDB_TopoClasses

Column_Registry
ArcSDE 9.0/9.1 maintains its own dictionary.
Reduces chatter with the database dictionary Allows caching of values Do not make changes outside the ArcGIS toolset If changes are made, connect as the schema owner in arccatalog and access the changed class to realign the dictionary Register all tables in your geodatabase ArcSDE will look in Column registry first and then the dictionary.

Reapplying the UML model


By reapplying UML we can
Create New Classes Add fields to classes Update Aliases Modify Domains, Relationship Classes Change field types Delete fields Change scale, precision or length of fields Change a table to a feature class (or vice-versa) Change Geometry type or config keyword

We cannot

Changes using ArcCatalog


Use model builder or the GUI to
Add fields Delete fields Amend Aliases Calculate values into fields Apply permissions

Use scripting to keep a record or to extend models


E.g. A model to apply 200 privileges is unmaintainable, a script to achieve the same is maintainable

Changes that are difficult


Reducing the size of fields Creating a new Not null field

Versions, Networks and Topologies Topologies and networks may need to be dropped and recreated to allow schema changes Versioned datasets and classes may need to be unversioned. Care must be taken to avoid loss of data. If there are edits a perfect compress will be needed prior to unversioning.

Achieving a perfect compress


1. All edits in default
Ensure that no sessions are connected (check sde.process_information) Perform compress Check that there is only 1 record in sde.state_lineages Reconcile and post all edit versions Reconcile all versions again and save edits Proceed as above

2. Edits in multiple versions

Demo Schema Maintenance

Schema Migration
In this last section we will look at
Issues around copying the schema to a new database e.g. moving from test to production Options for copying data between geodatabases

Recreating the Schema


Keep a master copy of the applied UML
This will allow the projection and scale information to be automatically updated into the xml Can use a PGDB for this Test the XML is it in fact the same as your database
Apply the XML into another schema in the database and use database tools to compare the results.

Generate the final XML, Apply it to the source database and save the XML which will now be updated with all the projection information

Permissions, Versioning and Topologies Permissions are very difficult to recreate after the event Keep a script of permissions so that the same permissions are applied in production Use roles not users to apply permissions. This allows the Test and Prod users to change but the permissions to remain the same Model build or script all versioning and Topologies and maintain these models so that the production database matches the test database

Transferring Data
Small amounts of static data are ideal for transferring using XML If the class exists in the production database i.e. it will be created by the model, use an XML recordset If the class does not exist use an XML workspace to create the class and populate it

Transferring Data
To transfer Large volumes of data consider SDEExport
Version aware so there is no need to compress Creates compressed output Can be used to transfer between versions and databases with limitations Fast server side process

SDE Export
Problems
SdeExport is not Geodatabase aware Feature datasets will not be maintained Annotation and Dimensions will not register correctly Metadata is not transferred

Solutions
Pre-create the classes feature classes in feature datasets, Annotation classes etc Use sdeimport o append to load into these precreated classes Use ArcCatalog if metadata or feature linked annotation must be copied

Conclusion
Start with a UML model and keep it up to date throughout the development Use Model builder or scripting to secure configuration which will need to be repeated when a migration happens Use ArcGIS tools for all schema management If it goes wrong dont fiddle - use the ArcGIS tools to put it right.

Resources
ESRI White papers ESRI Inc produce an Instructor led course on Geodatabase modelling using Case Tools
We have not yet had enough demand to run this course!

Questions