iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 13, 2008
Rainbow Links
EarthWeb.com
 
May 13, 2008
MySpace Profile Page Resources
HTML Goodies
 
May 13, 2008
How to Upload Your Photos onto the Web
HTML Goodies
 
May 13, 2008
Email Marketing for MySpace Artists
HTML Goodies
 
May 13, 2008
Top Online Marketing Techniques
HTML Goodies
 
May 13, 2008
I want to create a site just like ____, is that a violation of...
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /MSSQL

SQL Running out of Physical Space 

  Views:    4136
  Votes:    3
by Fausto Miranda 2/04/05 Rating: 

Synopsis:

Here is a quick tip on how to recoup some space on you SQL server. Make sure you have shrunk all your databases and logs, maybe set a task to do it periodically
Pages: 
The Article

Here is a quick tip on how to recoup some space on you SQL server.

 

Make sure you have shrunk all your databases and logs, maybe set a task to do it periodically.

 

This procedure will make sure all database have enough space to process transactions. 

 

What it does not do is to physically shrink the logs, so you might end up running out of space anyway.

 

I found the following procedure simple and it saves me from having to add more disk space to my servers.

 

·        Identify all databases that have growing log files.

·        You need to have admin rights to the server and MS SQL.

·        Schedule and outage for the affected databases, make sure no users are connecting to these databases.  There is no need to stop/start SQL.  I prefer to stop MS SQL services.

·        Identify the location of your MDF and LDF files.

·        Detach the databases using sp_detach_db N'<Database Name>'

·        Find the LDF file for the detached database and delete it.  You can copy or rename the file, but move it away from it current location since you are trying to recuperate space.

·        Re-attach the database.  Use the following command to perform this operation:  sp_attach_single_file_db ‘<database name>’, ‘<database mdf file location>’

·        Restart SQL Services.

·        Update stats for all databases

 

This will reattach the database and create a new LDF file.  Depending on how the database is used this operation might need to be done frequently which could help make an argument to increase disk space on the server.  You could also have a dba look at the procedures of the database and identify what could be causing the log files to grow.

 

NOTE:  Remember to backup all databases before any changes are made.

Pages: 



 
  Sponsors