If you do not need to further store the data, you can use the procedure for deleting daily TS tablespaces (<SchemaOwner>iwtm_iwtm_delete_tablespaces). The procedure automatically deletes all the data in a tablespace, segments, and also the tablespace and data files. | Предупреждение |
|---|
| - Deleting tablespaces cannot be undone. If you complete the operation, you will not be able to restore the deleted data.
- After removal of the tablespaces disconnected from the database (with Offline status), the data files will be kept. To free space on your hard drive, delete these files manually.
- <SchemaOwner>iwtm_iwtm_delete_tablespaces job cannot operate tablespaces which were disconnected/connected manually.
|
As a result, this procedure will remove all the daily TS tablespaces (and including information about the archived daily TStablespaces), which satisfy the following condition: The date of creating a tablespace is less or equal to the difference between the current date and the specified time interval for deleting the tablespace. | Информация |
|---|
| If the archived daily TS tablespace cannot be restored (because the information in it was removed from the database), then you can delete the data files of the daily TS this tablespace from the archive. | the tablespaces are being deleted, deleting tablespaces, access to the corresponding tables is closed. For this reason, log files of the iw_ | deliverd iwdbloader iw daemons are automatically stopped. When the deletion procedure is completed, the processes will be automatically restarted. It is recommended to run the processes may contain database access errors. Once tablespaces are deleted, these processes automatically restore access to the database. |
We recommend running a job to delete data on a daily basis. Otherwise, the amount of deleted data increases, which in turn increases the time for running the procedure and consequently increases the idle time of the Traffic Monitor Server. | Предупреждение |
|---|
| If months or years are used as a time interval, then we recommend you to apply the maximal interval value in the counting: 31 days for a month and 366 days for a year. For example, to delete daily TS older than 4 years, specify 366*4=1464 days interval in the <SchemaOwner>iwtm _iwtm_delete_tablespaces job. |
Setting the interval of daily TS deletion To perform TS deletion automatically (by default the function is disabled) you can use the following scripts (run under the account of the database schema owner). Specify period to store information of archived tablespaces: For daily TS storing objects with Violation status:
begin; select sp_setting_set('violation_delete_enabled', '1');
select sp_setting_set('violation_delete_period', 'D');
commit;
where: 1 indicates that authomatical deletion is enabled (to disable specify 0 instead)D is a number of days at the end of which the daily TS will be deleted by the System.For daily TS storing objects with No Violation status:
begin; select sp_setting_set('noviolation_delete_enabled', '1');
select sp_setting_set('noviolation_delete_period', 'D');
commit;
where: 1 indicates that automatical deletion is enabled (to disable specify 0 instead)D is a number of days at the end of which the daily TS will be deleted by the System.For daily TS storing screenshots:
begin; select sp_setting_set('other_delete_enabled', '1');
select sp_setting_set('other_delete_period', 'D');
commit;
where: 1 indicates that automatical deletion is enabled (to disable it, specify 0 instead); D is a number of days at the end of after which the daily TS will be deleted by the System. This number should be larger than the set number of days before archiving the daily tablespace (see "Автоматическое архивирование ежедневных табличных пространств"). After removal of the tablespaces disconnected from the database (with Offline status), they become unavailable in the System. Deleting archived tablespaces When deleting archived daily tablespaces from the database, datafiles remain in the System (by default, they are stored in the /u02/arch directory. To free space on your hard drive, you can either: | Информация |
|---|
| To delete all archived daily tablespaces that are older than 150 days: - Open the
/etc/cron.d/iwtm_error_queue file for editing. - Add lines:
35 3 * * * root find /u02/arch/ -type f -mtime +150 -delete > /dev/null 2>&1 &
40 3 * * * root find /u02/arch/ -type d -ctime +10 -empty -delete > /dev/null 2>&1 & - Save changes.
| Manual run- Apply new settings of the
cron service: service crond reload
|
Deleting daily tablespaces manually If you need an immediate launch of procedure for deletion of daily TS to delete daily tablespaces immediately (e.g., due to file system space shortage the interval of deletion was changed, but the next launch of the job will not happen soon), then run the following script on behalf of the database scheme owner: select pkg_part_delete_tablespaces();
Procedure implementation using Deleting daily tablespaces with a script If you require setting up an want to configure automatic deletion of daily TStablespaces, use the /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh. script is to be used. The following commands are to be usedsh script. You can use the following commands: | Purpose | Command |
|---|
Set up deletion period | /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh set violation|noviolation|other <days> [-v] | Enable automatic deletion | /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh enable violation|noviolation|other [-v] | Disable automatic deletion | /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh disable violation|noviolation|other [-v] | | Go through View the state of settings | /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh show [-v] |
.Objective: the with with "No violation" status, which are older than 15 days | .Solution: Run the command: , run the following commands: /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh set noviolation 15 [-v]
| Run the command: /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-postgres.sh enable noviolation [-v]
|
|