ArcGIS 创建要素时提示“表已经被注册(table already registered)”

今天一位实施大哥在ArcCatalog中要重建一个要素类,所以就在ArcCatalog中连接上Oracle数据库,直接删除了要素类,然后重新创建了一个新的要素类,可是却报错“表已经被创建”,并提示不可以在'sde_table_registry'表中插入重复的键值,记得以前碰到过这种状态,删除的不彻底,虽然将数据库中的数据表删除了,可以在sde用户下的元数据表中的记录没有被清除,导致再次创建时报错。

 

    既然如此,就到元数据表中将相关的信息删除掉好了,所以就到sde用户下删除了table_registry表中的相关记录,再次新建要素,这次又报出了一个错误,“图层已存在[Error executing stored procedure <schema>.layer_util.insert_layer::ORA-20019: Layer 4681 already exists.]”,看样子是还有图层信息没有清除干净,这就头疼了,虽然提示了存储过程,但也不知道图层信息保存在哪张表里面… 而且在下懒鬼也没有去看存储过程的具体内容,直接google之

 

   几番查找之后,找到了sde自带的取消表注册的命令:

  • sdetable -o unregister -t tablename

 执行之,再创建要素,果然就好使了,看样子,手动删除还是有些不靠谱啊 

  后找到sde文档查看了一下这个命令的说明,具体如下: 

Remove a table from the ArcSDE table registry

Use unregister to remove a table from the TABLE_REGISTRY table (SDE_table_registry in SQL Server databases).

sdetable -o unregister -t av.world -u av -p mo -i 7654

NOTE: Tables cannot be unregistered if they have been registered as multiversioned, are part of a geodatabase object, or have a spatial column. In all cases, the dependencies must be removed first or you must use the -F option.

To manually remove the dependencies, unregister the table from the geodatabase using ArcCatalog (if it has been registered with the geodatabase) and remove the spatial column (if it has one) using the sdelayer -o delete operation.

Alternatively, you can use the -F option to force the unregistering of the table. However, when you do so, all edits stored in the delta tables are lost. The table will not be unregistered with the geodatabase.

 

来自 <http://help.arcgis.com/en/geodatabase/10.0/admin_cmds/Support_files/datamgmt/sdetable.htm#xunregister

大体就是说使用unregister可以从table_registry(在SQL Server中叫做SDE_table_registry)表中删除一个表记录,但是被删除表如果已经被注册为多版本,或是一个地理数据库对象的一部分,或是有一个空间列,则不能被取消注册,在任何情况下都应该先删除这些依赖关系才能再取消注册,或者也可以使用-F选项。大概是这么个意思,不过具体需要怎么取消依赖,毕竟笔者对ArcGIS不熟悉,也不甚了解。 

不过从上面来看,unregister操作应该不仅仅只是删除了table_registry表中的记录那么简单,估计还有一些其他表的依赖需要处理,否则开始直接删除table_registry表中的记录也不会仍不能新建同样的要素类了,看样子,以后还是不要乱动sde的元数据表比较好,应该尽量选择使用sde提供的命令行工具。

posted @ 2015-12-20 16:04  baiyangcao  阅读(3104)  评论(0编辑  收藏  举报