all groups > sql server programming > december 2005 >
You're in the

sql server programming

group:

Moving transaction log file


Moving transaction log file Venkat
12/19/2005 10:43:34 PM
sql server programming: Hi folks,

Currently I have data file and transaction log file on the same drive. I
want to move the transaction log file to a different drive without any
outage to the database. What is the best way to do this.

Thanks in advance.

-----

Re: Moving transaction log file Venkat
12/19/2005 11:04:51 PM
Hi,

Detach and Attach will have some outage to the database. I am looking
for an option which does not invlove any outage to the database.

Thanks.

-----

Re: Moving transaction log file m.bohse NO[at]SPAM quest-consultants.com
12/20/2005 2:24:37 AM
[quoted text, click to view]
* Use DBCC SHRINKFILE with the empty file option to finally remove the
original
* log file using ALTER DATABASE. I'm not sure whether SQL Server allow
you to remove the very first
* log file that a database had, though, so make sure you first try on a
test system.

No, SQL Server won't allow you to remove the primary transaction
logfile. Tried it just last week, you'll get the following error:
Server: Msg 5020, Level 16, State 1, Line 1
The primary data or log file cannot be removed from a database.

Markus
Re: Moving transaction log file Uri Dimant
12/20/2005 8:50:38 AM
You will have to detach the database first , then to separate a mdf and ldf
file and re-attach the database

Pls refer to the BOL for more details

sp_detach ,sp_attach stored procedures



[quoted text, click to view]

Re: Moving transaction log file Tibor Karaszi
12/20/2005 9:36:23 AM
No such option. You could create another log file on the other drive, meaning for a while you have
two log files. Then use DBCC LOGINFO etc to watch and see when your original log file is unused by
virtual log file and try DBCC SHRINKFILE with the empty file option to finally remove the original
log file using ALTER DATABASE. I'm not sure whether SQL Server allow you to remove the very first
log file that a database had, though, so make sure you first try on a test system.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/


[quoted text, click to view]
Re: Moving transaction log file Rogas69
12/20/2005 10:56:07 AM
Last time I tried to move log file to other disk I forgot to set database
offline and it went corrupted. I couldn't recover database, fortunately it
was only a test one.
BOL states clearly that you have to set db offline before mooving files:
1.. Run ALTER DATABASE database_name SET OFFLINE.


2.. Move the file to the new location.


3.. Run ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name,
FILENAME = 'new_path/os_file_name'.


4.. Run ALTER DATABASE database_name SET ONLINE.
Peter

Re: Moving transaction log file Roji. P. Thomas
12/20/2005 12:33:53 PM
http://support.microsoft.com/default.aspx?scid=kb;en-us;224071

--
Roji. P. Thomas
Net Asset Management
http://toponewithties.blogspot.com


[quoted text, click to view]

Re: Moving transaction log file Ramunas Balukonis
12/20/2005 4:31:50 PM
Another option is to backup database and then restore with "move" option.
Before backing up, set "read only" option on your database and remove "read
only" after you did a restore. May this will be a minimal outage on your
database.

Ramunas Balukonis

"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:Ockc1BUBGHA.3400@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button