Wednesday, March 28, 2012

Question regarding sp_detach

Ran this command - EXEC sp_detach_db 'testlog', 'true'
Deleted the .ldf file associated with the database and
then ran this:
EXEC sp_attach_single_file_db @.dbname = 'testlog',
@.physname = 'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\testlog_data.mdf'
Then I got this error message
"Device activation error. The physical file
name 'D:\Program Files\Microsoft SQL
Server\MSSQL\data\testlog_log.ldf' may be incorrect.
New log file 'd:\Program Files\Microsoft SQL
Server\MSSQL\Data\testlog_log.LDF' was created."
Is this an expected error message?
Thanks Mike Allen
Novice DBAMike,
I think the message is more information, letting you know that SQL Server
created a log file for you. Note, however, that BOL states that a new log
file will/can be created only if you actually detached the database first
and only of you have one and only one log file and only one database file.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Mike Allen" <mikea@.atg.wa.gov> wrote in message
news:1157001c3bf6c$a15d8620$a601280a@.phx.gbl...
> Ran this command - EXEC sp_detach_db 'testlog', 'true'
> Deleted the .ldf file associated with the database and
> then ran this:
> EXEC sp_attach_single_file_db @.dbname = 'testlog',
> @.physname = 'd:\Program Files\Microsoft SQL
> Server\MSSQL\Data\testlog_data.mdf'
> Then I got this error message
> "Device activation error. The physical file
> name 'D:\Program Files\Microsoft SQL
> Server\MSSQL\data\testlog_log.ldf' may be incorrect.
> New log file 'd:\Program Files\Microsoft SQL
> Server\MSSQL\Data\testlog_log.LDF' was created."
> Is this an expected error message?
> Thanks Mike Allen
> Novice DBA
>|||Thanks
>--Original Message--
>Mike,
>I think the message is more information, letting you know
that SQL Server
>created a log file for you. Note, however, that BOL
states that a new log
>file will/can be created only if you actually detached
the database first
>and only of you have one and only one log file and only
one database file.
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Mike Allen" <mikea@.atg.wa.gov> wrote in message
>news:1157001c3bf6c$a15d8620$a601280a@.phx.gbl...
>> Ran this command - EXEC sp_detach_db 'testlog', 'true'
>> Deleted the .ldf file associated with the database and
>> then ran this:
>> EXEC sp_attach_single_file_db @.dbname = 'testlog',
>> @.physname = 'd:\Program Files\Microsoft SQL
>> Server\MSSQL\Data\testlog_data.mdf'
>> Then I got this error message
>> "Device activation error. The physical file
>> name 'D:\Program Files\Microsoft SQL
>> Server\MSSQL\data\testlog_log.ldf' may be incorrect.
>> New log file 'd:\Program Files\Microsoft SQL
>> Server\MSSQL\Data\testlog_log.LDF' was created."
>> Is this an expected error message?
>> Thanks Mike Allen
>> Novice DBA
>
>.
>sql

No comments:

Post a Comment