SQL/MX 2.x Installation and Management Guide (H06.10+, J06.03+)

Performing Recovery Operations
HP NonStop SQL/MX Installation and Management Guide544536-007
12-9
Recovering Tables
recovery script for that table would be needed.) You can change the minimum age at
which the file is deleted by replacing the 7 in the example script with a value that is
appropriate for your environment.
find /usr/tandem/sqlmx/ddl -mtime +7 -print | grep "/ddl/" | sed
"s/./rm &/" sh
Recovering Table Privileges
NonStop SQL/MX does not save the DDL for GRANT and REVOKE statements, so if
you accidentally drop a table that includes security information created by these
statements, you must restore the table’s security attributes in the table’s metadata
before you can recover the table data, labels, and resource forks from a TMF online
dump. See Example: Recovering Table Privileges on page 12-11 for more information.
Table Recovery Procedures
To recover a dropped table, you must execute the statements or commands in the
exact order shown in its saved DDL. For example:
1. The CREATE TABLE statement
2. ALTER TABLE statements as specified to add columns originally added by ALTER
TABLE
3. CREATE INDEX statements as specified to enforce unique constraints or primary
key constraints
4. Any other CREATE INDEX statements
5. ALTER TABLE statements as specified to add constraints
6. CREATE TRIGGER statements as specified
7. If you executed CREATE TRIGGER statements in Step 6, you will also need to
execute ALTER TRIGGER statements on disabled triggers for the dropped table.
Enabled triggers do not generate ALTER TRIGGER statements in the dropped
table’s saved DDL. For more information, see Tables With Triggers on page 12-13.
8. If applicable, DELETE and INSERT statements to reapply previously granted or
revoked table privileges. For more information, see Example: Recovering Table
Privileges on page 12-11.
9. A RECOVER FILES command with the names of all partitions and resource forks
of the tables and indexes just re-created
The recovery process for tables can be much more complex than one involving only
views and indexes. For example, if TMF is not configured for file recovery, recovery
may not be possible. For this reason, it is vital that you heed the precautions listed