Showing posts with label locking. Show all posts
Showing posts with label locking. Show all posts

Monday, March 12, 2012

Issue with shrink database.

When i try to shrink the database, i am getting the following error:
Cannot use the PAGE granularity hint on the table "dbo.salary" because locking at the specified granularity is inhibited.
DBCC SHRINKDATABASE: Heap page 1:422421 could not be moved.
The statement has been terminated.
DBCC execution completed. If DBCC printed error messages, contact your system administrator. (.Net SqlClient Data Provider)

Any help apreciated...My issue is fixed now..Previously i didn't have cluster index on table and have non-clustered indexes. So i created the cluster indexes and tried shrink database, now it is not giving the error.
:)|||Unless you are running out of disk space, don't shrink your database files. It is time consuming for SQL Server to increase them again.

Wednesday, March 7, 2012

Issue with File System Task and folder locking

I'm having an issue where a folder that I'm accessing in an SSIS package gets locked up and cannot be deleted by my package later in the process.

1) I use a File System task to rename the folder. At this point, it appears to become locked and cannot be deleted.

2) Later I attempt to delete the folder using another File System task object. I get the error '[File System Task] Error: An error occurred with the following error message: "The process cannot access the file because it is being used by another process."'.

My package accesses the folder via a drive mapping. This seems to be part of the problem, as it's possible to delete the folder directly but not via the drive mapping. Even once the package completes it's still not possible to delete the folder in Windows Explorer via the drive mapping.

I've since rebooted my machine and re-created the network drive mapping and the problem has gone away.