Mario,
You can try the following from books online, but honestly your best
bet would be to restore to your latest backup.
David Hay
sp_attach_single_file_db
Attaches a database having only one data file to the current server.
Syntax
sp_attach_single_file_db [ @dbname = ] 'dbname'
, [ @physname = ] 'physical_name'
Arguments
[@dbname =] 'dbname'
Is the name of the database to be attached to the server. dbname is
sysname, with a default of NULL.
[@physname =] 'phsyical_name'
Is the physical name, including path, of the database file.
physical_name is nvarchar(260), with a default of NULL.
Return Code Values
0 (success) or 1 (failure)
Result Sets
None
Remarks
When sp_attach_single_file_db attaches the database to the server, it
builds a new log file and performs additional cleanup work to remove
replication from the newly attached database.
Used sp_attach_single_file_db only on databases that were previously
detached from the server using an explicit sp_detach_db operation.
Permissions
Only members of the sysadmin and dbcreator fixed server roles can
execute this procedure.
Examples
This example detaches pubs and then attaches one file from pubs to the
current server.
EXEC sp_detach_db @dbname = 'pubs'
EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data
\pubs.mdf'
Mario Morellini - 15 Jul 2008 12:23 GMT
David
I tried with the "sp_attach_single_file_db @dbname= 'MYDB', @physname=
'S:\SQLDB\MyDBnew.mdf'"
but the result is same.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'MYDB'. CREATE DATABASE is aborted.
Msg 5242, Level 22, State 1, Line 1
An inconsistency was detected during an internal operation in database
'MYDB'(ID:55) on page (1:9). Please contact technical support. Reference
number 6.
anybody have another idea ?
Mario Morellini
David Hay - 15 Jul 2008 16:44 GMT
Mario,
From the error it looks like there are pages that are messed up in the
file. You might want to take SQL down and do a full scandisk and let
it attempt to fix any errors. Then a full defrag of the disk as well
before attempting to reattach. With the power outage a scandisk would
probably be a good thing even if you were not seeing problems now! If
all that fails then at this point I think the database is corrupted
beyond SQL's ability to correct itself. The only answer is RESTORE.
I hope you have a recent good backup!
Good luck!
David Hay