Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 sp_attach_db

Author  Topic 

dcunningham
Starting Member

25 Posts

Posted - 2007-08-21 : 14:49:46
I have a database file that was recovered from a block level replication system. I looks like the datafile is fine, but the NDF file and Log file may be corrupted.

I used the following commands and received the errors posted here:(data names changed to non-descriptive names to protect company info)


exec sp_attach_db 'MyData' ,
'k:\MSSQL\Data\MyData_Data.MDF' ,
'j:\MSSQL\Logs\MyData_Log.LDF' ,
'h:\MSSQL\Index\MyData_Index.NDF'


Server: Msg 3456, Level 21, State 1, Line 1
Could not redo log record (1846327:4643:8), for transaction ID (1:-1648406351), on page (3:966774), database 'MyData' (7). Page: LSN = (1846310:408:2), type = 2. Log: OpCode = 2, context 3, PrevPageLSN: (1846326:8410:2).

Connection Broken

---------------------------------------------------------------------------------------------

exec sp_attach_single_file_db 'MyData' , 'K:\MSSQL\Data\MyData_Data.MDF'

Server: Msg 5105, Level 16, State 5, Line 1
Device activation error. The physical file name 'E:\mssql\Index\MyData_Index.NDF' may be incorrect.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'MyData'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'L:\mssql\logs\MyData_log.ldf' may be incorrect.

How can I attach this database without the log file and secondary data file so that SQL server doesn't try to grab the other files. Basically, how do I repair the database to be able to attach it?

Thanks guys


rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-21 : 22:52:21
If ndf file is in same filegroup with mdf file, the db is useless without ndf file.
Go to Top of Page
   

- Advertisement -