Re: Check database status.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks for the info.

This information is really buried in the SQL Server help. I was able to
find it, but I have a couple other questions.

If I call "'DBCC CHECKDB (tempdb) WITH TABLERESULTS, NO_INFOMSGS", I get no
results back if the DB checks out ok. Is it a safe bet to assume that if I
get no results, then the DB is ok, but if I do get results then the DB could
have errors and be in need of repair?

I am trying to come up with a method for providing the ability for my users
to check the database for errors and report if it is in error.

I also want to use this same call to repair the database if it is broken,
and provide feedback on the success of the repair.

I cannot find any info in the help to show how all of this could be checked
properly with result sets.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Elton W" <EltonW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:10BF2605-DF2D-4DAC-9C65-F9E8D734BD87@xxxxxxxxxxxxxxxx
> Hi Ken,
>
> In order to get result you should use option WITH TABLERESULTS. For
example
>
> sqlcommand.CommandText = "DBCC CHECKDB (tempdb) WITH TABLERESULTS";
> datareader = sqlcommand..ExecuteReader();
>
> Then you can get result in datareader.
>
> HTH
>
> Elton Wang
> elton_wang@xxxxxxxxxxx
>
>
> "Ken Varn" wrote:
>
> > I want to be able to check an SQLServer database to determine if it is
not damaged or in need of repair. I looked into the DBCC CHECKDB SQL call
to accomplish this. However, I cannot figure out how to check the status of
the database after making this call in ADO.NET. I tried using a
SqlDataReader, but there is nothing returned in the reader that gives me the
status of the call.
> >
> > Can someone make a recommendation on how I can check the status of a
database using ADO.NET?
> >
> >
> > --
> > -----------------------------------
> > Ken Varn
> > Senior Software Engineer
> > Diebold Inc.
> >
> > EmailID = varnk
> > Domain = Diebold.com
> > -----------------------------------


.



Relevant Pages

  • Re: Server: Msg 7105
    ... If you cannot do anything to the existing database, you could try to create a new database and move all of your objects and data to the other database. ... DBCC CHECKDB ... this warning about the REPAIR options of DBCC CHECKDB. ... "Use the REPAIR options only as a last resort. ...
    (microsoft.public.sqlserver.server)
  • Re: Server: Msg 7105
    ... from the database or is there something else i should try. ... DBCC CHECKDB ... this warning about the REPAIR options of DBCC CHECKDB. ... "Use the REPAIR options only as a last resort. ...
    (microsoft.public.sqlserver.server)
  • Re: cant open shared db
    ... you ned to split your database and get users to run their own ... Select "yes" to repair it. ... local ws, opens the db on the target network share, with the workgroup ... with the repair/compacting process. ...
    (microsoft.public.access.security)
  • Re: cant open shared db
    ... You are not required to split your database to fix this problem now, ... Select "yes" to repair it. ... local ws, opens the db on the target network share, with the workgroup ... with the repair/compacting process. ...
    (microsoft.public.access.security)
  • Re: Check database status.
    ... results to expect from CHECKDB if the database is in need of repair. ... Secondly, if repairs are performed, I want to be able to report to ... >> Ken Varn ...
    (microsoft.public.dotnet.framework.adonet)