Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    7

    Unanswered: Log Files - How To Clean Up

    I had received a message that my log file is full and it do not enable to me to do a database backup before free up disk space. How do i clean up de log file (_log.ldf)?

  2. #2
    Join Date
    Jun 2003
    Posts
    269
    check 'dbcc shrinkfile' in BOL,
    Code:
    dbcc shrinkfile('db_log',size,truncateonly)
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  3. #3
    Join Date
    Nov 2003
    Posts
    7
    Thanks, mallier, but my _log.ldf is on another disk driver under mssql\data folder. After executing the command you wrote, i got a message 'not found in the system files'

  4. #4
    Join Date
    Jun 2003
    Posts
    269
    run this query to get the log name in ur db
    Code:
     
    select *from sysfiles 
    -- u will get log name from name column with extension '_Log'
     
    --replace that  name in 'db_Log'
    I love cursor,though I never use it.Cos' I dont want to misuse it.
    ----------------------------------------------

    ----cheers
    ----http://mallier.blogspot.com

  5. #5
    Join Date
    Nov 2003
    Posts
    7
    ok, mallier, excuse me again, but the _log.ldf is 18GB great yet. Some system table was updated after the last command you wrote, but i need clean that _log.ldf to free up space in the disk drive.

  6. #6
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    put the database in simple recoverry mode. Checkpoint the database. Backup the database. open QA. run "sp_helpdb (dbname). Find the file number for the log. execute dbcc shrinkfile(<file number for the log.).

    -- This is all just a Figment of my Imagination --

Posting Permissions

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