Unix Technical Forum

How to move transaction logs on-line?

This is a discussion on How to move transaction logs on-line? within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi all, I have a database with 20GB transaction log file. The recovery model of the database is Full. ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:49 PM
nai
 
Posts: n/a
Default How to move transaction logs on-line?

Hi all,

I have a database with 20GB transaction log file.
The recovery model of the database is Full.
I need to move the T. log file to a new location with the minimal
downtime.
I know I can do this by dettaching the DB, copying the T. Log and
attaching it at the new location. This will take some time though as
copying the T. log file will take up some time.

I thoght that I could maybe create a secondary T. log file and delete
the primary T. log file.
What does it take so I'm able to delete the primary T. log file? Can
you please explain how to accomplish this?

Also, if you can figure out of a better way, then please let me know.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:50 PM
Robert Klemme
 
Posts: n/a
Default Re: How to move transaction logs on-line?

nai wrote:
> Hi all,
>
> I have a database with 20GB transaction log file.
> The recovery model of the database is Full.
> I need to move the T. log file to a new location with the minimal
> downtime.
> I know I can do this by dettaching the DB, copying the T. Log and
> attaching it at the new location. This will take some time though as
> copying the T. log file will take up some time.
>
> I thoght that I could maybe create a secondary T. log file and delete
> the primary T. log file.
> What does it take so I'm able to delete the primary T. log file? Can
> you please explain how to accomplish this?
>
> Also, if you can figure out of a better way, then please let me know.


Do you regularly do backups and shrink the TX log? If not, that's the
first thing I'd do.

Kind regards

robert

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 07:50 PM
Cimode
 
Posts: n/a
Default Re: How to move transaction logs on-line?

1)backup you log to a specific local location...
2) copy it on another machine (using xp_cmdshell)
3) call for a restore log by remotely calling a repote procedure on the
destination instance (you need to declare the remote instance as a
linked server first though)

Hope this helps...
nai wrote:
> Hi all,
>
> I have a database with 20GB transaction log file.
> The recovery model of the database is Full.
> I need to move the T. log file to a new location with the minimal
> downtime.
> I know I can do this by dettaching the DB, copying the T. Log and
> attaching it at the new location. This will take some time though as
> copying the T. log file will take up some time.
>
> I thoght that I could maybe create a secondary T. log file and delete
> the primary T. log file.
> What does it take so I'm able to delete the primary T. log file? Can
> you please explain how to accomplish this?
>
> Also, if you can figure out of a better way, then please let me know.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 07:50 PM
Erland Sommarskog
 
Posts: n/a
Default Re: How to move transaction logs on-line?

nai (nioannides@laiki.com) writes:
> I have a database with 20GB transaction log file.
> The recovery model of the database is Full.
> I need to move the T. log file to a new location with the minimal
> downtime.
> I know I can do this by dettaching the DB, copying the T. Log and
> attaching it at the new location. This will take some time though as
> copying the T. log file will take up some time.
>
> I thoght that I could maybe create a secondary T. log file and delete
> the primary T. log file.
> What does it take so I'm able to delete the primary T. log file? Can
> you please explain how to accomplish this?


It appears you cannot remove the primary log file.

I would:

1) Backup the transaction log.
2) Shrink the log file.
3) Throw out users.
4) Detach database.
5) Copy log file (which is now small).
6) Attach database.
7) Let users in.
8) Increase log file to 20 GB again.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com