Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 30th, 2007, 09:04 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default Attaching database & DBCC CHECKTABLE problem...

In Enterprise manager, I right-click on 'databases' (beneath Local) and select to attach a database, select the file (which resides with other SQL database files), set the 'Attach As' to the name I want (which is taunton) and the owner to sa. When I click on Okay, I get the following error:

Microsoft SQL-DMO (ODBC SQLState: HY000)
Error 602: Could not find row in sysindexes for database ID 31, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes

Switched to SQL Query analyzer and executed:

DBCC CHECKTABLE ('master.dbo.sysindexes')

Which returns:

DBCC results for 'sysindexes'.
There are 104 rows in 4 pages for object 'sysindexes'.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.


Any ideas of what's next?

I have detached/attached plenty of databases before without this and cannot think that there's been any significant changes to my server, for which I am on the only one who has access (as it's on my laptop).

Thanks in advance for any help you could offer...



Regards,

Sean Anderson
__________________
Regards,

Sean Anderson
Reply With Quote
  #2 (permalink)  
Old March 30th, 2007, 11:27 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

could be hard drive errors causing it. I suggest tryint to back up your data and restore it to another computer. Se if you can move the data and if you can check if you still have the errros you describe.

Reply With Quote
  #3 (permalink)  
Old April 2nd, 2007, 05:09 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The database came off a CD, which I copied to my local drive. Checked everything, I can move, rename, delete, etc., and there's plenty of space on the drive. Also, there's no attributes set (such as read-only, system, etc.,).

Regards,

Sean Anderson
Reply With Quote
  #4 (permalink)  
Old April 2nd, 2007, 07:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What robprell means by hard drive errors is there could be some errors with hard drive partition where you are trying to attach it. Try attaching it with some other logical partition if any you have. I doubt if the MDF file is corrupted.

What is the SQL server version of the MDF/LDF files that you are trying to attach? What version of SQL server are you using in which you are trying to attach? Is that you are trying to attach a sql sever 2005 version on sql sever 2000?

Just a guess, try creating the database with the same name from the Enterprise manager under same path as that of the original one. Then stop sql service and overwrite the newly created mdf and ldf files with the ones you got off the CD. See if this solves the issue.

cheers.

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old April 2nd, 2007, 07:25 AM
Friend of Wrox
 
Join Date: Oct 2006
Location: Northampton, Northants, United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't have another partition to work from. Will try one of the network drives when I am next in the office.

I tried the idea of creating the database and overwriting the files and when I did, the entry in SQL Enterprise Manager said the database was 'suspect' and that it contained no items.

Have asked my customer to resupply the file as a SQL Backup and will try it from there.

Regards,

Sean Anderson
Reply With Quote
  #6 (permalink)  
Old April 2nd, 2007, 08:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Also try this on the sql query analyser from the database that you attached.

Select db_name(31) -- verify if this is the name of the database that you attached.
The table reference that is shown in the error seems to be that of sysobjects.
Index Id shown in the error seems to be that of a clustered index.

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dbcc shrinkfile SQL 7 dls1 SQL Server 2000 1 January 2nd, 2007 07:21 PM
Error attaching SQL Database Wasim SQL Server 2000 2 April 27th, 2005 04:54 AM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
interesting problem - re: database & rollovers highbeef Classic ASP Databases 4 March 2nd, 2004 09:41 AM



All times are GMT -4. The time now is 10:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.