Solved

SQL Server 2008: Could not find row in sysindexes for database ID 7, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Posted on 2011-02-13
18
1,416 Views
Last Modified: 2012-06-27
I am trying to attach a database but keep on getting the following error:
SQL Server 2008: Could not find row in sysindexes for database ID 7, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

I did run the DBCC CHECKTABLE on sysindexes and it returned with 104 rows with no errors.  I also ran DBCC CHECKDB --> but no errors.  

I am not migrating the database or upgrading from the previous verison of SQL server.  

Thanks
0
Comment
Question by:BSS2011
  • 9
  • 7
18 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34885703
please check the compatibility value of the database, is it 100 or is it lower?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34885710
Try rebuilding the Clustered index on that particular table which might help out some times..
0
 

Author Comment

by:BSS2011
ID: 34885755
I ran the exec_sphelp and got 6 rows with dbnames, i see all my db's but not the one i need to attach.  Rebuilding index did not help.
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34885827
>> I ran the exec_sphelp and got 6 rows with dbnames,

Do you mean exec sp_help ..
If so, then it would return all objects present in your current database and if you are not connected to your database, then run this

USE ur_db_name
GO
exec sp_help

>> Rebuilding index did not help.

What error or response did you got while rebuilding your clustered index.
Ideally Clustered index would be your Primary key but it some cases it varies.
So kindly check it once and rebuild it accordingly.
0
 

Author Comment

by:BSS2011
ID: 34885848
Ran this:
USE ur_db_name
GO
exec sp_help

Could not locate entry in sysdatabases for my database.  

When rebuilding the index i must use the ALTER INDEX right?
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34885873
>> Could not locate entry in sysdatabases for my database.  

Missed mentioning that...
Replace ur_db_name with your database name and execute the above script.

>> When rebuilding the index i must use the ALTER INDEX right?

Yes, You need to use ALTER INDEX with REBUILD operation
or
Drop and recreate your index..
0
 

Author Comment

by:BSS2011
ID: 34885924
I did use my db name with sp_help.

If the db entry is not in sysindex table rebuilding index will not work.  Am I reindexing sysindex?
0
 

Author Comment

by:BSS2011
ID: 34885998
Tried re-indexing but could not locate entry in sysdatabases.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34886162
>> I also ran DBCC CHECKDB --> but no errors.  

Can you try running this:

DBCC CHECKDB ur_db_name WITH ALL_ERRORMSGS;
0
 

Author Comment

by:BSS2011
ID: 34888017
Same error:  could not locate entry in sysdatabases.
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34888115
Are you sure your database is available in the instance you are testing with..
And is your database accessible.

Kindly run this query and paste its output here:

SELECT * FROM sys.databases
WHERE name LIKE '%ur_db_name%'

PS: Do replace ur_db_name with your db name.
0
 

Author Comment

by:BSS2011
ID: 34888940
I ran the query and got no results.  
0
 

Author Comment

by:BSS2011
ID: 34889458
When i ran the following this time:

USE ur_db_name
GO
exec sp_help

I got the error the administrator is not able to access the db.  Different error this time and I can see the db now in the object explorer but cannot access it.
0
 

Author Comment

by:BSS2011
ID: 34889535
I did a query on sys.databases again but returned with no rows.
0
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 500 total points
ID: 34893569
>> I got the error the administrator is not able to access the db.

Then it means that your database is not accessible...
If you have a database backup available, then its recommended to restore your backup and have this error fixed out.
0
 

Author Comment

by:BSS2011
ID: 34928542
Ended up restoring the backup.  
0
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 34939845
>> Ended up restoring the backup

Isn't the same which I have suggested you earlier in my comment http:#a34893569.
It would have been fair to accept my comment as solution..
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now