Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Restore from MDF/LDF files

Posted on 2007-11-26
3
Medium Priority
?
1,053 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 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 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