Thursday, March 28, 2013

Failed to lock <file> exclusively. Lock held by PID: xxxx

Error: Failed to lock <file> exclusively. Lock held by PID: xxxx

Details: This error occurs when attempting to startup database instance. The file in question usually named lk<SID>

Solution: Kill the process with PID xxxx (kill -9 xxxx)

Friday, March 15, 2013

SQL Server: Managing transaction logs

Today I learned something new - if truncating and shrinking transaction log does not seem to have any effect on transaction log's size, and the recovery mode is Full, one needs to change the mode to Simple, then shirnk the transaction log and change the mode back to Full.

The thing is that sometimes, when the database in Full recovery mode, the transactional log does not shrink, so this is the workaround.

This can also be done in production when necessary, but mirroring must be removed first and the reconfigured after everything is done.