SCANDISK - Advanced SQL Engine - Teradata Database

Database Utilities

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
ynh1604715438919.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1102
lifecycle
previous
Product Category
Teradata Vantage™

Purpose

The SCANDISK command validates the file system and reports any errors found, including discrepancies in the following items:

  • Key file system data structures, such as master index (MI), current (memory) copy of the snapshot MI, cylinder indexes (CIs), data blocks (DBs), and free CIs. Additionally, SCANDISK validates the WAL Log structures: WAL master index (WMI), WAL cylinder indexes (WCIs), and WAL data blocks (WDBs).
  • The RowIDs, including the partition numbers, for key physical rows should match the values stored for those rows in the cylinder index and master index.

    "Physical row" means the low-level row structure that is stored by the file system. A physical row can store one of several types of data, such as table rows, the data from one or more column partitions, a table header (metadata about the table), index data structures, and other types of data. Every physical row stores only one kind of data.

  • The WAL Logical Sequence Number (WLSN) for key physical TJ and REDO records should match the values stored for those records in the WAL Cylinder Index and WAL Master Index.
  • Within a subtable, the internal partition number of a physical row should be greater than or equal to the internal partition number in the preceding row, if any.
  • Within a subtable, either all the physical rows are partitioned (the physical rows include an internal partition number) or all the physical rows are nonpartitioned (the physical rows do not include an internal partition number).
  • Within a partition, the RowID of a physical row should be greater than the RowID in the preceding row, if any.
  • The calculated checksum values of key file system data structures (Cylinder Index, Data Blocks and their WAL counterparts) should match the recorded checksum values (if checksums are enabled).
SCANDISK does not validate the following items:
  • The internal partition number is not validated for consistency with the result of the partitioning expression applied to the partitioning columns in a logical row, or for consistency with currently defined column partition numbers.
  • The hash value in the RowID of the physical row header is not validated with the result of hashing the index columns for a primary index or primary AMP index.

Syntax

SCANDISK
  [ /Y ]
  [ /S | /M | /L ]
  [ CI | DB | FREECIS | MI | WCI | WDB | WMI ]
  [ SKIPDECOMPRESS | SKIPDECOMP ]
  [ WITHSPOOL ]
  [ inquire_opt ]
  [ NOCR | CR ]
  [ { MAXERRCNT | MAXERR } n ]
/Y
Prevents Ferret from displaying a confirmation message.
/S
Scans the MI and WMI.
/M
Scans the MI, CIs, WMI, and WCIs.
/L
Scans the MI, CIs, DBs, WMI, WCIs, and WDBs.
CI
Scans the MI and CIs. If the scope is AMP or all subtables, rather than selected subtables, the free CIs are also scanned.
DB
Scans the MI, CIs, and DBs. This is the default for the normal file system, which can be overridden by the CI, MI, or FREECIS options. If the scope is AMP or all subtables, rather than selected subtables, the free CIs are also scanned.
FREECIS
Scans CIs of cylinders that the allocation map indicates are free. Reports any cylinder for which the CI does not also indicate that the cylinder is free.
MI
Scans the MI only.
WCI
Scans the WMI and WCIs.
WDB
Scans the WMI, WCIs, and WDBs. This is the default for the WAL log, which can be overridden by the WCI or WMI options.
WMI
Scans the WMI only.
SKIPDECOMPRESS
SKIPDECOMP
Prevents SCANDISK from uncompressing block-level compressed data blocks. This skips some validation checks, but can speed SCANDISK when there are many compressed data blocks in the system.
WITHSPOOL
Checks all spool data in addition to non-spool data.
If WITHSPOOL is not specified, only the first few spool cylinders are checked. If the scope of the command is limited to the MI, the entire MI is always scanned including non-spool and spool data.
inquire_opt
Displays the lowest tid and rowid being scanned among the AMPS involved. This option also reports SCANDISK progress as a percentage of total time to completion and displays the errors encountered so far.
The syntax for the INQUIRE option is as follows:


  • NONE specifies that only one INQUIRE request is sent for the SCANDISK job.
  • number is an integer which defines the time interval to send an INQUIRE request to display SCANDISK progress. If you do not specify timeopt, then number defaults to SECONDS.
  • timeopt specifies the time unit which number represents. The default is SECONDS. It should be one of the following:
    • SECONDS, SECOND, SECON, SECO, SECS, SEC, S
    • MINUTES, MINUTE, MINUT, MINU, MINS, MIN, M
    • HOURS, HOUR, HOU, HO, HRS, HR, H
    • DAYS, DAY, DA, D
For example, scandisk inquire 5 m will start a SCANDISK job which reports SCANDISK progress every five minutes.
The maximum time interval allowed is seven days.
NOCR
Specifies to use regular data block preloads instead of cylinder reads. This is the default.
CR
Specifies to use cylinder reads instead of regular data block preloads.
MAXERRCNT n
MAXERR n
Specifies the maximum number of errors SCANDISK should show per subtable per vproc. SCANDISK stops when it finds the specified number of errors. Use this setting to reduce the SCANDISK running time when there are an excessive number of errors reported.

The Ferret INQUIRE (or INQ) and ABORT commands can be used to check on the progress or halt this operation during command execution.

Usage Notes

You can run SCANDISK while the system is online and Teradata Database is available for normal operations.

Teradata recommends you run SCANDISK in the following situations:
  • To validate data integrity before or after a system upgrade or expansion.
  • If you suspect data corruption.
  • As a routine data integrity check (perhaps weekly).
A slight performance impact might occur while SCANDISK is running.

You can rearrange the order of the syntax following the SCANDISK command. For example, the command SCANDISK NOCR MI is the same as the command SCANDISK MI NOCR.

If you do not type any options, SCANDISK defaults to DB and all subtables on the vproc. The default scope is to scan both the normal file system and the WAL log, each from the lowest (DB, WDB) level through the highest (MI, WMI). The free CIs are also scanned.

The SCANDISK command can be limited by the SCOPE command to scan, for example, just one table, just the WAL log, or just certain AMPs. For more information, see SCOPE.

By default, SCANDISK uses regular data block preloads instead of cylinder reads. The CR option allows you to run SCANDISK using cylinder reads to preload data into cylinder slots which may improve SCANDISK performance. However, if other work also requires the use of cylinder slots, the competition for slots could slow down SCANDISK and the other work. In addition, the performance gain is dependent on the amount of data loaded, the distribution of the data, and the average block I/O size.

The NOCR option lets you turn off cylinder slot usage by SCANDISK, which could result in slower SCANDISK performance, but which will allow other work requiring cylinder slots to progress unimpeded.

SCANDISK reports only what it finds when scanning is completed.

The output from SCANDISK may include table row identifiers (RowIDs).

A RowID consists of a 16-byte value that includes the following information:
  • The first 8-bytes is the internal partition number of the row.

    (For a nonpartitioned table, the internal partition number is zero, and the internal partition number is not actually stored in the row itself.)

  • The next 8-bytes include a hash bucket value and uniqueness value for the row.
For more information on internal table row formats, see Teradata Vantage™ - Database Design, B035-1094.

SCANDISK start, finish, abort, and system reset times are logged to the Linux /var/log/messages file and also to the DBS.SW_Event_Log table.

Example: SCANDISK output

The following is an example of output that SCANDISK generates.

Ferret ==> 
scandisk 
Tue Feb 28, 1995 15:16:50 :Scandisk has been started on all AMP Vprocs in the SCOPE.
Vproc 0 response
DB @ Cylinder 0 2 (0000 0002) Sector 16 (0010) length 1 (0001)
DB ref count doesn’t match DBD row Count

Tue Feb 28, 1995 15:16:50 : The scandisk found problems
Vproc 1 response
Tue Feb 28, 1995 15:16:50 : The scandisk found nothing wrong

Example: SCANDISK output for LSI interrupted write in a CI

The following is an example of output that SCANDISK generates when it finds an LSI interrupted write pattern in a CI. This error is specific to LSI brand storage.

Ferret ==> 
scandisk ci
Mon May 06, 2002  15:12:20 :Scandisk has been started on all AMP Vprocs in the SCOPE.
vproc  0 (0000)  response
Mon May 06, 2002  15:55:21 : CI @ Cylinder 0 7 (0000 000007)
Mon May 06, 2002  15:55:21 : LSI interrupted write pattern found in CI.
0120 MAY 05  05:02:35 LUN 1111, Start Block 00004545, Blocks 0400

SRD
num     table id        firstdbd  dbdcount offset
       u0    u1   tai
---- ----- ----- -----  --------  -------- ------
0001 0000  0494  0800     FFFF      0014   001E
Mon May 06, 2002  15:55:21 : Invalid DBD sector length of 14901 (3A35) found
Mon May 06, 2002  15:55:21 : Invalid DBD sector length of 26912 (6920) found
Mon May 06, 2002  15:55:21 : Invalid DBD sector length of 25972 (6574) found
Mon May 06, 2002  15:55:21 : Invalid DBD sector length of 12336 (3030) found
Mon May 06, 2002  15:55:21 : First rowid out of order dbds 18 (0012) and 19 (0013)

Example: SCANDISK output for LSI interrupted write in a DB

The following is an example of output that SCANDISK generates when it finds an LSI interrupted write pattern in a DB. This error is specific to LSI brand storage.

Ferret ==>
scandisk db
Tue Feb 28, 1995 15:16:50 :Scandisk has been started on all AMP Vprocs in the SCOPE.
vproc  0 (0000)  response
Mon May 06, 2002  15:12:20
1 of 1 vprocs responded with no messages or errors.
Type 'ABORT' to stop the command before completion
Type 'INQUIRE' to check on progress of command
Reading
vproc  0 (0000)  response
Mon May 06, 2002  15:11:11 : CI @ Cylinder 0 7 (0000 000007)
Mon May 06, 2002  15:11:11 : LSI interrupted write pattern found in DB.
0120 MAY 05  05:02:35 LUN 1111, Start Block 00004545, Blocks 0400
Mon May 06, 2002  15:11:11 : rows  -1 (FFFFFFFF) and 0 (0000) are out of order

Example: Using SCANDISK to scan the WAL log

The following example limits the scan to just the WAL log.

scope wal
scandisk

Example: Using SCANDISK to scan one data subtable

The following example scans one user data subtable.

scope table 'employee.emp' p
scandisk

Example: Using the INQUIRE option to display SCANDISK progress

In the following example, an INQUIRE command is sent per minute. Therefore, you get a display of SCANDISK progress every minute.

Ferret ==>
> scandisk inq 1 m

> Mon Jul 17, 2012 05:02:45
SCANDISK STATUS :
Slowest vproc 2 is 44% done
Fastest vproc 3 is 64% done
The scandisk is about 55% done

Aborting SCANDISK

Since SCANDISK DB verifies that every byte in the file system is accounted for, this process can be very time consuming. Therefore, you have the option of stopping the process by typing the following command:



ABORT can take up to 30 seconds to process.

After it is initiated, ABORT stops the SCANDISK process and reports the current status.

When the abort is successful, the following appears:

Are you sure you want to scandisk?  (Y/N)  y
Tue Feb 28, 1995 15:16:50 : Scandisk has been started on all AMP Vprocs in the SCOPE.
Type ‘ABORT‘ to stop them before completion
Type ‘INQUIRE‘ to check on progress of command
ABORT
Abort request has been sent
Vproc 0 response
DB @ Cylinder 0 2 (0000 0002) Sector 16 (0010) length 1 (0001)
DB ref count doesn’t match DBD row Count
Tue Feb 28, 1995 15:16:50 : The scandisk found problems
Vproc 1 response
Tue Feb 18, 1995 15:16:50 : The scandisk found nothing wrong
Ferret ==>

Checking SCANDISK Status

Because SCANDISK can take a long time to run, you might want to do a status check after starting a scan. You can do this using the INQUIRE command:



INQUIRE displays the lowest tid and rowid being scanned among the AMPS involved, and reports SCANDISK progress as a percentage of total time to completion. It also displays a list of errors that occurred since the last INQUIRE command.

