SQL Server conection with AttachDBFilename



Hello

Using SQL SERVER 2005

I have a database - this database I detached and the made a copy, copyed to
another location.
Then attaching the original database.

Then renamed the copy to MyCopyDatabase.mdf and the logfile to
MyCopyDatabase_log.LDF

Then i want to attach the copy database using this connection string:
Provider=SQLOLEDB;Server=.\SQLExpress;AttachDbFilename=C:\Kunder\NFB\MyCopyDatabase.mdf;
Database=NFBWinnerCRM;Trusted_Connection=Yes;

I recieve an error:
Unable to open the physical file "C:\Aware Development\WinnerCRM7_log.ldf".
Operating system error 32: "32(The process cannot access the file because it
is being used by another process.)"

I am aware that event when i renamed the databasefile (mdf) the original
name and the original path to logfile is still stored within the file.
Therefore the error. But can I specify the log file, just a i am specifying
the database file with the AttachDbFilename?

When doing this with the MS SQL Server management, i still get the error for
the original log file, but here i can alter the path to the "new" logfile.

Kind regards

Johnny Jensen


.



Relevant Pages

  • Re: Restoring from MDF and LDF
    ... find another SQL Server with D: drive and try attaching these ... Is .NET important for a database professional? ... Device activation error. ...
    (microsoft.public.sqlserver.server)
  • Re: Attach database became readonly
    ... my problem becomes how to install it so that it is set to Local System. ... attached database behave as normal (i.e. it on longer is readonly ... I install my application on user machine using Visual Studio setup ... What should I do so that after attaching it is not a readonly ...
    (microsoft.public.sqlserver.setup)
  • Problem attaching Northwind traders sample database in SQL Server 2005
    ... I'm having some trouoble attaching the Northwind sample to an instance of SQL Server 2005 on Vista. ... Database 'Northwind' cannot be upgraded because it is read-only or has read-only files. ... I have been able to attach other samples, such as adventureworks, so I think it is something to do with attaching SQL 2000 developed databases, and my security settings. ...
    (microsoft.public.sqlserver.setup)
  • Database size vs total table and index size
    ... I use SQL Server 2000. ... My database is 1912.69 MB with no available free space. ... My logfile is 1 MB. ...
    (microsoft.public.sqlserver)
  • Re: Attach database became readonly
    ... This posting is provided "AS IS" with no warranties, ... attached database behave as normal (i.e. it on longer is readonly ... I install my application on user machine using Visual Studio setup ... What should I do so that after attaching it is not a readonly ...
    (microsoft.public.sqlserver.setup)

Loading