Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. transaction log in sql server 2000

transaction log in sql server 2000

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sohne
    wrote on last edited by
    #1

    tran log of my database is now hge in size and my disc space is almost full. what do i do now? should i take backup of tran log or change the path of transaction log file to another disc location.. please suggest..

    M G 2 Replies Last reply
    0
    • S sohne

      tran log of my database is now hge in size and my disc space is almost full. what do i do now? should i take backup of tran log or change the path of transaction log file to another disc location.. please suggest..

      M Offline
      M Offline
      Mark J Miller
      wrote on last edited by
      #2

      I'm assuming you aren't backing up your transaction log at all. If that is the case then change the recovery model of your database to Simple. Then detach your database, delete the transaction log file and re-attach your database. A new log file will be created for you. To set your recovery model to simple use: ALTER DATABASE [databasename] SET RECOVERY SIMPLE Do NOT do this while users are logged in. Wait for a time when there is no activity on your database. If you don't have a maintenance window which allows you to do this you will need to truncate your log and then shrink it. To shrink your transaction log file, first get the logical name of your transaction log by running sp_helpdb 'your database name'. There will be 2 resultsets, the second one will have a column "name", for the row that refers to your log file, that is the logical name. Then you can run the following script: BACKUP LOG [Database Name] WITH TRUNCATE_ONLY GO DBCC SHRINKFILE([LOGICAL FILE NAME], [SIZE]) GO where [size] is an integer value in megabytes. Again, this is only if you are not using your transaction log. The commands will be different if you need to backup your log file. Refer to BOL.

      Mark's blog: developMENTALmadness.blogspot.com Funniest variable name: lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher

      S 1 Reply Last reply
      0
      • M Mark J Miller

        I'm assuming you aren't backing up your transaction log at all. If that is the case then change the recovery model of your database to Simple. Then detach your database, delete the transaction log file and re-attach your database. A new log file will be created for you. To set your recovery model to simple use: ALTER DATABASE [databasename] SET RECOVERY SIMPLE Do NOT do this while users are logged in. Wait for a time when there is no activity on your database. If you don't have a maintenance window which allows you to do this you will need to truncate your log and then shrink it. To shrink your transaction log file, first get the logical name of your transaction log by running sp_helpdb 'your database name'. There will be 2 resultsets, the second one will have a column "name", for the row that refers to your log file, that is the logical name. Then you can run the following script: BACKUP LOG [Database Name] WITH TRUNCATE_ONLY GO DBCC SHRINKFILE([LOGICAL FILE NAME], [SIZE]) GO where [size] is an integer value in megabytes. Again, this is only if you are not using your transaction log. The commands will be different if you need to backup your log file. Refer to BOL.

        Mark's blog: developMENTALmadness.blogspot.com Funniest variable name: lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher

        S Offline
        S Offline
        sohne
        wrote on last edited by
        #3

        thanx a lot... i just did as per ur procedure..

        1 Reply Last reply
        0
        • S sohne

          tran log of my database is now hge in size and my disc space is almost full. what do i do now? should i take backup of tran log or change the path of transaction log file to another disc location.. please suggest..

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #4

          In answer to your question:

          sohne wrote:

          change the path of transaction log file to another disc location..

          It's a good idea to keep the transaction log on a different disk to the database - doing this will speed up SQL Server.

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups