Solved

disable logs sql 2000

Posted on 2007-04-05
6
288 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to shrink a transaction log file down to a reasonable size.

895 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

13 Experts available now in Live!

Get 1:1 Help Now