Batch files can be used to perform repetitive and time-consuming tasks.
Batch files can be scheduled to run at specific dates and times, see Scheduled Tasks for more.
For more information on Microsoft batch files see The Command Line in Windows.
The NewViews Database Utilities is a script that provides a set of operations that are performed on NewViews database files. The operations check integrity, repair corruption, reorganize data or perform other maintenance tasks.
Normally, Database Utilities provides an interactive window from which the operations are run. However these operations can also be run directly from the command line without bringing up the interactive window or confirm or notify windows. This enables you to run operations unattended and especially important, it lets you take advantage Windows ability to schedule tasks.
Also note that each database utilities operation appends a record to a log file so that you can find the results and determine whether or not the operation succeeded or why it failed. Although we will cover the basics of batch files here, see Database Utilities for more on the database utilities operations, log files, and running individual operations from a command line.
Note: If NewViews is not registered on the computer, then a prompt reminding the user that NewViews is not registered will appear. This prompt will prevent nv2 from running unattended from batch files.
c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/demobooks.nv2 .command check_block_readability
The above text must be entered as a single line.
.script system/database_utilities.qw_script
Runs the script c:/nv/nv2.exe/database_utilities.qw_script. Database utilities is in fact a NewViews script.
.file c:/nv/demobooks.nv2
Specifies which database file the operations are to be performed on.
.command check_block_readability
Identifies the database operation that is to be performed.
Note that multiple operations may be specified in a single batch file. For example, you may wish to run several checks on various application databases.
The check_all command runs all ten check commands.
c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_all
The check_block_readability, check_block_pointer_integrity, check_free_block_integrity and check_page_integrity are the four important checks that can be performed on an application database, and they are quick and can be run overnight even on large databases.
Lets assume that you have two application databases A and B, the batch file would have eight lines like this:
c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_block_readability c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_block_pointer_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_free_block_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_page_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/B.nv2 .command check_block_readability c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/B.nv2 .command check_block_pointer_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/B.nv2 .command check_free_block_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/B.nv2 .command check_page_integrity
Here we have a weekly batch file that has all checks currently available in the database utilities. These operations may not complete overnight if the database(s) is large. So schedule to run this batch file on Friday night.
c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_block_readability c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_block_pointer_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_free_block_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_page_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_index_record_integrity c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_account_history c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_dangling_index_records c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_object_paths c:\nv\nv2 .script system/database_utilities.qw_script .file c:/nv/A.nv2 .command check_dangling_object_references
We recommend that you schedule the daily batch file to run Monday to Thursday. The daily batch file should only include operations that can be completed overnight. Schedule the weekly batch file to run late Friday to provide enough time to complete all operations.
The list of operations: check_all check_block_readability check_block_pointer_integrity check_free_block_integrity check_page_integrity check_account_history check_object_paths check_dangling_object_references check_external_references check_dangling_index_records check_index_record_integrity repair_free_blocks repair_dangling_line_numbers repair_dangling_indirects repair_dangling_double_indirects repair_object_paths repair_external_pointers repair_dangling_index_records repair_transaction_amounts repair_interactive_indexes repair_floating_addresses repair_sessions repair_dangling_window_objects reorganize_database reorganize_database_precheck reorganize_free_blocks reorganize_audit_records_hibernate_all reorganize_account_history