NuoDB Check

NuoDB Check is a command line utility that can do the following:

Description

Dropping Non-Referenced Database Objects

NuoDB Check traverses each database object (data, sequence, index, and so on) in the specified archive. Any atoms in the archive that are no longer referenced by any database object are dropped from the database and the relevant atom file is removed from the archive. NuoDB Check reclaims space attributed to dropped indexes, tables, sequences and also blobs.

Note that NuoDB automatically reclaims unused space within each atom at runtime, without the need for NuoDB Check. In the schema, any references to these atoms are then removed as well. This frees disk space and allows the database to operate more efficiently. Dropped items occur normally during the course of operations.

Validating and Reporting on Non-Dropped References

For database items that are not marked as dropped, NuoDB Check validates and reports on their correctness. It does this by loading each schema and traversing all objects referenced by it. Each object is checked for the following:

Implicit Whole Archive Validation

Implicit validation of the entire archive is done when all atoms are loaded by NuoDB Check. NuoDB Check then reports on those atoms that are incorrect. Validation consists of testing and reporting except in these cases:

If you are invoking nuochk to restore to a snapshot then the utility validates and cleans up the source archive before it creates the new archive.

See also: Validating Databases.

Syntax

nuochk [option [...] ] [archive_dir]

Arguments

Options

In addition to nuochk command line options, the nuochk utility also accepts nuodb command line options. The more useful ones are listed here.

Usage

Make sure no storage managers or snapshot storage managers are using the archive that is the source for the nuochk utility. To validate an archive, you may want to start by running the command by itself without options to see the output. Any issues found will be reported but no changes will be made to the archive. A success message is printed if no issues are detected.

If necessary, you can run the command again with the --repair option to repair issues. If an SM or SSM is using that archive and nuochk is run with --repair, nuochk execution immediately stops with an error saying that an SM or SSM is using the archive. Similarly, if nuochk is running on an archive (in any mode) then any attempt to start an SM or SSM on that archive fails. The SM or SSM does not start and reports that the archive is locked.

Caution: After running nuochk with --repair, it is advisable to run it a second time to ensure no new issues are found. If you do find more issues being repaired when running nuochk the second time, contact NuoDB support at support@nuodb.com.

The nuochk utility must be invoked by the operating system user account that owns the archive directory. If nuochk is invoked by another user, an error similar to the following error message is generated:

nuochk: Permissions error: archive owned by system account 'other_user'

Do not run nuochk if a running SM or SSM is using the archive you want to validate.

The nuochk utility uses the following exit codes:

Exit Code Description
0 No issues were detected with the archive and no changes needed to be made. The archive is valid and consistent.
1 Some changes needed to be made in the archive (for example, unused atoms were detected). Those changes were made and the result is a valid and consistent archive.
2

The utility failed to complete and validate the archive. For example, this could be because of an invalid command line argument or an unrecoverable archive format.

Examples

This command invokes nuochk on a valid SQL QuicStart database. See Running the SQL QuickStart.

$ nuochk /var/opt/nuodb/production-archives/test
Validating Schema SYSTEM
Validating Table HOCKEY.HOCKEY ID 59
Validating Table HOCKEY.PLAYERS ID 61
Validating Table HOCKEY.TEAMS ID 63
Validating Table HOCKEY.SCORING ID 65
Archive verification found no issues.

After artificially injecting some staleness in the SQL QuickStart database and running nuochk again, the following information is provided:

$ nuochk /var/opt/nuodb/production-archives/test
Validating Schema SYSTEM
Validating Table HOCKEY.HOCKEY ID 59
Validating Table HOCKEY.PLAYERS ID 61
Validating Table HOCKEY.TEAMS ID 63
Table ID 65 can be dropped
Catalog ID 66 can be dropped

Running nuochk again but with the --repair option has the following result:

$ nuochk --repair /var/opt/nuodb/production-archives/test
Validating Schema SYSTEM
Validating Table HOCKEY.HOCKEY ID 59
Validating Table HOCKEY.PLAYERS ID 61
Validating Table HOCKEY.TEAMS ID 63
Table ID 65 was dropped
Catalog ID 66 was dropped

$ nuochk /var/opt/nuodb/production-archives/test
Validating Schema SYSTEM
Validating Table HOCKEY.HOCKEY ID 59
Validating Table HOCKEY.PLAYERS ID 61
Validating Table HOCKEY.TEAMS ID 63
Archive verification found no issues.