Tags: 1gt, 2gt, attach, database, detach, drive, file, following, ldf, log, microsoft, mysql, oracle, performed, server, sql

Detach/Attach database

On Database » Microsoft SQL Server

8,900 words with 4 Comments; publish: Mon, 02 Jun 2008 01:06:00 GMT; (250218.75, « »)

I need to move the ".ldf" log file from my 'w' drive to my 'l' drive. I

performed the following:

1> detach database

2> moved the .ldf file to the 'l' drive(deleted from the w drive)

3> attched the database

4> received a RED 'x'on the ldf file >> retyped the new location of the file

and hit OK . The attach failed with the following error.

error 5105:devide activation error: The physical file name '....' may be

incorrect

cannot create '....' because it already exists.

All Comments

Leave a comment...

  • 4 Comments
    • Hi

      Rather use T-SQL. Open up query analyser and use the following code. Change

      the Db names, files and paths as appropriate:

      EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'pubs',

      .sqlserver.todaysummary.com.filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',

      .sqlserver.todaysummary.com.filename2 = N'c:\Program Files\Microsoft SQL

      Server\MSSQL\Data\pubs_log.ldf'

      "Joe" wrote:

      > I need to move the ".ldf" log file from my 'w' drive to my 'l' drive. I

      > performed the following:

      > 1> detach database

      > 2> moved the .ldf file to the 'l' drive(deleted from the w drive)

      > 3> attched the database

      > 4> received a RED 'x'on the ldf file >> retyped the new location of the file

      > and hit OK . The attach failed with the following error.

      > error 5105:devide activation error: The physical file name '....' may be

      > incorrect

      > cannot create '....' because it already exists.

      >

      >

      >

      >

      #1; Mon, 02 Jun 2008 01:08:00 GMT
    • I got the same results.--see below:

      EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'MessageEngine',

      .sqlserver.todaysummary.com.filename1 = N'w:\Program Files\Microsoft SQL

      Server\MSSQL\Data\MessageEngine.mdf',

      .sqlserver.todaysummary.com.filename2 = N'l:\SQLLOGS\MessageEngine_log.LDF'

      >>>

      Server: Msg 5105, Level 16, State 4, Line 1

      Device activation error. The physical file name

      'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      Server: Msg 5170, Level 16, State 1, Line 1

      Cannot create file 'L:\SQLLOGS\\MessageEngine_log.LDF' because it already

      exists.

      Server: Msg 1813, Level 16, State 1, Line 1

      Could not open new database 'MessageEngine'. CREATE DATABASE is aborted.

      Device activation error. The physical file name

      'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      "Mike Epprecht (SQL MVP)" wrote:

      > Hi

      > Rather use T-SQL. Open up query analyser and use the following code. Change

      > the Db names, files and paths as appropriate:

      > EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'pubs',

      > .sqlserver.todaysummary.com.filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',

      > .sqlserver.todaysummary.com.filename2 = N'c:\Program Files\Microsoft SQL

      > Server\MSSQL\Data\pubs_log.ldf'

      >

      > "Joe" wrote:

      > > I need to move the ".ldf" log file from my 'w' drive to my 'l' drive. I

      > > performed the following:

      > > 1> detach database

      > > 2> moved the .ldf file to the 'l' drive(deleted from the w drive)

      > > 3> attched the database

      > > 4> received a RED 'x'on the ldf file >> retyped the new location of the file

      > > and hit OK . The attach failed with the following error.

      > >

      > > error 5105:devide activation error: The physical file name '....' may be

      > > incorrect

      > > cannot create '....' because it already exists.

      > >

      > >

      > >

      > >

      > >

      > >

      > >

      #2; Mon, 02 Jun 2008 01:09:00 GMT
    • Hi

      From the command prompt, do a DIR l:\SQLLOGS\MessageEngine_log.LDF

      Alos, check the the SQL Server Service account has permissions in the

      directory and file.

      Regards

      Mike

      "Joe" wrote:

      > I got the same results.--see below:

      > EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'MessageEngine',

      > .sqlserver.todaysummary.com.filename1 = N'w:\Program Files\Microsoft SQL

      > Server\MSSQL\Data\MessageEngine.mdf',

      > .sqlserver.todaysummary.com.filename2 = N'l:\SQLLOGS\MessageEngine_log.LDF'

      > >>>

      > Server: Msg 5105, Level 16, State 4, Line 1

      > Device activation error. The physical file name

      > 'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      > Server: Msg 5170, Level 16, State 1, Line 1

      > Cannot create file 'L:\SQLLOGS\\MessageEngine_log.LDF' because it already

      > exists.

      > Server: Msg 1813, Level 16, State 1, Line 1

      > Could not open new database 'MessageEngine'. CREATE DATABASE is aborted.

      > Device activation error. The physical file name

      > 'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      > "Mike Epprecht (SQL MVP)" wrote:

      > > Hi

      > >

      > > Rather use T-SQL. Open up query analyser and use the following code. Change

      > > the Db names, files and paths as appropriate:

      > >

      > > EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'pubs',

      > > .sqlserver.todaysummary.com.filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',

      > > .sqlserver.todaysummary.com.filename2 = N'c:\Program Files\Microsoft SQL

      > > Server\MSSQL\Data\pubs_log.ldf'

      > >

      > >

      > >

      > > "Joe" wrote:

      > >

      > > > I need to move the ".ldf" log file from my 'w' drive to my 'l' drive. I

      > > > performed the following:

      > > > 1> detach database

      > > > 2> moved the .ldf file to the 'l' drive(deleted from the w drive)

      > > > 3> attched the database

      > > > 4> received a RED 'x'on the ldf file >> retyped the new location of the file

      > > > and hit OK . The attach failed with the following error.

      > > >

      > > > error 5105:devide activation error: The physical file name '....' may be

      > > > incorrect

      > > > cannot create '....' because it already exists.

      > > >

      > > >

      > > >

      > > >

      > > >

      > > >

      > > >

      #3; Mon, 02 Jun 2008 01:10:00 GMT
    • Make sure you move the old MessageEngine_log.LDF file to L:\SQLLOGS\

      directory before you run sp_attach_db.

      "Joe" <Joe.sqlserver.todaysummary.com.discussions.microsoft.com> wrote in message

      news:94AF06C2-E3A1-4089-9620-7315F6EE9CD0.sqlserver.todaysummary.com.microsoft.com...

      >I got the same results.--see below:

      > EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'MessageEngine',

      > .sqlserver.todaysummary.com.filename1 = N'w:\Program Files\Microsoft SQL

      > Server\MSSQL\Data\MessageEngine.mdf',

      > .sqlserver.todaysummary.com.filename2 = N'l:\SQLLOGS\MessageEngine_log.LDF'

      >>>>

      > Server: Msg 5105, Level 16, State 4, Line 1

      > Device activation error. The physical file name

      > 'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      > Server: Msg 5170, Level 16, State 1, Line 1

      > Cannot create file 'L:\SQLLOGS\\MessageEngine_log.LDF' because it already

      > exists.

      > Server: Msg 1813, Level 16, State 1, Line 1

      > Could not open new database 'MessageEngine'. CREATE DATABASE is aborted.

      > Device activation error. The physical file name

      > 'l:\SQLLOGS\MessageEngine_log.LDF' may be incorrect.

      > "Mike Epprecht (SQL MVP)" wrote:

      >> Hi

      >> Rather use T-SQL. Open up query analyser and use the following code.

      >> Change

      >> the Db names, files and paths as appropriate:

      >> EXEC sp_attach_db .sqlserver.todaysummary.com.dbname = N'pubs',

      >> .sqlserver.todaysummary.com.filename1 = N'c:\Program Files\Microsoft SQL

      >> Server\MSSQL\Data\pubs.mdf',

      >> .sqlserver.todaysummary.com.filename2 = N'c:\Program Files\Microsoft SQL

      >> Server\MSSQL\Data\pubs_log.ldf'

      >>

      >> "Joe" wrote:

      >> > I need to move the ".ldf" log file from my 'w' drive to my 'l' drive. I

      >> > performed the following:

      >> > 1> detach database

      >> > 2> moved the .ldf file to the 'l' drive(deleted from the w drive)

      >> > 3> attched the database

      >> > 4> received a RED 'x'on the ldf file >> retyped the new location of the

      >> > file

      >> > and hit OK . The attach failed with the following error.

      >> >

      >> > error 5105:devide activation error: The physical file name '....' may

      >> > be

      >> > incorrect

      >> > cannot create '....' because it already exists.

      >> >

      >> >

      >> >

      >> >

      >> >

      >> >

      >> >

      #4; Mon, 02 Jun 2008 01:11:00 GMT