Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2016
    Posts
    3

    Unanswered: Shrinkage of database log file

    Hi Experts ,

    I have Created a Database GTM where I have give my Path and file name in D Drive .Now I have to Reduce this GTM.ldf File which is located in D Drive has to be reduced because it is almost 20 GB .SO please kindly help me over this issue .

    When I Run the Query

    DBCC SHRINKFILE (GTM_log , 10)


    it gives Me with the following Error

    Could not locate file 'GTM_log' for database 'GTM' in sys.database_files. The file either does not exist, or was dropped.



    Regards
    Giri Prakash

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,445
    Provided Answers: 12
    Suggests that the file has a different logical name!
    Code:
    SELECT * FROM sys.database_files
    Pay special attention to the "name" column.
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,862
    Provided Answers: 17
    More likely the lack of quotes around the name is causing a problem.

    I typically use the file_id with SHRINKFILE, however. Use GVee's query to find the file_id for the log file (typically it is 2), and run the following:

    Code:
    dbcc shrinkfile (2, 10)
    It should be pointed out that the database would need to be in SIMPLE recovery mode, for this to work, and there is no guarantee that the log file will in fact shrink to that small of a size. The shrinking will stop at the current active transaction in the log, which could be anywhere in the file. Shrinking to a manageable size may take a couple tries.

  4. #4
    Join Date
    Dec 2016
    Posts
    3

    shrinkage of database ldf file

    Hi Gvee

    I have Already run that query Name and Physical Name

    Name Physical Name
    GTM_Live E:\SAP_LIVE\GTM_LIVE.mdf
    GTM_Live_log E:\SAP_LIVE\GTM_LIVE_log.ldf


    now I want to reduce ldf file E:\SAP_LIVE\GTM_LIVE_log.ldf located in this drive which is nearly 20 GB


    Regards
    Giri Prakash

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,445
    Provided Answers: 12
    So the logical *name* of the file is GTM_Live_log, which is what you need to use in your DBCC command.
    George
    Home | Blog

  6. #6
    Join Date
    Dec 2016
    Posts
    3

    Reply

    Hi Gveee


    I have run that but it gives me error


    Could not locate file 'GTM_Live_log' for database 'GTM' in sys.database_files. The file either does not exist, or was dropped.


    Regards
    Giri

  7. #7
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,862
    Provided Answers: 17
    Use the file id instead of the name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •