August 14, 2006 at 9:22 am
I get this error message when I attempt to backup a sql 2005 database. The databse is set to Simple recovery mode and I used the SSMS Database Maintenance Wizard to create the job. Any idea how to "enable page level locking?"
TIA,
Bill
Executing the query "ALTER INDEX [idx_ItemNum] ON [dbo].[ItemNum]
REORGANIZE WITH ( LOB_COMPACTION = ON )
" failed with the following error: "The index "idx_ItemNum" (partition 1) on
table "ItemNum" cannot be reorganized because page level locking is disabled.".
Possible failure reasons: Problems with the query, "ResultSet" property not
set correctly, parameters not set correctly, or connection not established correctly.
August 17, 2006 at 8:00 am
This was removed by the editor as SPAM
August 23, 2006 at 4:31 am
Page level locking can be set using the CREATE INDEX or ALTER INDEX statements :
ALTER INDEX index_name ON table_name SET (ALLOW_PAGE_LOCKS = ON)
The allow_page_locks column of sys.indexes view may help you find indexes having page level locking disabled.
Hope this helps.
Patrick
April 30, 2007 at 9:25 am
The problem is that I have also this porblem that appears spuriously from differents index on my development box.
I suspect a bug in the SQL Server management Studio, which turns the option on, when some other modifications are done to an index. This option is available from SSMS but hard to find, and the programmer who worked with the index was not even aware of it existance.
So even when watching carefully what happens we don't see where the option gets turned on.
I'm wondering if i could activate some DDL trigger to get prompted when this happen. Could be a solution.
I use SP2 latest with patches.
April 30, 2007 at 9:59 am
Found why....
By checking more how index are created by my developers, if found that one method for index creation is setting page level locking to on by default and the other is setting it to off.
If you set right click on index folder under a specific table, and you select new index, the option is set to off by default in index creation dialog. You have to go to the options page to turn it on.
If you go through the table context menu and select modify, to add an index, then the option is ON by default for the new index created.
I suspect that a lot of people are going to wonder why reorganize fail spuriously on some index on development boxes. Here you have an hint.
September 11, 2007 at 8:56 am
Interesting ideas.
What is the "recommended" approach -- enabling page level locking for index reoroganizaiton or not?
Barkingdog
September 11, 2007 at 11:28 am
Page level Locking is "ON" by default.
You should disable it only on *very rare* cases.
Nice SSMS BUG catch by the way !!!!
* Noel
September 11, 2007 at 7:14 pm
Is it a bug or did the boys in Redmond just decide to change a default like they did with the CONCATENATE NULL YIELDS NULL setting?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 9, 2008 at 1:47 pm
Thanks Patrick Schneider
Nice solution for this problem and your Provide solution
ALTER INDEX index_name ON table_name SET (ALLOW_PAGE_LOCKS = ON)
is working fine in my case.
Thanks & Regards
Shashi Kant chauhan
September 8, 2008 at 9:50 am
:)This is a good solution
SET NOCOUNT ON
DECLARE @DBName nvarchar(50), @INName nvarchar(50)
DECLARE @ODBName nvarchar(50), @OINName nvarchar(50)
Declare @execstr nvarchar(200)
--PRINT '-------- Vendor Products Report --------'
DECLARE Index_cursor CURSOR FOR
Select A.Name as InName,ob.Name as DBName from sys.indexes A
left outer join sys.objects ob on ob.object_id=A.Object_id
where allow_page_locks=0 and ob.type='U'
-- Select only allow_page_locks 0 and User Tables
OPEN Index_cursor
FETCH NEXT FROM Index_cursor
INTO @INName, @DBName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @DBName +' ' + @INName
--PRINT @INName
SET @ODBName = ltrim(rtrim(@DBName))
SET @OINName = ltrim(rtrim(@INName))
SELECT @execstr = 'ALTER INDEX '+@OINName+ ' ON '+
@ODBName+' SET (ALLOW_PAGE_LOCKS = ON)';
EXEC (@execstr);
FETCH NEXT FROM Index_cursor
INTO @INName, @DBName
END
CLOSE Index_cursor
DEALLOCATE Index_cursor
Cheers,
Ranjith:)
Ranjith Lekamalage
MCITP SQL 2012 (BI Development)
September 15, 2008 at 9:35 am
Thanks Ranjith. This was a great "quick fix" and now all our weekly database maintenance jobs are running sucessfully.
November 8, 2008 at 4:37 am
Exactly what i was after, many thanks!
March 2, 2009 at 8:12 am
Very nice! I was having the same issue with my "Reorganize Index Task". I added the above solution right to my maintenance plan, immediately before the Reorganize Index Task and it worked perfectly. It should also prevent any such issues from popping up down the road. Thanks.
E
March 22, 2010 at 12:27 am
Thanks for the quick fix,
I turned on locks
SET (ALLOW_PAGE_LOCKS = ON),
ran my job,
then switched it off again
SET (ALLOW_PAGE_LOCKS = OFF).
have fun
Ben:-D
June 3, 2010 at 9:19 am
SET NOCOUNT ON
DECLARE @DBName nvarchar(50), @INName nvarchar(50)
DECLARE @ODBName nvarchar(50), @OINName nvarchar(50)
Declare @execstr nvarchar(200)
--PRINT '-------- Vendor Products Report --------'
DECLARE Index_cursor CURSOR FOR
Select A.Name as InName,ob.Name as DBName from sys.indexes A
left outer join sys.objects ob on ob.object_id=A.Object_id
where allow_page_locks=0 and ob.type='U'
-- Select only allow_page_locks 0 and User Tables
OPEN Index_cursor
FETCH NEXT FROM Index_cursor
INTO @INName, @DBName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @DBName +' ' + @INName
--PRINT @INName
SET @ODBName = ltrim(rtrim(@DBName))
SET @OINName = ltrim(rtrim(@INName))
SELECT @execstr = 'ALTER INDEX '+@OINName+ ' ON '+
@ODBName+' SET (ALLOW_PAGE_LOCKS = ON)';
EXEC (@execstr);
FETCH NEXT FROM Index_cursor
INTO @INName, @DBName
END
CLOSE Index_cursor
DEALLOCATE Index_cursor
Thanks, this was a timesaver.
Edit: I didn't see the second page of the thread and therefore didn't realize so many people had already thanked him for this. Sorry to revive an old thread.
Viewing 15 posts - 1 through 15 (of 22 total)
You must be logged in to reply to this topic. Login to reply