I have a database that I am trying to recover space from, it consists mostly of unallocated space, but I can’t seem to get that unused space released. Database size: 40,245.13 MB DatafileMB: 38,063.63, DataAvailableMB: 37,085.15 LogfileMB: 2181.51 Sysfiles shows:[code="plain"]fileid groupid size maxsize growth status perf name1 1 4872144 -1 128 2 0 SomeDB2 0 279233 268435456 10 1048642 0 SomeDB_log[/code]The DB is in simple recovery mode. There are no open transactions (used dbcc opentran).The server is running SQL Server 2014 and the DB is in compatibility mode SQL Server 2008 (100). It was upgraded to 2014 a month or two ago.I have tried to re-size the log to 100mb, but any way I have tried (none gave errors), the log file remains the same size. I have tied to shrink the log file (through the UI and via DBCC commands) without success; no errors, but also no change in file size.I have checked Log Reuse Waits, just in case, and as expected it showed “NOTHING” (select log_reuse_wait_desc, name from sys.databases)I tried running a checkpoint, but that did not allow any resize or shrink to work. I have tied creating large transactions to move the used point in the log file, in case this was the issue. I did this by creating tables that I drop after large inserts. While it shows me that the log space % used increased, the log file still does not allow the space to be reduced.The following is what I was using for the transactions to get the log used.[code="plain"]BEGIN TRANselect a.* into testtable from sysobjects a, sysobjects b, sysobjects cROLLBACK TRAN[/code]Each insert creates 93,576,664 rows.Running dbcc SQLPerf(logspace) :[code="plain"]DB LogSize(MB) LogSpaceUsed(%) StatusSomeDB 2181.5 34.20489 0[/code]Running dbcc loginfo:[code="plain"]RecoveryUnitId FileId FileSize StartOffset FSeqNo Status Parity CreateLSN0 2 1143734272 8192 60 2 64 00 2 1143734272 1143742464 57 0 128 0[/code]Do I just need to continue running large transactions until the log space used gets high enough to get the “end point” in the log to really move? Is there an easier way to accomplish this (please tell me there is, I have several DBs that have the almost identical problem), what I am using moves the Log Space Percent Used about a percent on each execution.
↧