积极答复者
重建出问题

问题
-
执行查询“ALTER INDEX [PK_ADMNG] ON [dbo].[ADMNG] REBUILD WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, SORT_IN_TEMPDB = OFF, ONLINE = ON )
”失败,错误如下:“不能对索引 'PK_ADMNG' 执行联机索引操作,因为该索引包含数据类型为 text、ntext、image、varchar(max)、nvarchar(max)、varbinary(max) 或 xml 的列 'NG002'。对于非聚集索引,该列可能是索引的包含列;对于聚集索引,它可能是该表的任何列。如果为 drop_existing,则该列可能是新索引或旧索引的一部分。该操作必须离线执行。”。失败的原因可能有: 查询本身有问题、未正确设置 "ResultSet" 属性、未正确设置参数或未正确建立连接。以上是错误提示,是通过SQL2005系统建的重建索引,请问要如何处理?或有改善改方法
答案
-
你好,
我想问下你的SQL2005的edition是什么?只有SQL2005 enterprise在重建索引时支持ONLINE=ON;其他的都不支持。
因此如果你的SQL2005不是enterprise的话,那你只能把 ONLINE = ON 改为 ONLINE = OFF ;如果你的SQL2005是enterprise,你可以参考下面的信息进行修改:http://www.hanwangtx.com/sql/201209_26518.html .
Alter Index: http://msdn.microsoft.com/zh-cn/library/ms188388(v=sql.90).aspx .
Thanks,
Amy Peng
- 已编辑 Amy PengMicrosoft employee, Moderator 2012年10月17日 6:20
- 已标记为答案 Amy PengMicrosoft employee, Moderator 2012年10月22日 6:10
全部回复
-
像rmio大侠说的, rebuild clustered index online 是有限制条件的,查一下表ADMNG是不是报还那些限制列。如果包含的话将ONLINE = OFF
When you perform online index operations, the following guidelines apply:
- Clustered indexes must be created, rebuilt, or dropped offline when the underlying table contains large object (LOB) data types: image, ntext, text, varchar(max), nvarchar(max), varbinary(max), and xml.
- Nonunique nonclustered indexes can be created online when the table contains LOB data types but none of these columns are used in the index definition as either key or nonkey (included) columns. Nonclustered indexes defined with LOB data type columns must be created or rebuilt offline.
- Indexes on local temp tables cannot be created, rebuilt, or dropped online. This restriction does not apply to indexes on global temp tables.
-
你好,
我想问下你的SQL2005的edition是什么?只有SQL2005 enterprise在重建索引时支持ONLINE=ON;其他的都不支持。
因此如果你的SQL2005不是enterprise的话,那你只能把 ONLINE = ON 改为 ONLINE = OFF ;如果你的SQL2005是enterprise,你可以参考下面的信息进行修改:http://www.hanwangtx.com/sql/201209_26518.html .
Alter Index: http://msdn.microsoft.com/zh-cn/library/ms188388(v=sql.90).aspx .
Thanks,
Amy Peng
- 已编辑 Amy PengMicrosoft employee, Moderator 2012年10月17日 6:20
- 已标记为答案 Amy PengMicrosoft employee, Moderator 2012年10月22日 6:10
-
你好,
这是微软的官网上引用的, 可以参考下面的文章:http://msdn.microsoft.com/zh-cn/library/ms188388(v=sql.90).aspx.
Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.
- 已编辑 Amy PengMicrosoft employee, Moderator 2012年10月17日 6:20