Transaction logs path in SQL 2005

In SQL 2005 ,how can I change the path where the transaction logs are saved.Also is there a way that I can control the size of these logs.So that it doesn't fill up the disk.
LVL 7
life_jAsked:
Who is Participating?
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
1.Dettach the database by


USE master
go
exec sp_detach_db 'databasename'


2. copy the log file to desired destination
3.Attach the database, this time mentioning the new location for ldf.


EXEC sp_attach_db @dbname = N'databasename',
   @filename1 = N'<path>\databasedata.mdf',
   @filename2 = N'< new path>\databaselog.ldf'
0
 
life_jAuthor Commented:
Is there a way I can do this for the whole of SQL server databases instead of changing for each database.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
life_jAuthor Commented:
Aneesha

I am new to SQL server.

Where do I need to run

USE master
go
exec sp_detach_db 'databasename'
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
in a new Query window
0
 
imran_fastCommented:
>>I am new to SQL server.
>>USE master
>>go
>>exec sp_detach_db 'databasename'

You have to run this command in sql management studio after clicking on new query
or
You can simply right click on your database in sql mangement sudion all task and then detach.


0
 
life_jAuthor Commented:
Is there a way that I can change the transaction logging for all the databases.
0
 
imran_fastConnect With a Mentor Commented:
No,
 you have to either detach and then copy the file for each database on different location and then attach it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.