FIX: ???? "DBCC CHECKDB" ?? ????? "DBCC CHECKTABLE" ?? ??????? ??? ????? ????? ???? XML ?? SQL Server 2005

?????? ????????? ?????? ?????????
???? ???????: 974985 - ??? ???????? ???? ????? ????? ??? ???????.
?????? Microsoft SQL Server 2005 ????????? ???? ???? ???? ???????. ??? ????????? ???????? ????? ?? ????? ???? ???? ????????? ??????? ????? ???? ??????? ?????? ???? ?? ??????? ?? SQL Server 2005 ??????? ???????.
????? ???? | ?? ????

???????

???? ??? ????????? ??????:
  • ?? Microsoft SQL Server 2005 ???? ???? ????? ??? ???? ?? ??? ?????? XML.
  • ????? ???? XML ?? ??????.
  • ????? ????? ALTER INDEX ?? ???? ????? ???? ??? ???? XML.
  • ????? ????? CHECKDB DBCC ?? ????? CHECKTABLE DBCC ??? ??????.
?? ??? ?????????? ??? ??????? ???? ???? ???????? ?????? ????? ????? ????? ???????:
msg 8964 ? ????? 16 ???? 1? ????? ?????
??? ????: ???? ???? 965578478 ?? ????? 1 ???? ?? ????? 72057594042515456 ???? ???? ??????? 72057594052083712 ????? (??? ???????? LOB). ?? ??? ??????? ??? ?????? ?? ?? ?????? ?? ???? (1:569) ?? ?????? 0 ?? ?? 1881079808 ????.

???? 3 ???? ?? ????? 1 ????? "sys.xml_index_nodes_ <xxxxxx>".

????

?? ????? ??????? ????? ???? ??????? ???? ??? ?? ??????? ???????? 6 ????? SQL Server 2005 ?????? ????? ?????? Service Pack 3. ????? ?? ????????? ??? ???? ??????? ???????? ??? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft" (????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
974648???? ??????? ???????? 6 SQL Server 2005 ?????? ????? ?????? Service Pack 3
?????? ??? ????????? ???????? ????? ?? ????? ????? ???? ???? ????????? ??????? ????? ???? ??????? ?????? ???? ?? ??????? ?? SQL Server 2005 ??????? ???????. ???? Microsoft ?????? ????? ???? ????? ??????? ???? ????? ??? ??? ??????? ??????. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft" (????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
960598???? SQL Server 2005 ???? ?? ??????? ??? ????? SQL Server 2005 ?????? ????? ?????? Service Pack 3
Microsoft SQL Server 2005 ??? ????? ????????? ??????? ??? ???? SQL Server ?????. ??? ????? ??????? ???? SQL Server 2005 ?????? ????? ?????? Service Pack 3 ??? ????? SQL Server 2005 ?????? ????? ?????? Service Pack 3. ???? ???????? ??? ????? ????????? ??????? ???????? ?? ???? ???? ?? SQL Server ?? ???? ???? ?? SQL Server ???????.

???? ??????

??????? ?????? ??? ??? ??????? ?????? ???? ????????? ?????????:

??????? ??????

????? ?? ????? ????? ?????? XML ????? ?? ????? ????? ALTER INDEX:

--------START OF THE SCRIPT--------------

----------Drop table named temp if it exists----------------
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[temp]') AND type in (N'U'))
DROP TABLE [dbo].[temp]


------------Create a tenp table to keep the information about existing XML indexes------------
Create table Temp (object_id int, index_id int, object_name varchar(256), IndexName nvarchar(256),Name nvarchar(256),
Secondary_type_desc nvarchar (240),Secondary_type char(1),Using_Xml_index_id int)


------------Insert XML index information into temp table----------------
Insert Into Temp
SELECT i.object_id,i.index_id,object_name(i.object_id)as object_name, i.name as IndexName
,c.name,i.Secondary_type_desc,i.Secondary_type,i.using_xml_index_id 
FROM sys.xml_indexes AS i
INNER JOIN sys.index_columns AS ic 
ON i.object_id = ic.object_id AND i.index_id = ic.index_id
INNER JOIN sys.columns AS c 
ON ic.object_id = c.object_id AND c.column_id = ic.column_id
Order by i.index_id



