Question

Nantz1 on Sun, 21 Oct 2012 23:50:49


Where do I get the AdventureWorks log file? Getting error when attaching AW .mdf file. Says "error .ldf log file not found"

I figured I would just copy one of the other .ldf files, tempdb_log.ldf, but I keep getting an "file in use" error.

Thank you,

Nancy


Sponsored



Replies

Mr. Wharty on Mon, 22 Oct 2012 00:20:01


You don't need the log file as it will be created when the database is attached.  Just delete the log file entry from the Attach Database screen before attaching the database.

  1. Highligh the log file entry
  2. Click on the Remove Button

G3rb on Tue, 29 Oct 2013 16:09:00


This does not work on SQL Server 2012 on Windows Server 2012. Any ideas?

Tom Phillips on Tue, 29 Oct 2013 16:12:02


Please follow the installation instructions found here:

http://social.technet.microsoft.com/wiki/contents/articles/3735.sql-server-samples-readme.aspx

Gary S Wood on Thu, 27 Feb 2014 03:50:40


This did also not work for me.  I ended up using the scripted "Add Database" solution.  It also failed initially until I moved the Adventureworks MDF to the default data location for SQL server and tried it again.  Doesn't like users being creative with file paths?

Aditya Rathi on Mon, 10 Mar 2014 06:56:52


Write a SQL command to create Database with Log file.

Give the Location and name of the already existing .MDF file.

Give  a filename and location for that log file.

It will Create a Log File dynamically for the .MDF file./

Aditya Rathi on Mon, 10 Mar 2014 07:08:58


CREATE DATABASE AdventureWorks2012
  ON (name = 'AdventureWorks2012_data', 
  filename = 'drive:\path\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG;
See the above example;  and Edit the name and location of the File

rajeevkr72 on Fri, 21 Jul 2017 11:38:47


Also go to the directory where the data file is copied and right click on the file and click on Unblock button. Normally files are blocked when it is copied from an external site. After that use the script or attach option to create the database. You may also provide full permission to the users of the computer to this particular data file (Right click on the file > Security > Select "users" > Provide full permission). I did this 2 steps and it worked for me.