Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

disable logs sql 2000

Posted on 2007-04-05
6
Medium Priority
?
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 6

Accepted Solution

by:
DocGyver earned 1600 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 16

Assisted Solution

by:rboyd56
rboyd56 earned 400 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 1600 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

688 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