The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

sql server log file

Last post 11-22-2007, 16:20 by Dinesh Priyankara. 5 replies.
Sort Posts: Previous
  • sql server log file

     04-03-2007, 5:16

    • Joined on 04-03-2007
    • Posts 1
    • Points 0
    • Top 75 Contributor

    Hi,

    Increasing the size of the log file of a SQL server DB is a big issue for me.

    a) Can I Instruct to SQL server to stop writing to log file? If so how?

    b) Can I instruct SQL server to delete the log file and create a fresh log file automatically on daily basis? If so how?

    c) Or does any body have an another solution for my issue? If so what is it?

    Thanks in advance

  • Re: sql server log file

     04-06-2007, 5:52

    • Joined on 03-26-2007
    • Colombo
    • Posts 21
    • Points 0
    • Top 10 Contributor
      Male

    a) you can change the recovery mode of your database to simple. ( I think it is full now ) BUT IT IS NOT ADVISABLE TO CHANGE THIS. In case of a data recovery you will not be able to recover if you have a simple recovery method.

     

    b) yes you can.

    Deatatch Db

    Delete Log

    Attach Mdf file .

    ( I have bad expereces on this when there are multiple log files in database)

    Also , you can have Backup NO LOG

    BACKUP LOG AdventureWorks WITH NO_LOG;
    This is absolutely not recommended because it breaks the log chain, the series of log backups from which you would recover your database to a point in time. Microsoft recommends running a full backup immediately after using this statement.

    c) Put this command in job and schedule it

     


    Blog: http://dineshasanka.spaces.live.com
  • Re: sql server log file

     04-07-2007, 1:57

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 102
    • Points 0
    • Top 10 Contributor
      Male
    Hi,

    Alternate solution is, implement a maintenance plan with regular backup and shrinking operation. Backup log operation will truncate the inactive transactions in the log file (or you can perform BACKU P LOG WITH TRUNCATE_ONLY option) and shrinking the log file release the unused space to the OS.

  • Re: sql server log file

     07-28-2007, 12:58

    • Joined on 03-26-2007
    • Colombo
    • Posts 21
    • Points 0
    • Top 10 Contributor
      Male

    This may be dealyed answer. Sorry about it

    Log file is usefull for data recovery. After taking a Full backup, you can truncate log by BACKUP NO LOG command. But make sure that you do this after taking a full backup for safety reasons.

     Apart from this, check your recovery method. If you changed your recovery method to simple u won't get huge log file. BUT This ot advisable as you may lost ability to recover your data when needed.

     


    Blog: http://dineshasanka.spaces.live.com
  • Re: sql server log file

     11-22-2007, 15:33

    • Joined on 11-22-2007
    • Posts 1
    • Points 0
    • Top 75 Contributor
    Can we have a database without a log file ??
  • Re: sql server log file

     11-22-2007, 16:20

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 102
    • Points 0
    • Top 10 Contributor
      Male
    Hi,

    You cannot create a database without a log file. Every database has one database file and one log file.

    You can write TSQL, CREATE DATABASE without specifying the log file, in that case, SQL Server will automatically creates the log file.

View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems