If you do not need to further store the data, you can use the procedure for deleting daily TS (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.
IWTM_DELETE_TABLESPACES job cannot operate tablespaces which were disconnected/connected manually.
|
As a result, this procedure will remove all the daily tablespaces (including information about the archived daily tablespaces), 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 tablespace cannot be restored (because the information in it was removed from the database), then you can delete data files of this tablespace from the archive. |
| Предупреждение |
|---|
| While deleting tablespaces, access to the corresponding tables is closed. For this reason, log files of the iw_deliver, iw_x2db, iw_updater 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 daily. Otherwise, the amount of deleted data increases, which 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 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 scheme owner). Specify period to store information of archived tablespaces: begin
| begin
sp_setting_set('violation_delete_enabled', 1); |
sp_setting_set('violation_delete_period', D); |
begin spbeginsp_setting_set('noviolation_delete_enabled', 1); |
sp_setting_set('noviolation_delete_period', D); |
sp_setting_set('other_delete_enabled', 1); |
sp_setting_set('other_delete_period', D); |
where: 1 indicates that automatical automatic 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. This number should be larger than the set number of days before archiving the daily tablespace (see Автоматическое архивирование ежедневных табличных пространств 1). 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 up disk space, you can: | Информация |
|---|
| To delete all archived daily tablespaces older than 150 days: - Open for editing the
/etc/cron.d/iwtm_cleanup file or another file with tasks in the directory. 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.
Apply new settings of the cron service: | Блок кода |
|---|
| systemctl reload crond |
|
Scheduled deletion of daily tablespaces By default, the automatic deletion of daily TS is disabled. To enable the deletion of daily TS according to schedule (every day at 00 h 30 min 00 s00 h 30 min 00 s), run the following script under the account of the database schema scheme owner:
dbms_scheduler.enable('IWTM_DELETE_TABLESPACES '); |
To disable procedure autorun, run the following script:
dbms_scheduler.disable('IWTM_DELETE_TABLESPACES'); |
Deleting daily tablespaces manually If you need an immediate launch of procedure for deletion of daily TS (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), run the following script under the account of the database schema scheme owner:
dbms_scheduler.run_job('IWTM_DELETE_TABLESPACES'); |
Deleting daily tablespaces with a script If you want to configure automatic deletion of daily tablespaces, use the /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh script. You can use the following commands: | |
|---|
Set up deletion period | /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh set violation|noviolation|other <days> [-v] | Enable automatic deletion | /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh enable violation|noviolation|other [-v] | Disable automatic deletion | /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh disable violation|noviolation|other [-v] | | View the state of settings | /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh show [-v] |
| Информация |
|---|
| To delete all objects with "No violation" status, which are older than 15 days, run the following commands: | Блок кода |
|---|
| /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh set noviolation 15 [-v] |
/opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh enable noviolation [-v] |
|
|