title: How to shrink a database in MS SQL Server if the drive is full?
body: <p>I am having issue with SQL Server where I Can't execute any queried because the Hard Drive that hosts the databases is full. 
  I tried to shrink the database using the "Shrink" function in MS SMS but that did not work because the disk space is full.</p>
  
  <p>How can I truncate the logs without crashing the database but also shrink the size?</p>
  
  <p>I tried the following also</p>
  
  <pre><code>USE myDatabaseName;
  GO
  -- Truncate the log by changing the database recovery model to SIMPLE.
  ALTER DATABASE myDatabaseName
  SET RECOVERY SIMPLE;
  GO
  -- Shrink the truncated log file to 1 MB.
  DBCC SHRINKFILE (myDatabaseName_Log, 1);
  GO
  -- Reset the database recovery model.
  ALTER DATABASE myDatabaseName
  SET RECOVERY FULL;
  GO
  </code></pre>
  
  <p>but got the following error</p>
  
  <pre><code>Msg 3023, Level 16, State 3, Line 2
  Backup and file manipulation operations (such as ALTER DATABASE ADD FILE) on a database must be serialized. Reissue the statement after the current backup or file manipulation operation is completed.
  Msg 5069, Level 16, State 1, Line 2
  ALTER DATABASE statement failed.
  </code></pre>
  
  <p>Thanks</p>