16.10 - SCANDISK - Teradata Database

Teradata Database Support Utilities

prodname
Teradata Database
vrm_release
16.10
created_date
June 2017
category
Configuration
featnum
B035-1180-161K

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



/Y
Prevents Filer 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. The free CIs are also scanned unless a tid is provided.
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. The free CIs also are scanned unless a tid is provided.
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.
FIX
Used with FREECIS only. SCANDISK attempts to resolve discrepancies by updating allocation map to match state of cylinder as indicated by the CI. Remaining discrepancies, as from corrupted cylinder data, are reported.
Run SCANDISK FREECIS without the FIX option before running it with the FIX option. This allows for inspection of the initial output prior to attempting to fix any problems.
The SKIPDECOMPRESS option cannot be used together with the FIX option.
MI
Scans the MI only.
WAL
Scans the WAL log.
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.
The SKIPDECOMPRESS option cannot be used together with the FIX option.
WITHSPOOL
Causes scandisk to check all spool data in addition to checking 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.
tid
Specifies the subtable to scan. For more information on tid formatting, see Specifying a Subtable Identifier (tid).
ridrange
Restricts the scan of a subtable to the specified RowID range. For more information on ridrange formatting, see Rows and Row Ranges.
The online help lists this option as rowspec [TO rowspec].
TABLE
Scans the specified subtable range. SCANDISK starts the scan at the subtable location specified by tid1 and ridspec1, and ends the scan at the subtable location specified by tid2 and ridspec2.
The starting subtable location,tid1 ridspec1, must be less than the ending subtable location, tid2 ridspec2.
If the starting subtable does not exist (that is, the table was deleted), SCANDISK starts from the next tid which is greater than the starting tid. Similarly, if the ending subtable does not exist, SCANDISK ends the scan at the tid which is just less than the specified ending tid.
If the ending subtable is not specified, SCANDISK scans from the starting subtable until the end of all the subtables, followed by the free CIs and the WAL log.
For more information on tid formatting, see Specifying a Subtable Identifier (tid). For more information on ridspecformatting, see Rows and Row Ranges.
ridspec
The RowID specification used with the TABLE option to specify the subtable locations to start and stop the scan. For more information on RowIDs and ridspec formatting, see Rows and Row Ranges.
The online help lists this option as rowspec.
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. SCANDISK continues reporting new errors it encounters after the inquiry.
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 that defines the time interval to send an INQUIRE request to display SCANDISK progress. If timeopt is not specified, number defaults to SECONDS.
  • timeopt specifies the time unit that number represents. 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 when SCANDISK is started on online AMPs when the database is running.
CR
Specifies to use cylinder reads instead of regular data block preloads. This is the default when SCANDISK is run with the database offline or run on an AMP that is offline.
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.

Usage Notes

You can run SCANDISK while the system is online and the Teradata Database is available for normal operations. You can also use Filer to run SCANDISK when the database is offline, or on an AMP that is offline to help diagnose and fix file system issues. For more information see Starting Filer.

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.

When Filer is started in vproc-specific mode (using the -v startup option), SCANDISK displays errors as they are detected, even if the INQUIRE command is not issued during the SCANDISK run.

You can rearrange the order of the options following the SCANDISK command.

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 (or VPROC).

If you specify either tid or ridrange or both, all of the Teradata Database and CIs containing the requested table and/or rows are verified.

If you use the TABLE option with the CI option, SCANDISK will check all of the cylinders that contain the specified subtable range.

The first and last of the cylinders checked may contain subtables outside of the specified range because multiple subtables can reside on a given cylinder.

The lowest level file system structure that SCANDISK verifies is the data block. If you specify RowIDs, SCANDISK will start and end the scan at the data blocks which contain the specified rows. The entire data block is checked; therefore, rows outside of the specified row range may also be checked since a DB contains multiple rows.

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 Database Design.

Teradata recommends that you do not run SCANDISK FREECIS FIX directly. First, run SCANDISK FREECIS and store and inspect the output. Then, run SCANDISK FIX. The Teradata Database must be down in order to run SCANDISK FREECIS FIX.

If Filer aborts, or the system resets during a SCANDISK FREECIS operation, the recently freed cylinders are marked as “unvalid” because Filer will not have completed validating them. The AMPs that own these cylinders will be kept down when Teradata Database restarts. To bring the AMPs back up, start Filer again, set scope to the affected AMPs and reissue the SCANDISK FREECIS command.

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.

Aborting SCANDISK

Because 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, 2008 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 010100000000F4C2 Sector 16 (0010) length 1 (0001)
DB ref count doesn’t match DBD row Count
Tue Feb 28, 2008 15:16:50 : The scandisk found problems
Vproc 1 response
Tue Feb 18, 2008 15:16:50 : The scandisk found nothing wrong
Filer ==>

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 below:


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.