Rebuilds data on a specified AMP. The rebuild operation can include:
- All tables on the AMP
- For a specified database: Primary, fallback, or both types of data in a specified database
- For a specified table: Primary, fallback, or both types of data, down regions, table header, or a specific range of rows
Syntax
REBUILD AMP nnnn { { ALL TABLES ALL DATA | { dbase | dbase.tbl } { ALL DATA | PRIMARY DATA | FALLBACK DATA } } [, rebuild_amp_spec [,...] ] | dbase.tbl { DOWN REGION | TABLE HEADER | row_range } [ lock_wait_minutes ] } ;
- rebuild_amp_spec
{ LOG INTO logdbase.logtbl | NO LOCK [ ON NO FALLBACK TABLES ] | WITH { DATABASE | TABLE | ROWRANGE } LOCK | [ n TABLES ] IN PARALLEL LOGRATE n }
- row_range
SUBTABLE subtable_id ROWRANGE start_rowid end_rowid [ AUTOADJUSTBLOCKS ]
Syntax Elements
- nnnn
- The number of the AMP that is to be rebuilt.
- ALL TABLES
- Specifies that all table data stored on the AMP, whether primary or fallback data, is to be rebuilt.
- dbase
- The name of a database. All tables (including stored procedures) in this database will be rebuilt on the specified AMP. Tables with fallback protection are fully recovered. Tables without fallback protection are left empty on the AMP. If the database contains a permanent journal, the journal is left unchanged.
- dbase.tbl
- The name of a table, stored procedure, UDF, or UDM that is to be rebuilt. The AMP on which the table or stored procedure will be rebuilt can be either online or offline.
- ALL DATA
- Specifies that both primary data and fallback data tables stored on the AMP should be rebuilt. recommended, unless you are certain that only primary or only fallback data on the AMP has been corrupted.
- PRIMARY DATA
- Specifies that only the primary data tables stored on the AMP should be rebuilt.
- FALLBACK DATA
- Specifies that only the fallback data tables stored on the AMP should be rebuilt.
- DOWN REGION
- To rebuild only the down regions of the specified table.
- TABLE HEADER
- To rebuild the table header on the specified AMP. At least one AMP in the system must be online. Information in fields 4, 6, and 10 of the table header row may be lost as a result of the rebuild. For more information on these fields, see Teradata Vantage™ - Database Design, B035-1094.
- SUBTABLE subtable_id
- To rebuild a specific subtable.
- ROWRANGE start_rowid end_rowid
- Rebuilds the specified range of rows.
- AUTOADJUSTBLOCKS
- Specifies that Table Rebuild should automatically adjust the specified row range to include complete blocks if the specified row range starts or ends in the middle of a bad block.
- lock_wait_minutes
- The amount of time in minutes that Table Rebuild should wait to obtain a table lock. The default is zero, which means REBUILD waits indefinitely.
- LOG INTO logdbase.logtbl
- Specifies that Table Rebuild is to run in the quiet mode or background mode. All messages will be written to the system console and to a user-defined table. The table is specified by database name and table name. For more information, see Usage Notes.
- NO LOCK [ON NO FALLBACK TABLES]
- Specifies that no lock should be applied to any non-fallback tables being rebuilt. (non-fallback tables are tables that were created without fallback protection.)
- WITH DATABASE LOCK
- Specifies that a database-level read lock will be placed on the source AMP database data used to rebuild each corrupted table. This is the default lock setting.This option is valid only with the ALL TABLES option.
- WITH TABLE LOCK
- Specifies that a table-level read lock will be placed on the source AMP table to be used to rebuild the corrupted table.This option is valid only with the ALL TABLES option.
- WITH ROWRANGE LOCK
- Specifies that a rolling-read lock (selected groups of row-only locks) will be placed on the source AMP table used to rebuild the corrupted table. This lock allows concurrent updates of the tables being used on the source AMP for the rebuild.
- [n TABLES] IN PARALLEL
- Specifies that during all-table rebuilds (rebuilds using ALL TABLES), or during fallback table rebuilds (using FALLBACK TABLES), or during database rebuilds (using the dbase options described) multiple tables can be rebuilt in parallel. This can make the rebuild operations complete more quickly. From 2 to 255 tables can be rebuilt simultaneously.
- LOGRATE n
- Provides progress information while rebuilding. Rebuild progress information is reported every n minutes. n is an integer from 1 to 10.