Re: [Emerald] CheckDatabase

Dale E. Reed Jr. ( (no email) )
Mon, 22 Nov 1999 10:35:16 -0800

David Routh wrote:
>
> Anyway, here's how the new CheckDatabase. The Application log says it
> fails on Step 1...... can someone tell me what's happening?

Step 1 is the whole thing. If you are running SQL 7, what you could
do is break this down into multiple steps, one for each group. Then
if one failed, you would know exactly which one that was. For Example,
rather than running the CheckDatabase proc, have each step run a TSQL
command, and make them the below. Make sure you set up each step to
continue the next, even on failure, though.

1:
> DBCC CheckDB(Emerald)
>

2:
> DBCC NewAlloc

3:
> DECLARE @query VARCHAR(100)
> SELECT @query = "DBCC UpdateUsage("+ DB_NAME() + ")"
> EXEC (@query)

4:
> DBCC CheckIdent(Actions)
> DBCC CheckIdent(Charges)
> DBCC CheckIdent(ChargeTypes)
> DBCC CheckIdent(ClassDates)
> DBCC CheckIdent(Classes)
> DBCC CheckIdent(Credits)
> DBCC CheckIdent(Domains)
> DBCC CheckIdent(ExternalSystems)
> DBCC CheckIdent(ExternalTrans)
> DBCC CheckIdent(Groups)
> DBCC CheckIdent(Incidents)
> DBCC CheckIdent(InvoiceItems)
> DBCC CheckIdent(Invoices)
> DBCC CheckIdent(Mail)
> DBCC CheckIdent(MasterAccounts)
> DBCC CheckIdent(Payments)>
> DBCC CheckIdent(RadATConfigs)
> DBCC CheckIdent(RadConfigs)
> DBCC CheckIdent(Rates)
> DBCC CheckIdent(Reports)
> DBCC CheckIdent(Scripts)
> DBCC CheckIdent(Servers)
> DBCC CheckIdent(SubAccounts)

5:
> DECLARE @tablename varchar(30)
> DECLARE @tablename_header varchar(75)
> DECLARE tnames_cursor CURSOR FOR SELECT name FROM sysobjects WHERE type =
> 'U'
> OPEN tnames_cursor
> FETCH NEXT FROM tnames_cursor INTO @tablename
> WHILE (@@fetch_status <> -1)
> BEGIN
> IF (@@fetch_status <> -2)
> BEGIN
> SELECT @tablename_header = "Updating " +
> RTRIM(UPPER(@tablename))
> PRINT @tablename_header
> EXEC ("UPDATE STATISTICS " + @tablename )
> END
> FETCH NEXT FROM tnames_cursor INTO @tablename
> END
> PRINT " "
> PRINT " "
> SELECT @tablename_header = "************* NO MORE TABLES"
> + " *************"
> PRINT @tablename_header
>
> PRINT " "
> PRINT "Statistics have been updated for all tables."
> DEALLOCATE tnames_cursor

-- 

Dale E. Reed Jr. Emerald and RadiusNT__________________________________________IEA Software, Inc. www.iea-software.com

For more information about this list (including removal) go to:http://www.iea-software.com/support/maillists/liststart