We wish to migrate the New York City Citywide Street Centerline (CSCL) database from its legacy environment to some fancy new environments. Friends this our CSCL migration, our rules, the trick is never to be afraid.
The New York City Department of City Planning leads development of updated editing software. This repository focuses on migrating data to support software development.
Here's a picture of the big picture.
- arcpy from ArcGIS Pro
- arcpy from ArcMap (32 bit classic)
- Classic 32 bit ArcCatalog (developed with 10.7.1)
- ArcGIS Pro (developed with 3.5.x)
- ArcGIS Pro Topographic Production toolbox license
- sqlplus.exe
- SQL access to the source database as the data owner and as SDE
- SQL access to the target database as the data owner and as SDE
Step 1 exports to a file geodatabase. The data flowing into that pipeline must continue to match the source environment until we export the archive in step 5.
Review and update the environmentals in the batch file.
> geodatabase-scripts\sample-extract.batStep 1 creates an empty file geodatabase. Then it uses python 2 Arcpy with class extension readers to copy/paste from the Enterprise Geodatabase to cscl-migrate.gdb.
\[dev|stg|prd]\cscl-migrate.gdb
From classic ArcCatalog 10.7 or superior. Administrator rights not required.
- Double click src/addin/ResetCLSIDs.esriaddin. In the utility window select "Install Add-In."
- From ArcCatalog select Customize-Customize Mode - Toolbars.
- Create a new toolbar named "removecalss" and check the box next it.
- From ArcCatalog Customize-Customize Mode select the commands tab. Search for "Reset CLSIDs." Drag it to the toolbar. 🔴DANGER ZONE. CODE RED🔴
- In ArcCatalog select the file geodatabase.
- Click the ResetCLSIDs toolbar button.
- Pause for a moment. Verify that the "GDB to modify" is a file geodatabase.
- Fill in the output log location and click OK.
- It should be quick and return: "Completed without errors."
- Review the log.
- Remove the toolbar. 🟡CODE YELLOW🟡
- Sanity check success by viewing the file geodatabase from ArcGIS Pro.
Review and update the environmentals in the batch file.
> geodatabase-scripts\sample-reprojectgdb.batThis step will include a warning "CSCL_Topology is missing!" This is expected. We will manually recreate the topology in the next step. There will also be warnings about datasets with no records. This is just how CSCL is. CSCL is a place of sky high blue tomorrows.
The default .bat files above output a reprojected file geodatabase named cscl-migrate-reproj.gdb. Using ArcGIS Pro copy all items in the file geodatabase. Paste into the enterprise geodatabase.
This should run for about an hour. This step can't be scripted easily, only the magic GUI can deal with dependencies and avoid _1s.
Then complete the load by applying topology rules, versioning, grants, etc with this script.
> geodatabase-scripts\sample-post-load-processing.batWhen migrating the archive we will update the base table objectids on the target database. These base tables do not exist until successfully completing step 4. Do not get clever and think that archive migration can be run in parallel to earlier steps.
See doc/archive-migration.md for details.
First compile 2 pl/sql packages in the source and target.
sqlplus sde/****@srcdb @geodatabase-scripts\setup-sde-source.sql
sqlplus sde/****@targetdb @geodatabase-scripts\setup-sde-target.sql
sqlplus cscl/****@targetdb @geodatabase-scripts\setup-owner-target.sqlThen migrate. This will transfer all archive data and update object ids on the target.
> geodatabase-scripts\sample-migrate-archive.batReview the archive migration logs, especially the final verifycounts-*.log. One or two _H tables consistently fail to transfer completely and will require attention. Don't read into the ESRI errors that indicate memory issues. "Memory" in this context appears to refer to some sort of internal constructor step, not memory exhaustion.
We will use HURRICANEEVACUATIONZONE in the examples below.
- Source: Reveal the _H table. From an SQL prompt connected as CSCL.
> call sde.nyc_archive_utils.reveal_history('HURRICANEEVACUATIONZONE');-
Using ArcCatalog classic (reminder why) manually copy/paste HURRICANEEVACUATIONZONE_H from source to target. This step may take a suspiciously long time.
-
Target: Update the values in src/sql/sample_finalize_one_archive.sql or use a premade src\sql\finalize_*_archive.sql script if we have been through these steps before.
> sqlplus %TARGETSCHEMA%/"%TARGETPASSWORD%"@%TARGETDB% @src/sql/sample_finalize_one_archive.sql- Source: Conceal the history table
> call sde.nyc_archive_utils.conceal_history('HURRICANEEVACUATIONZONE');These steps apply to _H tables that exist and are populated with some, but not all, rows. We will use SCHOOLDISTRICT as the example.
The steps must be followed precisely (details).
-
Target: Using ArcGIS Pro disable archiving and choose the option to delete the _H table
-
Source: Reveal the _H table. From an SQL prompt connected as CSCL.
> call sde.nyc_archive_utils.reveal_history('SCHOOLDISTRICT');-
Using ArcCatalog classic (reminder why) manually copy/paste SCHOOLDISTRICT from source to target. This step may take a suspiciously long time.
-
Target: Update the values in src\sql\sample_finalize_one_archive.sql or use a premade src\sql\finalize_*_archive.sql script if it exists.
> sqlplus %TARGETSCHEMA%/"%TARGETPASSWORD%"@%TARGETDB% @src/sql/sample_finalize_one_archive.sql- Source: Conceal the history table
> call sde.nyc_archive_utils.conceal_history('SCHOOLDISTRICT');Run (or re-run) a complete verification against the target.
Complete verification does the following:
- Runs data-owner verification. This includes catalog verification, domain verification (if the owner is CSCL), and source vs target row count verification.
- Stops immediately if data-owner verification fails.
- When the target schema is CSCL, runs readonly-user verification
- For each readonly user, verifies access to all data owner content
- Returns failure if any readonly user verification fails
> geodatabase-scripts\sample-complete-verification.batTo prevent catastrophe the teardown script will only proceed if a registered table named UNLOCK_TEARDOWN exists in the schema. Manually create this empty table to unlock teardown.
> geodatabase-scripts\sample-teardown.bat"A day."
| Step | Duration in Hours |
|---|---|
| 1. Extract And Prepare CSCL | 1 |
| 2. Remove Class Extensions | 0 |
| 3. Correct Resolution And Tolerance | .5 |
| 4. Load To Enterprise Geodatabase | 1 |
| 5. Migrate Archive Classes | 4 |
| 6. Manually Migrate Failed Archive Classes | .5 |
| 7. Complete Verification | 0 |
| Teardown | .1 |
