Tuesday, March 27, 2012

Error reattaching database following it being marked as Suspect

I am using SQL Server 2000 with SP3 (product version
8.00.760).
A database in this installation was marked as 'SUSPECT'
whilst I was excuting a DELETE SQL statement using the SQL
Query Analyzer tool.
Using Enterprise Manager I was subsequently unable to
access the database, and so thought the easiest option
would be to restore it from a BAK file that had been
created a few hours earlier as data modiefied in the time
between was not vital. I detached the database before
attemping this, and then discovered the only backup
available is a differential one and it will not restore.
Therefore, I was hoping to reattached the database and
reset the 'SUSPECT' flag, so I could at least access the
data again. However, when I attempt to attach the MDF
file (the associated LDF file is in the same location) I
get the following errors:
Error 9001: The log for database 'MY_DATABASE' is
not available.
and:
Attaching the database has failed.
I have also tried attaching the database using the
sp_attach_single_file_db stored procdure:
EXEC sp_attach_single_file_db @.dbname
= 'MY_DATABASE',
@.physname = 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\MY_DATABASE_Data.MDF'
which return the following error message:
Server: Msg 9001, Level 21, State 4, Line 1
The log for database 'ORBIT_REPORTS' is not
available.
And also tried using the sp_attach_db stored procedure:
EXEC sp_attach_db @.dbname = 'MY_DATABASE',
@.filename1 = 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\MY_DATABASE_Data.MDF',
@.filename2 = 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\MY_DATABASE_Log.LDF'
but still get the following error:
Server: Msg 9001, Level 21, State 1, Line 1
The log for database 'ORBIT_REPORTS' is not
available.
Both files _do_ exist in the directory:
'C:\Program Files\Microsoft SQL Server\MSSQL\Data\
Can anyone help?If you have a diff backup you should have a copy of a full backup (since
diff backup wont start until it knows a full backup exists).
Is the database called Orbits_reports?
If you have SQL 2K...right click database -all tasks and attach DB...does
the files come up as red? Have you got the correct permissions for a file?
Have you renamed a file?
Regards
Z
"Ian Munday" <ian.munday@.uk.pwc.com> wrote in message
news:078201c37c64$18bdc690$a001280a@.phx.gbl...
> I am using SQL Server 2000 with SP3 (product version
> 8.00.760).
> A database in this installation was marked as 'SUSPECT'
> whilst I was excuting a DELETE SQL statement using the SQL
> Query Analyzer tool.
> Using Enterprise Manager I was subsequently unable to
> access the database, and so thought the easiest option
> would be to restore it from a BAK file that had been
> created a few hours earlier as data modiefied in the time
> between was not vital. I detached the database before
> attemping this, and then discovered the only backup
> available is a differential one and it will not restore.
> Therefore, I was hoping to reattached the database and
> reset the 'SUSPECT' flag, so I could at least access the
> data again. However, when I attempt to attach the MDF
> file (the associated LDF file is in the same location) I
> get the following errors:
> Error 9001: The log for database 'MY_DATABASE' is
> not available.
> and:
> Attaching the database has failed.
>
> I have also tried attaching the database using the
> sp_attach_single_file_db stored procdure:
> EXEC sp_attach_single_file_db @.dbname
> = 'MY_DATABASE',
> @.physname = 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\MY_DATABASE_Data.MDF'
> which return the following error message:
> Server: Msg 9001, Level 21, State 4, Line 1
> The log for database 'ORBIT_REPORTS' is not
> available.
> And also tried using the sp_attach_db stored procedure:
> EXEC sp_attach_db @.dbname = 'MY_DATABASE',
> @.filename1 = 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\MY_DATABASE_Data.MDF',
> @.filename2 = 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\MY_DATABASE_Log.LDF'
> but still get the following error:
> Server: Msg 9001, Level 21, State 1, Line 1
> The log for database 'ORBIT_REPORTS' is not
> available.
> Both files _do_ exist in the directory:
> 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\
>
> Can anyone help?

No comments:

Post a Comment