reduce trans log size; help needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NOSPAM

    reduce trans log size; help needed

    Hello,

    I am hoping you can help me with the following problem; I need to process
    the following steps every couple of hours in order to keep our Sql 2000
    database a small as possible (the transaction log is 5x bigger than the db).

    1.back-up the entire database
    2.truncate the log
    3.shrink the log
    4.back-up once again.

    As you may have determined, I am relatively new to managing a sql server
    database and while I have found multiple articles online about the topics I
    need to accomplish, I cannot find any actual examples that explain where I
    input the coded used to accomplish the above-mentioned steps. I do
    understand the theory behind the steps I just do not know how to accomplish
    them!

    If you know of a well-documented tutorial (Aside from Books Online (F1)),
    please point me in the right direction.

    Regards.


  • Oscar Santiesteban Jr.

    #2
    Re: reduce trans log size; help needed

    First, create a backup device with whatever name you want. ( I assume you
    know how to do this).
    Might have to check the syntax on each of these but here goes

    1. backup database [your_database_n ame] to [your_backup_dev ice] with stats,
    init
    2. backup tran [your_database_n ame] to [your_backup_dev ice]
    3. dbcc shrinkfile 2,truncateonly
    4. backup database [your_database_n ame] to [your_backup_dev ice]

    Step 3 above assumes that file 2 is the logfile for your database. You
    might have to check this by issuing a select * from sysfiles (in query
    analyzer) to make sure that file 2 is the log file.

    Hope this helps.

    Oscar....
    [color=blue]
    >
    > 1.back-up the entire database
    > 2.truncate the log
    > 3.shrink the log
    > 4.back-up once again.
    >
    > As you may have determined, I am relatively new to managing a sql server
    > database and while I have found multiple articles online about the topics[/color]
    I[color=blue]
    > need to accomplish, I cannot find any actual examples that explain where I
    > input the coded used to accomplish the above-mentioned steps. I do
    > understand the theory behind the steps I just do not know how to[/color]
    accomplish[color=blue]
    > them![/color]


    Comment

    Working...