Solved

Restore from MDF/LDF files

Posted on 2007-11-26
3
1,046 Views
Last Modified: 2011-01-24
I have root access to my W2K3 server with SQL Server 2005 installed on it. An unrelated melt-down caused me to use the hosting control panel to delete a domain. Deleting the domain also deleted the SQL Server database. I run Backup For Workgroups (with the open file add-on designed for SQL Server) and make nightly backups.

I can restore these files: foo.mdf, foo.ldf

Here is what I have done.
1) Stopped SQL Server
2) Copied the mdf and ldf files to the SQL directory
3) Restarted SQL Server

Q1) How can I confirm that the data is now restored? Do I run a query? If so, how do I go about it?

A web app is now giving me the error: "Cannot open database "foo" requested by the login. The login failed.
Login failed for user 'tester'."

I have created/deleted/re-created the tester user several times but it doesn't resolve the issue.

Q3) How do I resolve this issue?

0
Comment
Question by:djlurch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
pssandhu earned 500 total points
ID: 20354335
If you have the files as .mdf and .ldf that means you will have t0 re-attach these files. Restore database is only done on *.bak type of backed up files.

Follow these steps to attach a database:
http://msdn2.microsoft.com/en-us/library/ms190209.aspx

Cheers!!
0
 
LVL 1

Author Comment

by:djlurch
ID: 20354548
I followed those directions.

1) Detached the DB/ Stopped SQL Server
2) Deleted MDF/LDF files from Data directory
3) Restored MDF/LDF files from Backup source
4) Restarted SQL Server
5) Attached the MDF/LDF files

I can see the database in the Server Management Studio.

I'm not really any farther than I was.

Q1) How can I see a few rows of data
Q2) I deleted the associated user, re-added them, but it still gives me the Cannot open database error (because of the incorrect credentials).


0
 
LVL 1

Author Comment

by:djlurch
ID: 20354593
Grrr. I deleted/added the user via the hosting control panel and it is working now.

Full points to PSS.

Thanks for the link.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question