|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Wednesday, August 01, 2012 10:26 AM
Points: 613,
Visits: 1,819
|
|
Hi,
I have installed SQL Server 2012 and downloaded sanple database from the below link, which has AdventureWorks2008R2_Data.mdf for download.
http://msftdbprodsamples.codeplex.com/releases/view/55330
Now, how to restore AdventureWorks database from AdventureWorks2008R2_Data.mdf file?
Thanks
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, April 19, 2013 1:20 PM
Points: 17,
Visits: 83
|
|
Can you use Create Database for attach with rebuild log?
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Saturday, March 17, 2012 8:23 PM
Points: 8,
Visits: 4
|
|
| I think you can attach the db by right clicking on the database folder.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, April 19, 2013 1:20 PM
Points: 17,
Visits: 83
|
|
I don't think you can rebuild the log when using the UI, however this is off the top of my head, and well age is not doing my memory well.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 5,201,
Visits: 11,152
|
|
Chris Shaw (1/11/2012) I don't think you can rebuild the log when using the UI, however this is off the top of my head, and well age is not doing my memory well. You can, not specifying a log will rebuild it
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, January 12, 2012 7:08 AM
Points: 2,
Visits: 131
|
|
Try
CREATE DATABASE Database1 ON (FILENAME = N'C:\Temp\Database1.mdf') FOR ATTACH_REBUILD_LOG
Rob
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Tuesday, July 03, 2012 10:12 PM
Points: 62,
Visits: 122
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 8:10 PM
Points: 876,
Visits: 3,731
|
|
Now, how to restore AdventureWorks database from AdventureWorks2008R2_Data.mdf file?
What if you create a blank file and name it as AdventureWorks2008R2_log.ldf and then try to attach the mdf and ldf file.
Not too sure, but can give a try.
---------- Ashish
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 6:25 AM
Points: 37,679,
Visits: 29,934
|
|
From that link:
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. We recommend that you use CREATE DATABASE database_name FOR ATTACH instead. For more information, see CREATE DATABASE (Transact-SQL). Do not use this procedure on a replicated database.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 6:25 AM
Points: 37,679,
Visits: 29,934
|
|
crazy4sql (1/12/2012) What if you create a blank file and name it as AdventureWorks2008R2_log.ldf and then try to attach the mdf and ldf file.
You'll get an error saying that the ldf file is not a valid database file and the attach will fail.
CREATE DATABASE ... FOR ATTACH_REBUILD_LOG is the answer providing the DB was shut down cleanly before the ldf file removed.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|