Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Wednesday, March 21, 2012

DBCC Page does not appear to function?

I have a corrupt sql server 2000 database table, dbcc checktable yields:

Server: Msg 8929, Level 16, State 1, Line 1

Object ID 738101670: Errors found in text ID 1922475229184 owned by data record identified by RID = (1:5663655:28) PageId = 53918671.

Server: Msg 8965, Level 16, State 1, Line 1

Table error: Object ID 738101670. The text, ntext, or image node at page (1:5663737), slot 0, text ID 1922475229184 is referenced by page (1:4527446), slot 9, but was not seen in the scan.

When I try to use dbcc page( testdb, page#,1 ) where I plug in any of the reported page#'s above I always get the following:

"Server: Msg 8968, Level 16, State 1, Line 2
Table error: DBCC PAGE page (41728:1) (object ID 0, index ID 0) is out of the range of this database.
DBCC execution completed. If DBCC printed error messages, contact your system administrator."

The only page value which does not yield this error is page 1, which is the only pageno I found on any examples on the web. I guess this is because this is the only page it works on?

Can you post the exact command your using?

Also, can you tell me the result of 'SELECT DB_ID()'?

Thanks,|||Looks like you've got your parameters swapped. It should be dbcc page(testdb, 1, page#). The second parameter is the file number (which will always be 1 if your database has no secondary data files).
|||

You are correct! The format I originally found on the internet was either for a prior version or something else unexplained. I found the correct format in one of Ken Henderson's books.

Thanks!

sql

Sunday, March 11, 2012

DBCC InputBuffer statement to be part of a select statement

I want to use DBCC inputbuffer function for all the spids in sysprocesses table without using a cursor or loop. In other words, I want to have the value of dbcc inputbuffer part of the select statement directly or indirectly. Is there a way??SQLDBAxxx,
Try running the following:

----------
set nocount on
select 'exec DBCC INPUTBUFFER('+convert(varchar,spid)+')'
from sysprocesses
go
----------

This will generate the DBCC code you need to run; it won't run
DBCC in the TSQL mode that you need. You can save the result set
and reload it to run it. Simple, but works...

I've never been able to execute a DBCC statement using ANSI-SQL syntax( select,update, insert ).|||SQLDBAxxx,
Try running the following:

----------
set nocount on
select 'DBCC INPUTBUFFER('+convert(varchar,spid)+')'
from sysprocesses
go
----------

This will generate the DBCC code you need to run; it won't run
DBCC in the TSQL mode that you need. You can save the result set
and reload it to run it. Simple, but works...

I've never been able to execute a DBCC statement using ANSI-SQL syntax( select,update, insert ).|||Thank you Scooter. But this is not what I wanted to do. I want to capture the input buffer for a given spid. I can do it thro a cursor or loop but if my recordset is big then by the time it comes to execute the dbcc inputbuffer for the last spid the inputbuffer may have changed. That is the reason I wanted to try by some other way to narrow down the time difference.

Wednesday, March 7, 2012

DBCC DBREINDEX failure

Rob,
The reindex function will need data + (2 x Index space) to create an index.
You might want to examine the SORT_IN_TEMPDB option of the CREATE INDEX
statement, and look at dropping and recreating the indexes instead of the
DBCC DBREINDEX statement.
-- Bill
"Rob" <Rob@.discussions.microsoft.com> wrote in message
news:6F079FC8-012F-4E24-8E07-645F1A197B25@.microsoft.com...[vbcol=seagreen]
> Repeat post. My apologies... it seemed that my original post had gone into
> limbo (timeout issue) so I had reposted.
> "Rob" wrote:
Thanks Bill.
I've been wondering if reindexing would do any good at all given that most
of my tables only have one clustered index. If it's clustered then there
shouldn't be any reason to drop and recreate the index, right... as data and
index pages are always kept in a sorted order.
"AlterEgo" wrote:

> Rob,
> The reindex function will need data + (2 x Index space) to create an index.
> You might want to examine the SORT_IN_TEMPDB option of the CREATE INDEX
> statement, and look at dropping and recreating the indexes instead of the
> DBCC DBREINDEX statement.
> -- Bill
> "Rob" <Rob@.discussions.microsoft.com> wrote in message
> news:6F079FC8-012F-4E24-8E07-645F1A197B25@.microsoft.com...
>
>