Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create/Restore/Attach Database Issue

Status
Not open for further replies.

ReportDr00

IS-IT--Management
Mar 2, 2007
194
US
Hello

I received mdf file from a site and would like to create or restore or attach that mdf file on my local machine, i tried creating using the location the mdf file was saved but no success and restore or attach doesnt seem to work?
how should i go about adding this database to my server and view?

Any help would be appreciated grealty?

Armani
 
Use the sp_attach_single_file_db procedure to attach the file and have SQL Server create a new transaction log file.

Denny
MVP
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2008 Implementation and Maintenance / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Admin (SQL 2005/2008) / Database Dev (SQL 2005)

My Blog
 

am getting below message

New log file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TEST_Data_log.LDF' was created.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'TEST_Data'. CREATE DATABASE is aborted.
Msg 824, Level 24, State 2, Line 1
SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:96712; actual 0:0).
It occurred during a read of page (1:96712) in database ID 11 at offset 0x0000002f390000 in file
'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TEST_Data.MDF'.
Additional messages in the SQL Server error log or system event log may provide more detail.
This is a severe error condition that threatens database integrity and must be corrected immediately.
Complete a full database consistency check (DBCC CHECKDB).
This error can be caused by many factors; for more information, see SQL Server Books Online.

regards

armani
 
Looks like the MDF file is also corrupt.

Something else you can try, is to create a new database with the same name. Make the MDF file the same size as the one you have here. Stop the SQL service, rename the large empty file. Make a COPY of the corrupt file and put it in place where the file you renamed was. Start the SQL Server. The SQL Server will freak out, and place the database in suspect mode if we are lucky.

Once it is in suspect mode, you can place it in emergency mode and do a DBCC CHECKDB against it and see if you can bring it online.

You may need to put a copy of the corrupt log file in place as well before SQL will accept the corrupt database and put it into suspect mode.


Denny
MVP
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2008 Implementation and Maintenance / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Admin (SQL 2005/2008) / Database Dev (SQL 2005)

My Blog
 
Ask the provider how they made a copy of the MDF file. If they really aren't familiar with SQL Server or just plain made a mistake - they may have just copied the file while it was in use and you can't do that. A database has to be detached before a valid copy of the MDF/LDF files can be made. So, they should have detached it, copied the files to a new location (copy not move), reattach the database, and then provide you the copies that they made.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top