Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Error in attach DB after power failure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mario Morellini - 14 Jul 2008 15:19 GMT
After power failure i have this error when try to attach DB
this is the command
sp_attach_db MYDB','S:SQLDB\MYDBnew.mdf','S:\SQLDB\MYDB_lognew.ldf'

and this is the error:
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'TELEMACOFTV6'. CREATE DATABASE is aborted.
Msg 5242, Level 22, State 1, Line 1
An inconsistency was detected during an internal operation in database
'TELEMACOFTV6'(ID:55) on page (1:9). Please contact technical support.
Reference number 6.

Can help me.
Regards
Mario Morellini
David Hay - 14 Jul 2008 20:21 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.