The DeleteHistory.sql script deletes historical feature content that is no longer linked to existing products.
The script can be run by anyone with an HPD administration role. For large schemas, you may want to run this script during off-peak periods.
Before running the script, make a backup of the current database.
The following steps decrease the amount of data in the schema and allow more data to be deleted, making the script run faster:
• Delete any unwanted products
• Verify as much source data as possible, including deleted data
• Update products from source.
The Optimize Space script (optimize_space.sql) can be run before DeleteHistory.sql. This script removes non-functioning, shared spatial components such as leftover components from deleted products or redundant components that were not removed during an upgrade.
Make sure that no other user is using the schema while the Optimize Space script is run. |
1. In Command Prompt, navigate to C:\ProgramData\CARIS\HPD\<version>\Server\admintools.
2. Start an SQL session:sqlplus <hpd_administrator>/<password>@<database>
3. [Recommended] Run the Optimize Space script: @optimize_space.sql;
4. Run the Delete History script: @deleteHistory.sql.
The first prompt is displayed:
After how many hours would you like this script to stop?:
You can run the script for a set time. The default time is 10 hours, but you can enter fewer or more hours. When the end time is reached and more content can still be deleted, the following message is displayed: ...more records can be deleted. Run the script again to continue.
5. [Optional] Enter the end time.
6. Press <Enter>.
The second prompt is displayed:
Do you wish to delete all generalization relationships? (Yes/No/Old):
Generalization relationships relate features with different FOIDs.
• Yes: Delete all generalization relationships from source, isolated projects and products.
• Old: Delete only generalization relations between obsolete features. If one feature is obsolete and the other is not, then the relationship is not removed.
• No: Do not delete any generalization relations.
7. Enter Yes, No or Old, and press <Enter>.
The third prompt is displayed:
Do you wish to delete all obsolete features? (Yes/No):
Obsolete features are features that are no longer in source, isolated projects or products. Obsolete features that are referenced by generalization relationships or publications are not deleted.
8. Enter Yes or No, and press <Enter>.
The fourth prompt is displayed:
Delete feature history? (Yes/No):
Feature history is a record of modifications made to a feature. Any history referenced by products, publications, isolated projects or generalization relationships is retained.
9. Enter Yes or No, and press <Enter>.
The fifth prompt is displayed:
How many days of history do you want to keep?:
A value of 0 deletes as much history as possible.
10. Enter a value and press <Enter>.
Because the deleteHistory.sql script does not delete spatial components, some may now be unused.
You can run the optimize_sqace.sql script to reclaim space.
Make sure that no other users are using the schema while the Optimize Space script is run. |
11. [Recommended] Run the Optimize Space script: @optimize_space.sql;