16.10 - PATCH - 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 PATCH command does the following:

  • Modifies file system segments while the segment is in memory, whether the segment is a CI, a DB, the FIB, the MI, a row, or a WAL log segment or object. The modified segments can later be forced to disk with the WRITE command. The PATCH command can also be used with interior file system objects, such as a CID, SRD, DBD, WCID, and WDBD.
  • Automatically updates the checksum of the segment being modified when the modified segment is written.

Syntax

The online help lists the patch options (/B, /C, /W, /S, /D, /L) as /patchopt. The syntax diagram only shows the options at the beginning of the command, but you can type the options at the beginning or end of the command.


where the following tells how to address the segment being patched:

/B or /C
Input is one byte at a time. You can type input as a number (0x0 to 0xFF) or a character string delimited by apostrophes or double quotation marks (a character is a string of length 1).
/W or /S
Input is one numeric Half Word (Short Integer, two bytes) at a time (0x0 to 0xFFFF). This is the default.
/D or /L
Input is one numeric Word (Long Integer, four bytes) at a time (0x0 to 0xFFFFFFFF).
offset
the first location to be patched is specified as offset bytes from the beginning of the current selected object. In most cases, the current selected object is reflected by the prompt, but in some cases, this might not be true. For example, even though the prompt shows Row==>, the last selected object can be one row or a range of rows. With a range of rows, the offsetis displaced from the beginning of the first row in the range.

Usage Notes

The PATCH command syntax is the same, regardless of the current input prompt, except when you are in Patch Mode already, in which case offset is optional. If omitted, offset defaults to the current location.

If you type an invalid command, an error message is displayed, and the command is ignored.

If you use PATCH from a CI or DB prompt, the snapshot MI is invalidated, forcing the system to read CIs to rebuild the MI at the next file system startup.

When Filer is started on an AMP with the database down, patching at the MI prompt will result in the patched MI being written to the snapshot MI location on disk. This patched MI copy will be used to start the next instance of the file system.

Do not attempt to patch the snapshot MI. Instead, use the SNAPMI INVALIDATE command to force the MI to be rebuilt from the CIs at the next file system startup.

When you type the PATCH command, it must be the only command on the command line because the command switches from general command syntax to a specific command syntax. Therefore, both the following command entries will generate an error:

CI /P 200; PATCH /W 1567H
PATCH /W 1567H;WRITE

After you issue the PATCH command, the prompt changes to reflect that Filer has entered Patch Mode, and shows the object and address being patched. The current value of the cell open for patching is displayed in both HEX and DECIMAL. Prompting continues until you issue the DONE or CANCEL command, at which time the prompt is restored to what it was before patching started. The following table describes what happens when exiting Patch Mode.

IF you exit Patch Mode using … THEN …
DONE changes are saved to the segment and other tasks will see the changes immediately.
CANCEL changes are not saved and the segment will be left exactly the same as when you entered Patch Mode.

Because the checksum is stored externally, patching a single file system segment causes an additional segment to be updated with the new checksum of the segment if checksums are enabled on the block.

PATCH Commands

In Patch Mode, the following commands are allowed:

patch_replacement

Replaces the contents of the current cell with the specified input.


Syntax Element Description
number For a description of numeric entries, see Numeric Input.
string A list of characters delimited by apostrophes or double quotation marks (only valid in /Bor /C mode). A closing delimiter is required. Two consecutive delimiter characters translates to a single character of the same type.
SKIP 
or SK Skips the contents of the current cell and moves to the next cell.

BACK

Causes PATCH not to change the value of the current cell, and instead move back a specified number of cells.


Syntax Element Description
number The number of cells to move back.

CANCEL

Exits from Patch Mode without saving any changes that were made. Leaves the segment exactly as it was when Patch Mode was started.


DONE

Exits from Patch Mode, saving the changes that were made to the segment. Because the segment is now patched, modifications are visible to the outside world.


Syntax Element Description
QUIT, Q, STOP, ST, END, EXIT Synonyms for DONE.
/NOCHECKSUM If checksums are enabled on the segment being modified or written, the checksum is not updated and written to the external segment that contains the checksum. The /NOCHECKSUM option is not available with any of the DONE synonyms.

PATCH

The PATCH command itself, using the normal PATCH syntax, can be used at the Patch Mode prompt to change the current patch options. The offsetis counted from the start of the current selected entity. If offsetis omitted, the current location is not changed.

REPEAT

Repeats the patch_replacement a specified number of times, or until the end of segment is reached.


Syntax Element Description
ALL or * Repeat the patch_replacement operation for every cell until end of the current segment.
number Specifies how many times to repeat the patch_replacement operation.

SKIP

Moves to the next cell without making any changes in the current cell.


Global Filer Commands

All global Filer commands (except QUIT) behave exactly as they do in regular Filer Command Mode. For additional information, see Filer Command Types.

Example: Using the Filer PATCH command

DB ==> patch /b 0 
Now entering PatchMode  
Patch: DB :  0000 : 0000 (    0)  ==> 2 
Patch: DB :  0001 : 0008 (    8)  ==> 4 
Patch: DB :  0002 : 0006 (    6)  ==> sk 
Patch: DB :  0003 : 00f0 (  240)  ==> done 
Exiting Patch Mode 
DB ==>>