README.online_validation 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. Database validation allows to run low-level checks of consistency of on-disk
  2. structures and even to fix some minor corruptions. It is recommended procedure
  3. for any valuable database, i.e. DBA should validate database from time to time
  4. to make sure it is healthy. But validation process requires exclusive access to
  5. database, i.e. it forbids any kind of concurrent access to database while
  6. validation runs. It could be a big problem to stop user access, especially when
  7. database is large and validation takes notable amount of time.
  8. Online validation is a new feature which allows to perform some consistency
  9. checks without exclusive access to database. Online validation allows to:
  10. - validate some (or all) user tables in database
  11. - validate some (or all) indices
  12. - system tables are not validated
  13. - other ODS checks (such as Header\PIP\TIP\Generators pages) are not run by
  14. online validation
  15. - while table (and/or its index) is validated user attachments are allowed to
  16. read this table. Attempt to INSERT\UPDATE\DELETE will wait until validation
  17. finished or will return lock timeout error (depends on lock timeout of user
  18. transaction)
  19. - while table (and/or its index) is validated any kind of garbage collection at
  20. this table is disabled - background and cooperative garbage collection will
  21. just skip this table, sweep will be terminated with error.
  22. When online validation starts to check table it makes few actions to prevent
  23. concurrent modifications of table's data:
  24. - acquires relation lock in PR (protected read) mode
  25. - acquires (new) garbage collection lock in PW (protected write) mode.
  26. Both locks are acquired using user-specified lock timeout. If any lock request
  27. fails error is reported and table is skipped.
  28. Then table and its indices are validated in the same way as full validation does.
  29. Then locks are released and next table is validated.
  30. Online validation is implemented as Firebird service and accessible via Services
  31. API. Therefore gfix utility can't run online validation. fbsvcmgr utility has
  32. full support for new service, syntax is:
  33. fbsvcmgr [host:]service_mgr [user <...>] [password <...>]
  34. action_validate dbname <filename>
  35. [val_tab_incl <pattern>]
  36. [val_tab_excl <pattern>]
  37. [val_idx_incl <pattern>]
  38. [val_idx_excl <pattern>]
  39. [val_lock_timeout <number>]
  40. where
  41. val_tab_incl pattern for tables names to include in validation run
  42. val_tab_excl pattern for tables names to exclude from validation run
  43. val_idx_incl pattern for indices names to include in validation run,
  44. by default %, i.e. all indices
  45. val_idx_excl pattern for indices names to exclude from validation run
  46. val_lock_timeout lock timeout, used to acquire locks for table to validate,
  47. in seconds, default is 10 sec
  48. 0 is no-wait
  49. -1 is infinite wait
  50. Patterns are regular expressions, they are processed by the same rules as
  51. "SIMILAR TO" expressions. All patterns are case-sensitive (despite of database
  52. dialect!).
  53. If pattern for tables is omitted then all user tables will be validated.
  54. If pattern for indices is omitted then all indices of tables to validate will
  55. be validated.
  56. System tables are not validated.
  57. Examples:
  58. 1. fbsvcmgr.exe service_mgr user SYSDBA password masterkey
  59. action_validate dbname c:\db.fdb
  60. val_tab_incl A%
  61. val_idx_excl %
  62. val_lock_timeout 0
  63. this command will validate all tables in database "c:\db.fdb" with names
  64. starting with "A". Indices are not validated. Lock wait is not performed.
  65. 2. fbsvcmgr.exe service_mgr user SYSDBA password masterkey
  66. action_validate dbname c:\db.fdb
  67. val_tab_incl "TAB1|TAB2"
  68. this command will validate tables TAB1 and TAB2 and all their indices.
  69. Lock wait timeout is 10 sec.
  70. Note, to specify list of tables/indices it is necessary to:
  71. a) separate names by character "|"
  72. b) don't use spaces : TAB1 | TAB2 is wrong
  73. c) whole list should be enclosed in double quotes to not confuse command
  74. interpreter
  75. Vlad Khorsun, <hvlad at users sourceforge net>