Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

How to get the table name from a objectID? Expand / Collapse
Author
Message
Posted Monday, July 15, 2013 5:38 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, July 25, 2016 8:40 AM
Points: 26, Visits: 115
george sibbald (7/15/2013)
check also the minimum repair level checkdb reports.

If its a non-clustered index that turns out to be corrupted you may be able to just drop and recreate it.

Do you have a clean backup? almost always your best way out of a corruption.


Unfortunately no recent clean backup and ive been i cannot repair as its seriously corrupt

I dont know if its a non-clustered index or table that is corrupted. My strategy as i stated above was to create a new db and script all the objects that are 'good' and not the 'bad' ones. This is why im trying to ascertain the corrupt objects.
Post #1473596
Posted Monday, July 15, 2013 5:54 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, November 16, 2016 9:57 AM
Points: 6,147, Visits: 13,680
the checkdb will give you the corrupted object names

---------------------------------------------------------------------

Post #1473602
Posted Monday, July 15, 2013 5:56 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, July 25, 2016 8:40 AM
Points: 26, Visits: 115
OK, here is the output from the CHECKDB (i cannot see the objectname?)

Msg 8946, Level 16, State 12, Line 2
Table error: Allocation page (1:28502112) has invalid PFS_PAGE page header values. Type is 0. Check type, object ID and page ID on the page.
Msg 8909, Level 16, State 1, Line 1
Table error: Object ID -25000, index ID 0, page ID (1:28502112). The PageId in the page header = (0:0).
Msg 8909, Level 16, State 1, Line 1
Table error: Object ID -25000, index ID 0, page ID (1:28502112). The PageId in the page header = (0:0).
CHECKDB found 1 allocation errors and 1 consistency errors in table '(Object ID -25000)' (object ID -25000).
Msg 8921, Level 16, State 1, Line 1
CHECKTABLE terminated. A failure was detected while collecting facts. Possibly tempdb out of space or a system table is inconsistent. Check previous errors.
Msg 8998, Level 16, State 1, Line 1
Page errors on the GAM, SGAM, or PFS pages do not allow CHECKALLOC to verify database ID 10 pages from (1:28502112) to (1:28510199). See other errors for cause.
Msg 8998, Level 16, State 1, Line 1
Page errors on the GAM, SGAM, or PFS pages do not allow CHECKALLOC to verify database ID 10 pages from (1:28510200) to (1:28518287). See other errors for cause.
Msg 8998, Level 16, State 1, Line 1
Page errors on the GAM, SGAM, or PFS pages do not allow CHECKALLOC to verify database ID 10 pages from (1:28518288) to (1:28526375). See other errors for cause.
CHECKDB found 3 allocation errors and 0 consistency errors not associated with any single object.
Msg 8909, Level 16, State 1, Line 1
Table error: Object ID 632864, index ID 17051, page ID (1:28510200). The PageId in the page header = (55702:800).
CHECKDB found 1 allocation errors and 0 consistency errors in table '(Object ID 632864)' (object ID 632864).
Msg 8909, Level 16, State 1, Line 1
Table error: Object ID 134676585, index ID 1, page ID (1:28518288). The PageId in the page header = (26880:131072).
CHECKDB found 1 allocation errors and 0 consistency errors in table '(Object ID 134676585)' (object ID 134676585).
CHECKDB found 6 allocation errors and 1 consistency errors in database 'Bon_Live'.
Post #1473604
Posted Monday, July 15, 2013 6:30 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Saturday, December 3, 2016 5:18 AM
Points: 45,619, Visits: 44,147
That is corrupt beyond the point of being able to identify objects. You've got fatal metadata corruption and allocation page corruption.
You're going to be very lucky if you get much at all out of that.

Go through the tables one by one (select name from sysobjects where xtype='U'), see if you can generate the script, see if you can select any of the data. I suspect a good number of objects will fail. It will take quite some time.

May be easier just to go back to the last good backup and accept that everything since is lost.



Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1473618
Posted Monday, July 15, 2013 7:07 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, July 25, 2016 8:40 AM
Points: 26, Visits: 115
GilaMonster (7/15/2013)
That is corrupt beyond the point of being able to identify objects. You've got fatal metadata corruption and allocation page corruption.
You're going to be very lucky if you get much at all out of that.

Go through the tables one by one (select name from sysobjects where xtype='U'), see if you can generate the script, see if you can select any of the data. I suspect a good number of objects will fail. It will take quite some time.

May be easier just to go back to the last good backup and accept that everything since is lost.


Many Thanks Gila!

** NOW JUST NEED THE ADMINS TO MOVE THIS THREAD TO THE SQL 2000 FORUM **
Post #1473637
Posted Wednesday, October 12, 2016 1:10 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, October 12, 2016 1:59 PM
Points: 2, Visits: 8
Try this on for size. It will give you the table name base on the object id in the where clause.

SELECT *
FROM sys.objects
WHERE object_id = 632864
GO
--Here's the reverse - to get the Object Id of a known table name. "Department" is the name of the table

SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].department')
GO

You can also use the following code to see if a table exist.

-- this is also good if you need to check is a table exist in SQL
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].department') AND type in (N'U'))
print 'expression is False'
ELSE
PRINT 'expression is TRUE.' ;
Post #1825481
Posted Wednesday, October 12, 2016 1:22 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 3:33 PM
Points: 4,130, Visits: 9,227
It sounds like you have data corruption, but you can also try the following to quickly search for an object_id across a multiple databases.

exec sp_MsForEachDB
'
USE ?;
print ''Searching ... ?''
print ''Found: ''+object_name( 632864 );
';



"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
Post #1825487
Posted Wednesday, October 12, 2016 1:37 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 326, Visits: 1,769
Not sure if you need the structure or the data; ideally you want both of course. I haven't lost data since a sql server 6.5 bad service pack but here is what I did then:

I've had some success rescuing data by using the non-clustered indexes to retrieve it when the clustered index tree is toast. You just need to be smart enough to write the correct WHERE clause and maybe jump over data pages that are bad. Works in a pinch.
Post #1825492
Posted Wednesday, October 12, 2016 2:46 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 8:14 PM
Points: 8,228, Visits: 17,799
I really hope the OP didn't depend on the last replies. Not because they're bad, but because it's been over 3 years now.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
Post #1825511
Posted Thursday, October 13, 2016 5:45 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 7:30 PM
Points: 994, Visits: 1,935
Luis Cazares (10/12/2016)
I really hope the OP didn't depend on the last replies. Not because they're bad, but because it's been over 3 years now.


I also hope the OP migrated away from SQL Server 2000 and discovered what lead to the massive corruption in the years since.
Though I am curious about one thing, would having log shipping make the data somehow accessible still if one finds themselves in this situation?


----------------------------------------------------
How to post forum questions to get the best help
Post #1825856
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse