开发者

DB2 REORG TABLE from client side with Migrator.NET

I'm using Migrator.NET with a DB2 database and my current migration executes an ALTER TABLE statement, which causes the table to go into the "reorg pending state". This state requires the reorganisation of the table with > REORG TABLE TableName before I can do anything else with it.

I tried executing this with

Database["DB2"].ExecuteNonQuery("REORG TABLE MyTable");

but it fai开发者_JAVA技巧led because apparently the REORG command is server side only and can't be called from the client. Then I tried creating a stored procedure which calls the REORG statement but am struggling with the correct syntax.

Can anyone suggest a solution to this problem?


I found a solution:

Database["DB2"].ExecuteNonQuery("call SYSPROC.ADMIN_CMD ('REORG TABLE MyTable')");

Link to ADMIN_CMD documentation

In DB2 9.7 it's also possible to use this procedure: ADMIN_REVALIDATE_DB_OBJECTS()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