Question

I have been trying to add adventure works database to my SQL server 2012..I tried to attach the database using SQL Server Management Studio as follows: I Right Clicked on Databases > Attach and clicked Add... > selected the AdventureWorks2012_Data file. and then I Selected the log file and removed the log file by clicking on the Remove button then clicked OK but I still get an error that the header file is not a valid database header file and the FILESIZE property is incorrect ......please help me

Était-ce utile?

La solution

As Martin suggested, it may be that the file you downloaded is incorrect. You should download a new copy from here (I wouldn't get it anywhere else):

enter image description here

Once you do, don't use the UI for this. Make sure you copy the .mdf file to your instance's data folder. Then run this code in a query window:

CREATE DATABASE AdventureWorks2012
  ON (name = 'AdventureWorks2012_data', 
  filename = 'drive:\path\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG;

You will get this "error" message:

File activation failure. The physical file name "drive:\path\AdventureWorks2012_Log.ldf" may be incorrect.

This is just SQL Server telling you that it didn't find the log file; it should still create one for you unless you have other issues (permission denied, lack of space, the same name file already exists, etc).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top