-------------Adding a new column for Manipulation------------
Alter table temp add IndName varchar(256) NULL;


-------------Updating value in column for Manipulation------------

Update Temp Set Secondary_type_desc = 'APRIMARY' Where Secondary_type_desc IS NULL



-------------Updating value in column for Manupilation------------

Update a set a.IndName = b.IndexName from temp a inner join temp b on a.using_xml_index_id = b.index_id and a.object_id = b.object_id



-------------Set Ansi_padding ON to create XML indexes------------

Set Ansi_Padding ON



--------Cursor to Drop existing XML Indexes------------

DECLARE XMLIndexDrop CURSOR 
READ_ONLY
FOR select 'Drop Index '+ IndexName +' on '+Object_name from temp where Secondary_type is null
DECLARE @DropString varchar(400)

OPEN XMLIndexDrop
FETCH NEXT FROM XMLIndexDrop INTO @DropString
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
exec(@DropString)
PRINT @DropString
END
FETCH NEXT FROM XMLIndexDrop INTO @DropString
END

CLOSE XMLIndexDrop

DEALLOCATE XMLIndexDrop
GO



--------Cursor to Create XML Indexes-------------

DECLARE XMLIndexCreate CURSOR 
READ_ONLY 
FOR Select 'CREATE ' + Case when Secondary_type_desc = 'APRIMARY' then 'PRIMARY XML'
Else 'XML' END + ' INDEX ' + IndexName +' on ' + object_name + ' ('+name+')'
+ Case when Secondary_type_desc = 'APRIMARY' then ''
Else ' USING XML INDEX ' + IndName + ' FOR ' + Secondary_type_desc END 
From Temp Order By Secondary_type_desc Asc

DECLARE @CreateString varchar(400)
OPEN XMLIndexCreate

FETCH NEXT FROM XMLIndexCreate INTO @CreateString 
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
exec(@CreateString )
PRINT @CreateString 
END
FETCH NEXT FROM XMLIndexCreate INTO @CreateString 
END


CLOSE XMLIndexCreate
DEALLOCATE XMLIndexCreate
GO


--------Closing the cursor--------------


--------END OF THE SCRIPT-------------- 



??????? 2

????? ???? ??????? XML ?? ?? ?????? ????? ALTER INDEX ??? ??????? ?? ??????. ??? ???? ?? ?????? ????? ????? XML.

?????

???? Microsoft ?? ??? ????? ?? ?????? Microsoft ??????? ?? ??? "????? ???".

?????

????? ?? ????????? ??? "????? ????? ??????" ?? SQL Server? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft" (????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
935897????? "????? ????? ??????" ?? ???? SQL Server ?????? ????????? ??????? ??????? ?? ??????? ????
????? ?? ????????? ??? ????? ?????? ??? SQL Server 2005 ?????? ????? ?????? Service Pack 3 ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft" (????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
913089????? ?????? ??? ???? ???? ???? ?? SQL Server 2005
????? ?? ????????? ??? ??????? ??????? ?? SQL Server 2005 ?????? ????? ?????? Service Pack 3 (SP3) ????????? ???????? ?? SQL Server 2005 ?????? ????? ?????? SP3 ?? ?????? ???? Microsoft ?????? ??? ?????:
http://go.microsoft.com/fwlink/?LinkId=131442
????? ?? ????????? ??? ???? ??????? ???????? SQL Server ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft" (????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
822499???? ????? ????? ??? ??????? ????? Microsoft SQL Server
????? ?? ????????? ??? ??????? ????? ??????? "? ???? ??? ??? ??????? ?????? ?????? ??" ????? ??????? ?? Microsoft "(????? ?? ??? ???????? ??? ???? ?? ???? ??????? ??? ?? ??? ??? ?????? ??????????):
824684??? ????????? ???????? ????????? ???? ??????? ????? Microsoft

???????

???? ???????: 974985 - ????? ??? ??????: 12/????? ??????/1431 - ??????: 2.0
????? ???
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Workgroup Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Standard Edition for Itanium Based Systems
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium Based Systems
????? ??????: 
kbmt kbsurveynew kbexpertiseadvanced kbqfe kbfix KB974985 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????974985

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com