.LDF vs .ldf

  • run this statement

    CREATE DATABASE NEwDB2

    SELECT physical_name

    FROM sys.master_files WHERE name ='NEwDB2'

    DROP DATABASE NEwDB2

    some servers gave

    <C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\NEwDB2_log.LDF> and others gave

    <C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\NEwDB2_log.ldf>

    in a case sensitive environment this difference matters.

    Anyone know why the extensions could be different.

  • Take a look at the model database on the servers. I'm pretty sure that determines how things are set by default.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Log files

    Log files hold all the log information that is used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.

    SQL Server does not enforce the .mdf, .ndf, and .ldf file name extensions, but these extensions help you identify the different kinds of files and their use.

    The issue i have now is y sometimes the extention is upper LDF and at times its lower ldf. This does not matter in a case insensitive server but in a case sensitive system this code might fail:

    CREATE DATABASE [DB_TEMP$];

    SELECT

    @DefaultLogPath = REPLACE(physical_name, 'DB_TEMP$_log.ldf', '')

    FROM

    sys.master_files

    WHERE

    name = 'DB_TEMP$_log'

    DROP DB_TEMP$

  • Yep. I get it. Log files. Created when you create a database. The process of creating that database is to copy what's in the "model" system database. I suspect if that has different .LOG vs .log vs. .Log on different servers, you're going to see differences in the databases created there.

    Also a possibility, someone is restoring databases using WITH MOVE and not being consistent in their naming standards. Another possibility, someone is automating creating of databases using scripts and those scripts are inconsistent. This could have several causes.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Awesome. Let me look into the LOG vs log stuff.Thanks. As for the scripts we use they're pretty consistent. I"m doing a test on a Case sensitive environment which brought up this issue. will let u know.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply