Open topic with navigation
NuoDB Check is a command line utility that can do the following:
nuochkutility can create an archive only when you are restoring to a snapshot.
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.
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 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.
option[...] ] [
Fully qualified path to the archive directory that will be checked for errors. It is not necessary to specify the
archive_dir option with the
If you are restoring to a snapshot then this option specifies the path of the archive directory that contains the snapshot you are restoring to. This archive directory can be the result of a hot copy on a snapshot storage manager or the result of a copy operation on a stopped snapshot storage manager.
In addition to
nuochk command line options, the
nuochk utility also accepts
nuodb command line options. The more useful ones are listed here.
Continues processing after encountering the first error.
Displays a list of options.
Required if you are restoring to a snapshot. Specification of this option instructs the
nuochk utility to read the journal from the directory specified for the
This is required if this option was specified when the storage manager was started. The same
journal_location must be used.
If you are restoring to a snapshot then this option specifies the path of the journal directory that was the result of the operation that provided the snapshot you are restoring to.
Limits the amount of memory that
nuochk will consume, specified as megabytes (m) or gigabytes (g). The default is 2 gigabytes.
nuochk utility will show only errors detected.
nuochk utility will repair issues in the archive. The default behavior is that the utility shows errors but does not modify the archive.
Required if you are restoring to a snapshot. The
nuochk utility performs clean up operations before it creates the new archive.
Required if you are restoring to a snapshot. Specify the file system directory that will contain the new archive. This directory must not exist.
Displays a time stamp along with a snapshot id and album number. This matches the output seen when querying system.snapshots.
Required if you are restoring to a snapshot. Specify the ID of the snapshot to restore to. You must have obtained this snapshot by executing the
nuodbmgr hotcopy command on a database's snapshot storage manager or by copying current state from a snapshot storage manager.
Required if you are restoring to a snapshot. Specify the directory that contains the snapshot you want to restore to.
Enables you to take a table name (and/or ID) and perform checks only on that table. Running this command followed by SCHEMA.TABLE will cause nuochk to run validateDB only on that table in the given schema
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
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.
--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 email@example.com.
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.
nuochk utility uses the following exit codes:
|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.|
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.
This command invokes nuochk on a valid SQL QuicStart database. See Running the SQL QuickStart.
nuochk /var/opt/nuodb/production-archives/testValidating 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/testValidating 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
nuochk again but with the
--repair option has the following result:
nuochk --repair /var/opt/nuodb/production-archives/testValidating 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/testValidating 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.