Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

DBCC check Problem

2 posts in Windows NT Last posting was on 2000-09-26 23:39:54.0Z
Jerry Ford Posted on 2000-09-26 22:55:34.0Z
Reply-To: "Jerry Ford" <jerry@zelcom.com>
From: "Jerry Ford" <jerry@zelcom.com>
Subject: DBCC check Problem
Date: Tue, 26 Sep 2000 15:55:34 -0700
Lines: 53
Organization: Zelcom.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <LLr2i4AKAHA.286@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: 208.41.91.43
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:1607
Article PK: 1089080

Hello all,
We are trying to set up a script to run all of our DBCC checks and then dump
to a backup device. Our problem is this, we want to have the operation
suspend if their are any problems on any of the DBCC checks. Can anyone
suggest a script for this or tell us what is wrong with the one we are
using?


DECLARE
@sql_cmd_line varchar(255),
@dbname varchar(255),
@dev_name varchar(255),
@output varchar(255),
@error_nbr_cnt int,
@sql_error_nbr int

dbcc traceon (3605)

print 'DBCC CHECKDB'
execute sp_dbcc_checkcb
SELECT @sql_error_nbr = @@error
IF @sql_error_nbr = 0
BEGIN
SELECT @error_nbr_cnt = @error_nbr_cnt + 1

END
select @output = convert(varchar(255), @sql_error_nbr)
print @output

print 'DBCC CHECKALLOC'
execute sp_dbcc_checkalloc
SELECT @sql_error_nbr = @@error
IF @sql_error_nbr = 0
BEGIN
SELECT @error_nbr_cnt = @error_nbr_cnt + 1
END
select @output = convert(varchar(255), @sql_error_nbr)
print @output

print 'DBCC CHECKCATALOG'
execute sp_dbcc_checkcatalog
SELECT @sql_error_nbr = @@error
IF @sql_error_nbr = 0
BEGIN
SELECT @error_nbr_cnt = @error_nbr_cnt + 1
END
select @output = convert(varchar(255), @sql_error_nbr)
print @output

Thanks in advance,
Jerry R. Ford


Rob Verschoor Posted on 2000-09-26 23:39:54.0Z
Reply-To: "Rob Verschoor" <rob@sypron.nl>
From: "Rob Verschoor" <rob@sypron.nl>
References: <LLr2i4AKAHA.286@forums.sybase.com>
Subject: Re: DBCC check Problem
Date: Wed, 27 Sep 2000 01:39:54 +0200
Lines: 85
Organization: Sypron B.V.
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <8U$wPSBKAHA.201@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: i0249.pvu.euronet.nl 194.134.164.250
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:1606
Article PK: 1089079

Easiest is to use dbcc checkstorage. It's much faster than the "old"
dbcc commands , and it doesn't have their locking problems either.
WHen finished, you can query the results in dbccdb to determine if
there's been any errors. This seems the easiest way of doing it.
For info on dbcc checkstorage and setting up dbccdb (which is required
to run dbcc checkstorage), you can download the ASE Quick Reference
Guide Supplement from http://www.sypron.nl/ase_qref.html ; this has a
section detailing the required steps.

HTH,

Rob
----------------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.0
Certified Sybase Professional DBA/SQL Developer for ASE 11.5
Certified DBA/Performance & Tuning Specialist for Sybase System 11

email mailto:rob@sypron.nl.*No*Spam*Please*
WWW http://www.sypron.nl
snail Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
----------------------------------------------------------------------

"Jerry Ford" <jerry@zelcom.com> wrote in message
news:LLr2i4AKAHA.286@forums.sybase.com...
> Hello all,
> We are trying to set up a script to run all of our DBCC checks and
then dump
> to a backup device. Our problem is this, we want to have the
operation
> suspend if their are any problems on any of the DBCC checks. Can
anyone
> suggest a script for this or tell us what is wrong with the one we
are
> using?
>
>
> DECLARE
> @sql_cmd_line varchar(255),
> @dbname varchar(255),
> @dev_name varchar(255),
> @output varchar(255),
> @error_nbr_cnt int,
> @sql_error_nbr int
>
> dbcc traceon (3605)
>
> print 'DBCC CHECKDB'
> execute sp_dbcc_checkcb
> SELECT @sql_error_nbr = @@error
> IF @sql_error_nbr = 0
> BEGIN
> SELECT @error_nbr_cnt = @error_nbr_cnt + 1
>
> END
> select @output = convert(varchar(255), @sql_error_nbr)
> print @output
>
> print 'DBCC CHECKALLOC'
> execute sp_dbcc_checkalloc
> SELECT @sql_error_nbr = @@error
> IF @sql_error_nbr = 0
> BEGIN
> SELECT @error_nbr_cnt = @error_nbr_cnt + 1
> END
> select @output = convert(varchar(255), @sql_error_nbr)
> print @output
>
> print 'DBCC CHECKCATALOG'
> execute sp_dbcc_checkcatalog
> SELECT @sql_error_nbr = @@error
> IF @sql_error_nbr = 0
> BEGIN
> SELECT @error_nbr_cnt = @error_nbr_cnt + 1
> END
> select @output = convert(varchar(255), @sql_error_nbr)
> print @output
>
> Thanks in advance,
> Jerry R. Ford
>
>