====== Operations that Affect SYSTABLES and SYSVOLUMES ====== There are several operations that affect SYSTABLES and SYSVOLUMES: * When a volume is attached, its information is added to SYSVOLUMES; * When a table is attached, including if it is attached as part of attaching a volume, its information is added to SYSTABLES and the table name is added to the list in field 3 of the appropriate SYSVOLUMES record; * When a volume is detached, its information is removed from SYSVOLUMES, and all of its tables are detached; * When a table is detached, its information is removed from SYSTABLES and the table name is removed from the list in field 3 of the appropriate SYSVOLUMES record; * When a table is opened, the handle returned from its filing systems is stored in field 5 of SYSTABLES; note that subsequent opens of the table (after field 5 is filled in) do not actually do anything (i.e. they do not call the filing system). Note: If a SYSTABLES record refers to a volume (field 1) that does not exist or that does not refer back (field 3) to the table, or if a SYSVOLUMES record refers to a table (field 3) that does not exist or that does not refer back to the volume, then the database is //unsynchronized//. OpenInsight automatically corrects problems such as this one by checking the integrity of the SYSVOLUMES and SYSTABLES data when a .DBT file is loaded and before a .DBT file is saved. For more information, see [[problems_with_dbt_files|Problems with DBT Files]], and [[synchronizing_the_volume_and_table_information|Synchronizing the Volume and Table Information]]. Note: To manually synchronize the database with the .DBT file, perform a Database Save operation from the Database Manager. This will save any database changes to the application's .DBT file. From BASIC+, the [[define_database|Define Database]] subroutine synchronizes the database. OpenInsight automatically synchronizes the database when you log off. Note: After attaching the REVMEDIA table for a volume, compare fields 4 and 5 of the SYSTABLES record for REVMEDIA with fields 4 and 5 of the SYSVOLUMES record for the volume for which REVMEDIA was attached.