在使用oracle数据泵来进行arcsde数据的逻辑迁移时,有时候会报如下错误: c:\impdp map/map tables=buildings directory=exp_imp_dir dumpfile=buildings.dmpimport: release 10.2.0.2.0 - production on tuesday, 22 january, 2008 16:38:00 copyright (c)
在使用oracle数据泵来进行arcsde数据的逻辑迁移时,有时候会报如下错误:
c:\>impdp map/map tables=buildings directory=exp_imp_dir dumpfile=buildings.dmpimport: release 10.2.0.2.0 - production on tuesday, 22 january, 2008 16:38:00 copyright (c) 2003, 2005, oracle. all rights reserved. connected to: oracle database 10g enterprise edition release 10.2.0.2.0 - productionwith the partitioning, olap and data mining optionsmaster table map.sys_import_table_01 successfully loaded/unloadedstarting map.sys_import_table_01: map/******** tables=buildings directory=exp_imp_dir dumpfile=buildings.dmpprocessing object type table_export/table/tableprocessing object type table_export/table/table_data. . imported map.buildings 1.005 mb 3149 rowsprocessing object type table_export/table/grant/owner_grant/object_grantprocessing object type table_export/table/index/indexprocessing object type table_export/table/index/tableprocessing object type table_export/table/index/table_data. . imported map.s1_idx{1}quot; 157.5 kb 4205 rowsprocessing object type table_export/table/index/domain_index/indexora-39083: object type index failed to create with error:ora-20091: import srid does not match st_spatial_references sridfailing sql is:beginsde.st_type_export.validate_spref(1,-1196.334263,-1028.576111,1000000,0,1,0,1,4267);commit; end;job map.sys_import_table_01 completed with 1 error(s) at 16:38:04
提示用户导入的空间投影信息srid与系统的srid不一致。空间的引用的元数据存储在 sde.st_spatial_reference 表中。sde.st_spatial_reference 表中的每个条目都有唯一的 srid 值和定义的空间参考属性的附加属性。为确保正在导入的空间索引的有效性,导出文件中的元数据要对比正在执行导入的数据库中的空间引用元数据。如果空间参照不存在,就会提示以上ora-20091和ora-39083错误。
也是也就是说你导入数据的包含的srid这个值,并没有与 sde.st_spatial_reference里面srid对应或者说该表中根本就没有导入数据的投影信息。
那么这种情况怎么办呢?那我们就需要将我们往数据库的文件的投影信息注册到arcsde库里面。其实注册很简单,假如说我们需要导入的数据的投影信息为nad_1983_stateplane_ohio_south_fips_3402_feet,但是sde.st_spatial_reference并没有该投影信息,那么我们就可以在该用户下创建一个该投影的数据集或者要素类即可,创建完毕之后,该投影信息就注册到arcsde里面了,而且也有自己的srid,那么我们就可以将刚才创建好的对象删除掉,但是注册到arcsde里面的sr信息并不会删除掉。
根据上面的错误,我们将索引表(s1_idx$)删除掉
processing object type table_export/table/table_data. . imported map.buildings 1.005 mb 3149 rowsprocessing object type table_export/table/grant/owner_grant/object_grantprocessing object type table_export/table/index/indexprocessing object type table_export/table/index/tableprocessing object type table_export/table/index/table_data. . imported map.s1_idx{1}quot;sql> drop table s1_idx$;table dropped.
然后我们查看一下刚才注册的投影信息
sql> select srid, sr_name from sde.st_spatial_references 2 where sr_name = 'nad_1983_stateplane_ohio_south_fips_3402_feet'; srid sr_name---------- ----------------------------------------------- 65 nad_1983_stateplane_ohio_south_fips_3402_feet
因为我们每一个以st_geometry存储的属性表在查看数据库都会有一个srid,而且我们已经将新的投影信息注册到我们导入的新库中,所以我们需要更新一下出错的那张表所有记录的srid
sql> update buildings t set t.shape.srid = 65;3149 rows updated.sql> commit;
更新完毕后,我们再重新创建空间索引即可
sql> create index buildings_shape_idx 2 on buildings (shape) indextype is sde.st_spatial_index 3 parameters ('st_srid=65 st_grids=200');index created.
特别注意:一般都不建议使用oracle的imp/impdp来对arcsde数据进行导出导出做迁移,因为这样对数据库技术要求比较高,特别是因为某些版本问题、字符集问题、序列问题、触发器问题、arcsde本身的问题导致的迁移出错,一般是很不好处理的,建议使用arcgis的迁移方式,数据源1-fgdb,fgdb-数据源2,是不是非常简单,而且不会出错!
-------------------------------------------------------------------------------------------------------
qq群: 78773981
blog: http://blog.csdn.net/linghe301
weibo: http://www.weibo.com/linghe301
-------------------------------------------------------------------------------------------------------