RSS

How to install Adventure Work Database

04 Mar

Problem :

When I download Database Adventure Work  I see it MDF file only ok but now how can I attach this database without LDF file . SQL Server give me ERROR

AdventureWork Without LDF File

 

 

ERROR

 

Solution : 

to fix this error and install the database on the production we will create the LDF file by this script .

 

Create Database AdventureWorks2008R2

ON (FILENAME=‘E:\AdventureWorks2008R2_Data.mdf’)

FOR ATTACH_REBUILD_LOG

by this Script I Create Database AdventureWorks2008R2 and put the File name for the MDF file the ( Full path ) then I make REBUILD for the LOG by this Command  (ATTACH_REBUILD_LOG)

Now after you EXCE this Query Check the path of the MDF file you will see the new File LDF for the database adventure work also you check the Databases on SQL Server management studio you will find the Database ADVENTUREWORK2008R2

Regards ,

Eng. Mustafa Elmasry

Database Administrator

 

 

 
1 Comment

Posted by on March 4, 2013 in Errors

 

One response to “How to install Adventure Work Database

  1. Eng.Motafa Elmasry

    March 6, 2013 at 7:27 AM

    SQL Server databases have three types of files:

    Primary data files
    The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.

    Secondary data files
    Secondary data files comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf.

    Log files
    Log files hold all of the log information used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s