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. What would you solve the is scenario [modified]

What would you solve the is scenario [modified]

Scheduled Pinned Locked Moved Database
databasetoolsquestion
2 Posts 2 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
    Skanless
    wrote on last edited by
    #1

    Your website is getting so many hits and visitors are running so many queries Temp DB logs starts growing exponentially thus your sites starts slowing down and even crashing. What would be the most effecient way to quickly clear temp DB without restarting the servers. I wrote this script which worked but it took a while, but it helped. Would you use another method is this script the best its gonna get? DBCC SHRINKFILE(‘YourDataBase_log’) BACKUP LOG YourDataBase WITH TRUNCATE_ONLY After that is done if the log files still have not shrunken then I do this: SET NOCOUNT ON CREATE TABLE dummy (a VARCHAR(8000)) WHILE (0 < 1) BEGIN INSERT INTO dummy SELECT REPLICATE(‘a’, 8000) DELETE FROM dummy END -- modified at 0:45 Tuesday 8th August, 2006

    Greg Coding makes the world go round!!!

    F 1 Reply Last reply
    0
    • S Skanless

      Your website is getting so many hits and visitors are running so many queries Temp DB logs starts growing exponentially thus your sites starts slowing down and even crashing. What would be the most effecient way to quickly clear temp DB without restarting the servers. I wrote this script which worked but it took a while, but it helped. Would you use another method is this script the best its gonna get? DBCC SHRINKFILE(‘YourDataBase_log’) BACKUP LOG YourDataBase WITH TRUNCATE_ONLY After that is done if the log files still have not shrunken then I do this: SET NOCOUNT ON CREATE TABLE dummy (a VARCHAR(8000)) WHILE (0 < 1) BEGIN INSERT INTO dummy SELECT REPLICATE(‘a’, 8000) DELETE FROM dummy END -- modified at 0:45 Tuesday 8th August, 2006

      Greg Coding makes the world go round!!!

      F Offline
      F Offline
      Frank Kerrigan
      wrote on last edited by
      #2

      Put tempdb on a seperate diskdrive if possible and this will also improve performance.


      Look where you want to go not where you don't want to crash. Bikers Bible

      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