Wednesday, March 28, 2012

Moving a log file

Hi,
I know that I can detach a database, move the log file(s) and then
re-attach, but what is the
syntax to do it with Alter Database (or is it even possible)? I have
searched high and low and only found examples
that use sp_detach_db
Thanks,
DanFor 2000, no syntax using ALTER DATABASE except for tempdb.
For 2005, you can use ALTER DATABASE. See below 2005 BOL URL:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/89f01b10-5fae-4ed8-b0fb-a4b9f540fd28.htm
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"dan artuso" <dartuso@.NOSPAMpagepearls.com> wrote in message
news:%2328kfSc%23FHA.600@.tk2msftngp13.phx.gbl...
> Hi,
> I know that I can detach a database, move the log file(s) and then re-attach, but what is the
> syntax to do it with Alter Database (or is it even possible)? I have searched high and low and
> only found examples
> that use sp_detach_db
> Thanks,
> Dan
>
>|||Thanks Tibor,
I know I had used it for tempdb and thought maybe I could use it for
'regular' db's.
Dan
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ODXUvfc%23FHA.4012@.TK2MSFTNGP10.phx.gbl...
> For 2000, no syntax using ALTER DATABASE except for tempdb.
> For 2005, you can use ALTER DATABASE. See below 2005 BOL URL:
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/89f01b10-5fae-4ed8-b0fb-a4b9f540fd28.htm
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "dan artuso" <dartuso@.NOSPAMpagepearls.com> wrote in message
> news:%2328kfSc%23FHA.600@.tk2msftngp13.phx.gbl...
>> Hi,
>> I know that I can detach a database, move the log file(s) and then
>> re-attach, but what is the
>> syntax to do it with Alter Database (or is it even possible)? I have
>> searched high and low and only found examples
>> that use sp_detach_db
>> Thanks,
>> Dan
>>
>|||Hi Dan
You can only use it for tempdb because tempdb is rebuilt every time you
restart your SQL Server. And in fact, when you use it for tempdb, it doesn't
take effect until you stop and restart.
--
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"dan artuso" <dartuso@.NOSPAMpagepearls.com> wrote in message
news:%23rjulyc%23FHA.2816@.tk2msftngp13.phx.gbl...
> Thanks Tibor,
> I know I had used it for tempdb and thought maybe I could use it for
> 'regular' db's.
>
> Dan
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
> in message news:ODXUvfc%23FHA.4012@.TK2MSFTNGP10.phx.gbl...
>> For 2000, no syntax using ALTER DATABASE except for tempdb.
>> For 2005, you can use ALTER DATABASE. See below 2005 BOL URL:
>> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/89f01b10-5fae-4ed8-b0fb-a4b9f540fd28.htm
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "dan artuso" <dartuso@.NOSPAMpagepearls.com> wrote in message
>> news:%2328kfSc%23FHA.600@.tk2msftngp13.phx.gbl...
>> Hi,
>> I know that I can detach a database, move the log file(s) and then
>> re-attach, but what is the
>> syntax to do it with Alter Database (or is it even possible)? I have
>> searched high and low and only found examples
>> that use sp_detach_db
>> Thanks,
>> Dan
>>
>>
>
>

No comments:

Post a Comment