Solved

disable logs sql 2000

Posted on 2007-04-05
6
287 Views
Last Modified: 2008-02-01
We are having drive issues and we need to disable log file.  What script do I need to use to do this?  we are only going to keep the mdf file until we get better hardware
0
Comment
Question by:yanci1179
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
DocGyver earned 400 total points
ID: 18860616
Well you can't drop your logs but you can switch to Simple recovery model and do regular backups or Full Recovery and do regular Transaction log backups followed by a shrink file.

The latter is most likely the easiest.

Go to Enterprise Manager and right click on the database and select properties.  In that dialog go to the options tab and choose Full recovery model if it isn't already selected.

Then setup a job that runs periodically (every half hour or so I'd guess) that does:
BACKUP LOG yourDatabase WITH TRUNCATEONLY

It won't get rid of the log but it will keep it small.

Of course I among others will tell you this can put you in a tenous situation with respect to recovery.  Be sure you are doing good backups.

Doc..
0
 
LVL 6

Expert Comment

by:DocGyver
ID: 18860670
Oops.  Forgot to include the shrinkfile.  While you are in the properties look at the Transaction Log tab and wee what the "File Name" is for your transaction log.  It is usually something like 'yourDatabase_LOG'.  Add to the job you created above:

DBCC SHRINKFILE ( yourDatabase_LOG )
0
 

Author Comment

by:yanci1179
ID: 18861018
if i can't disable the .ldf file what script can i use to point it to another disk?
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 16

Assisted Solution

by:rboyd56
rboyd56 earned 100 total points
ID: 18861061
You can user Alter Database. Here is an example from books on line. This adds 2 log files.

USE master
GO
ALTER DATABASE Test1
ADD LOG FILE
( NAME = test1log2,
  FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\test2log.ldf',
  SIZE = 5MB,
  MAXSIZE = 100MB,
  FILEGROWTH = 5MB),
( NAME = test1log3,
  FILENAME = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\test3log.ldf',
  SIZE = 5MB,
  MAXSIZE = 100MB,
  FILEGROWTH = 5MB)
GO



Just change the parameters to match your situation
0
 

Author Comment

by:yanci1179
ID: 18861143
We want to put the ldf file on the same drive as the database server, are there any performance issues in doing this?
0
 
LVL 6

Assisted Solution

by:DocGyver
DocGyver earned 400 total points
ID: 18865512
Normally you want to have 3 (at least) physical drives involved.  The first drive for the OS, the next for data, and the last for logs.  Those drives may each or individually be made up of multiple drives if, say, they are a RAID volume.

The reason for this is that when you write data then the data goes into both the mdf file and gets logged into the ldf file.  Depending on the recovery model not all things are logged but in general you should think of both the mdf and ldf files being active at the same time. Putting the OS and applications on a third drive is to protect you from bad things happening from untrolled growth.  If the OS disk gets full then bad things happen.

So the short answer is yes there are performance issues that arise from combining any two of the three.

With that said I can tell you that if you are having terrible performance and are trying to just "get by" for a while then you might put the ldf file on the same disk as the OS but still separate from the mdf but be sure to monitor things well to make sure you are leaving a good portion of that drive empty.  When there is less than 30% or 1 gig left on the OS drive I begin to get nervous.

Doc..
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now