Managing ObjectStore

osverifydb: Verifying Pointers and References in a Database

The osverifydb utility verifies all pointers and references in a database including internally managed ObjectStore segments.

Syntax

osverifydb [options] pathname
pathname 
Specifies a file or rawfs database whose pointers you want to verify.

Options
-all 
Verifies all segments including the internal segment 0.

-end_cluster cluster_number 
Specifies the ending cluster number for verification within a segment.

-end_offset integer 
Specifies the end offset (in bytes) within the cluster where verification is done. Defaults to 0, which verifies up to the end of the cluster.

-ignore_references 
Suppresses verification of references.

-illegal_pointer_action {null 
| ask} 
When used with the -all option and null argument, sets the illegal pointer to null. With the ask argument, uses the reference value that is supplied in response to the query.

-L server-log-name 
When specified, the named file is used for the Server log file. When unspecified, a temporary file is used.

This option is applicable only when you are running the utility as an ObjectStore/Single application. If the file already exists, it must be a properly formed Server log.

-nocoll 
Suppresses integrity checks that ensure that the ObjectStore collections in the database are valid. Object Design recommends that you use this option only on databases that do not contain collections.

-no_internal_segments
Skips verifying internally managed segments.

-o 
Displays each object in the database using the metaobject protocol.

-segment_n 
segment-number
Verifies only the segment specified by segment-number.

-start_cluster 
cluster_number
Specifies the starting cluster number for verification within a segment.

-start_offset integer 
Specifies the start offset (in bytes) within the cluster in which verification is done. Defaults to 0, which means to start verifying at the beginning of the cluster.

-tag 
Displays the tag value on an error.

-v 
Displays the value for each pointer.

-whohas hex_address 
Lists objects that point to the object identified by the pointer.

Description

Verification means

When osverifydb detects an invalid pointer, it indicates the location and the value of the pointer. Whenever possible, it displays a symbolic path to the bad pointer, starting with the outermost enclosing object.

The osverifydb utility runs integrity checks to ensure that the ObjectStore collections in the database are valid. You can suppress verification of collections by specifying the -nocoll option when you run osverifydb.

Verifying references

Reference verification requires that the reference be resolved to an address before it can be verified. This requires additional address space resources. In some cases, the osverifydb utility might run out of address space. Turning off reference verification allows verification of a database in such circumstances.

You would not normally include the -ignore_references option unless you had already tried to verify the database and verification failed because the utility ran out of address space.

How often

How often you should verify database pointers and references depends on how often your data changes. Verifying databases before backups is a good practice, but verification can be time consuming. You might want to verify databases every evening.

Schema protection

When developing an application, if you are running this utility on a protected schema database, ensure that the correct key is specified for the environment variables OS_SCHEMA_KEY_LOW and OS_SCHEMA_KEY_HIGH. If the correct key is not specified for these variables, the utility fails. ObjectStore signals

err_schema_key _CT_invalid_schema_key,
"<err-0025-0151> The schema is protected and the key provided did not 
match the one in the schema."

Example

osverifydb -all -illegal_pointer_action null vtest1.db
The null argument causes osverifydb to null all illegal pointers.

osverifydb -illegal_pointer_action ask vtest2.db
The ask argument permits selective repair; that is, it causes osverifydb to prompt for an alternative value for the illegal pointer in the format used by os_reference::load(). Following is sample output from osverifydb in such a circumstance:

The object at 0x6020000 (</daffy/home/daffy/daffy0/dbs/verifydb1 | 2 | 
0>)(type "c1"), contains a pointer at 0x6020000(c1.m1) with the illegal 
value 0x1. It points to nonpersistent storage.
Enter replacement pointer value in reference dump format (<database path | segment number | hex offset>:
You can then press Enter, in which case the illegal pointer is set to null, or you can enter a valid reference string such as /daffy/home/daffy/daffy0/dbs/verifydb1 | 2 | 64 identifying an object at offset 64 in segment 2, in the database verifydb1. The new pointer value, if valid, is used as the replacement value for the pointer in the database.

Caution

It is very important to use the null option with caution; using it indiscriminately can result in a corrupted database.

The following output is the result of running osverifydb on a database that contains an object of type c1, with the bad pointers identified by the error messages.

beethoven% osverifydb /camper/van
Verifying database beethoven::/camper/van 
Verifying segment 2 Size: 8192 bytes
Pointer to nonpersistent storage.
Pointer Location: 0x6010000. Contents: 0x1.
Lvalue expression for pointer: c1::m1
Pointer type mismatch; the declared type is incompatible with the actual 
type of the object
Pointer Location: 0x6010004. Contents: 0x601003c.
Declared type c2*. Actual type: c3*.
Lvalue expression for pointer: c1::m2
Pointer to deleted storage
Pointer Location: 0x6010008. Contents: 0x6010040.
Declared type c2*.
Lvalue expression for pointer: c1::m3
Pointer type mismatch; the declared type is incompatible with the actual 
type of the object
Pointer Location: 0x601000c. Contents: 0x6010028.
Declared type c2*. Actual type: c1*.
Lvalue expression for pointer: c1::m4
Lvalue expression for pointed to object: c1::ma[5]
Pointer type mismatch; the declared type is incompatible with the actual 
type of the object
Pointer Location: 0x6010010. Contents: 0x6010044.
Declared type c2*. Actual type: char*.
Lvalue expression for pointer: c1::m5
Lvalue expression for pointed to object: char[0]
Pointer to nonpersistent storage.
Pointer Location: 0x6010068. Contents: 0x1.
Lvalue expression for pointer: void*[5]
Verified 5 objects in segment
Verified 5 objects in database
beethoven%

API

Class: os_dbutil
Method: osverifydb



[previous] [next]

Copyright © 1999 Object Design, Inc. All rights reserved.

Updated: 03/11/99 11:19:07