Search code examples
sql-serverdynamics-crmsql-server-2014logfile

Shrink Database Log file for Microsoft Dynamics CRM


I have Microsoft Dynamics CRM 2015 and the database file (.mdf) is around 20 Gb and the Log file (.ldf) is about 550 Gb. I tried shrinking ldf file as discussed in this link

However, after the database log file was shrink, CRM stopped working. Can anyone advise.


Solution

  • CRM stopped working

    What error messages do your receive?

    Just based on my assumptions:

    Obviously that database is not in a SIMPLE recovery mode and no scheduled backup of the transaction log configured.

    1. First of all, make sense to check why you cannot shrink the log:
    SELECT
        name,
        log_reuse_wait_desc,
        recovery_model_desc
        FROM sys.databases
    WHERE name = 'yourDB'
    
    1. Then, you may set the database to a SIMPLE recovery:

    ALTER DATABASE [yourDB] SET RECOVERY SIMPLE

    OR, fix your backup of transaction log if, this is a reason

    1. then you have to shrink the log:

    USE [yourDB] DBCC SHRINKFILE (2, 256)

    When your database back to the operational state you have to decide what kind of backup scheme do you want yo have:

    • Full/diff backups per day every night
    • Full/diffs overnigt and Transactional backups every n minutes.

    Depends on a choice, you will have to stay with SIMPLE recovery or switch back to FULL, but add missing scheduled backups of your transaction log