This .INQUIRE command is similar to the INQUIRE startup option for SCANDISK, but this command runs only once when you invoke it. Unlike the INQUIRE startup option, the INQUIRE command cannot be set to automatically repeat at specified intervals.

The SCANFREE section of INQUIRE output shows the status of scanning free CIs.

Sample INQUIRE output is shown below.

Ferret  ==>
scandisk
Wed Apr 11, 2007  16:46:24 : Scandisk will be started
                           On All AMP vprocs 
    Do you wish to continue based upon this scope?? (Y/N)
y
Wed Apr 11, 2007  16:46:26 : Scandisk has been started
Type 'ABORT' to stop the command before completion
Type 'INQUIRE' to check on progress of command
inq

Inquire request has been sent

Wed Apr 11, 2007  16:46:30
SCANDISK STATUS : 
Slowest vproc      0  is   2% done
Fastest vproc      0  is   2% done
The scandisk is about    2% done

Scanning Table: 0 1434 1024

Scanning Row: 0 1972 32488 0 1 

Nobody has reached the SCANFREE stage


Wed Apr 11, 2007  16:46:30
2 of 2 vprocs responded with no messages or errors.
Type 'ABORT' to stop the command before completion
Type 'INQUIRE' to check on progress of command
inq

Inquire request has been sent

Wed Apr 11, 2007  16:46:36
SCANDISK STATUS : 
Slowest vproc      1  is   4% done
Fastest vproc      0  is   5% done
The scandisk is about    4% done

Scanning Table: 0 1434 1024

Scanning Row: 0 28847 58771 0 95 

Nobody has reached the SCANFREE stage

vproc  1 (0001)  response

Wed Apr 11, 2007  16:46:33 : CI @ Cylinder 0 100 (0000 000064)
Wed Apr 11, 2007  16:46:33 : CID's First TID doesn't Match CI's First TID
    0  1434  1024 (0000 059A 0400)  ( test.trans )
    0  1435  1024 (0000 059B 0400)  ( TEST.data1 )
/nWed Apr 11, 2007  16:46:33 : CID's Last TID doesn't Match CI's Last TID
    0  1434  1024 (0000 059A 0400)  ( test.trans )
    0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:33 : Table Header is missing. May be in the process of being dropped
    0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3418 (0D5A) length 126 (007E)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3629 (0E2D) length 70 (0046)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3699 (0E73) length 70 (0046)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 48 (0030) length 65 (0041)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )
Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 432 (01B0) length 65 (0041)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 113 (0071) length 66 (0042)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 179 (00B3) length 66 (0042)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 2646 (0A56) length 122 (007A)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 1953 (07A1) length 66 (0042)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 2346 (092A) length 66 (0042)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 2932 (0B74) length 72 (0048)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3004 (0BBC) length 72 (0048)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 684 (02AC) length 72 (0048)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 756 (02F4) length 72 (0048)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 1191 (04A7) length 109 (006D)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 1606 (0646) length 74 (004A)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 2768 (0AD0) length 74 (004A)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3150 (0C4E) length 119 (0077)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 1056 (0420) length 69 (0045)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : DB @ Cylinder 0 100 (0000 000064) Sector 3544 (0DD8) length 69 (0045)
                           : TID :     0  1435  1024 (0000 059B 0400)  ( TEST.data1 )

Wed Apr 11, 2007  16:46:34 : SRD TID.uniq doesn't match DB tid.uniq
    0  1435 (0000 059B)
    0  1434 (0000 059A)

Wed Apr 11, 2007  16:46:34 : CI @ Cylinder 0 266 (0000 00010A)

Wed Apr 11, 2007  16:46:34 : Table Ids are out of order 
    0  1435  1024 (0000 059B 0400)  ( TEST.data1 )
    0  1434  1024 (0000 059A 0400)  ( test.trans )





Wed Apr 11, 2007  16:46:36
1 of 2 vprocs responded with no messages or errors.
Wed Apr 11, 2007  16:46:36
1 of 2 vprocs responded with messages or errors as specified above
Type 'ABORT' to stop the command before completion
Type 'INQUIRE' to check on progress of command