Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMAG and version 7.1
Sv translation
languageru

Если дальнейшее хранение данных не требуется, то Вы можете воспользоваться процедурой удаления ежедневных ТП (IWTM_DELETE_TABLESPACES). Данная процедура позволяет автоматически удалить все данные, хранящиеся в табличном пространстве, сегменты, табличное пространство и файлы данных.

Предупреждение
titleВажно!
  1. Удаление табличных пространств – необратимая операция. После выполнения этой операции Вы не сможете восстановить удаленные данные.
  2. После удаления табличных пространств, которые отключены от базы данных (имеют статус Offline), остаются файлы данных. Чтобы освободить пространство на жестком диске, удалите эти файлы вручную.
  3. Процедура IWTM_DELETE_TABLESPACES не работает с теми табличными пространствами, которые были отключены/подключены вручную.

В результате выполнения этой процедуры удаляются все ежедневные ТП (и в т.ч. информация о заархивированных ежедневных ТП), которые удовлетворяют следующему условию:

Дата создания табличного пространства меньше или равна разнице между текущей датой и заданным интервалом времени для удаления табличного пространства.

Информация
titleПримечание:

Если заархивированное архивированное ежедневное ТП не подлежит восстановлению (т.к. информация о нем была удалена из базы данных), то Вы вы можете удалить файлы данных этого ежедневного ТП этого ТП из архива.

На

Предупреждение
titleВажно!

Во время удаления табличных пространств

работа процессов

доступ к соответствующим таблицам закрыт. По этой причине в лог-файлах процессов iw_

deliverd

deliver, iw_x2db, iw_updater

будет автоматически приостановлена. По завершении процедуры удаления, выполняется автоматический перезапуск процессов.

 могут отображаться ошибки доступа к базе данных. После удаления ТП эти процессы восстанавливают доступ к БД автоматически.

Рекомендуется запускать задание на удаление данных ежедневно. В противном случае количество удаляемых данных увеличится, что приведет к большим временным затратам на выполнение данной процедуры и, как следствие, к увеличению времени простоя сервера Traffic Monitor.

Предупреждение
titleВажно!

Если в качестве интервала времени используются месяцы или годы, то рекомендуется в расчете использовать максимальное значение интервала. Для месяца – 31 день. Для года – 366 дней. Например, чтобы удалять ежедневные ТП старше 4-х четырех лет, в задании IWTM_DELETE_TABLESPACES укажите интервал 366*4=1464 дня.

Определение интервала времени для удаления отключения ежедневных ТП
Для автоматического удаления отключения табличных пространств (по умолчанию функция выключена) вы можете использовать следующие различные сценарии (запускаются от имени владельца схемы данных). Установите срок хранения информации об архивных ТП:

  • Для ЕТП, хранящего объекты со статусом Нарушение:

begin
sp_setting_set('violation_delete_enabled', 1);
sp_setting_set('violation_delete_period', D);
commit;
end;
/ где:
1 – показатель того, что автоматическое удаление включено (чтобы выключить, вместо 1 используйте значение 0);
D – количество дней, по истечении которого ежедневное табличное пространство будет удаляться Системой.

  • Для ЕТП, хранящего объекты со статусом Нет нарушений:

begin
sp_setting_set('noviolation_delete_enabled', 1);
sp_setting_set('noviolation_delete_period', D);
commit;
end;
/
где: 1 – показатель того, что автоматическое удаление включено (чтобы выключить, вместо 1 используйте значение 0);
D – количество дней, по истечении которого ежедневное табличное пространство будет удаляться Системой.

  • Для ЕТП, хранящего снимки экрана (скриншоты):

begin
sp_setting_set('other_delete_enabled', 1);
sp_setting_set('other_delete_period', D);
commit;
end;
/
где:
1 – показатель того, что автоматическое удаление включено отключение активировано (чтобы выключить, вместо 1 используйте значение 0);
D – количество дней, по истечении которого прошествии которых ежедневное табличное пространство будет удаляться Системой.

Включение запуска процедуры по

отключено от БД. Это число должно быть больше устанавливаемого количества дней до архивирования ежедневного ТП (см. "Автоматическое архивирование ежедневных табличных пространств 1").

После отключения архивных ТП от БД (статус Offline) они становятся недоступны Системе. 

Удаление архивированных ТП

При отключении от БД архивированных ежедневных ТП в Системе остаются файлы данных (по умолчанию в директории /u02/arch). Чтобы освободить пространство на жестком диске, можно (на выбор):

  • удалить их вручную;

  • добавить новые задачи, запускаемые по расписанию в файле /etc/cron.d/iwtm_error_queue . 
Информация
titleПример

Чтобы удалить все архивированные ежедневные ТП старше 150 суток:

  1. Откройте на редактирование файл  /etc/cron.d/iwtm_error_queue
  2. Добавьте строки:
    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 &
  3. Сохраните изменения.
  4. Примените новые настройки сервиса cron: service crond reload

Удаление ежедневных ТП по расписанию
По умолчанию автоматическое удаление ежедневных ТП отключено. Чтобы включить удаление всех ежедневных ТП согласно расписанию (ежедневно, в 01 ч. 00 мин. 00 с.), от имени владельца схемы базы данных выполните следующий сценарий:

BEGIN
dbms_scheduler.enable('IWTM_DELETE_TABLESPACES');
COMMIT;
END;
/

Чтобы отключить автоматическое выполнение процедуры по расписанию, выполните следующий сценарий:

BEGIN
dbms_scheduler.disable('IWTM_DELETE_TABLESPACES');
COMMIT;
END;
/

Ручной запуск процедурыУдаление ежедневных ТП вручную
Если вам требуется немедленный запуск процедуры удаления ежедневных ТП (например, из-за нехватки места в файловой системе был изменен интервал удаления, но следующий запуск задания произойдет нескоро), от имени владельца схемы базы данных выполните следующий сценарий:

BEGIN
dbms_scheduler.run_job('IWTM_DELETE_TABLESPACES');
END;
/

Выполнение процедуры с Удаление ежедневных ТП с помощью скрипта

Если вам требуется настроить автоматическое удаление ежедневных ТП, то имеет смысл использовать используйте скрипт /opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh. Возможны команды:

Цель
Команда

Задать период для удаления

/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh set violation|noviolation|other <days> [-v] 

Включить автоудаление

/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh enable violation|noviolation|other [-v]

Выключить автоудаление

/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh disable violation|noviolation|other [-v]
Просмотреть статус настроек
/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh show [-v]
Информация
titleПример
.
Задача:

Чтобы удалить все объекты со статусом "Нет нарушения", созданные в течение последних 15 суток

.Решение

, выполните команды:

Наберите команду: 

/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh set noviolation 15 [-v]

Наберите команду: 

/opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh enable noviolation [-v]

Sv translation
languageen

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.

Предупреждение
titleWarning!
  1. 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.
  2. 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.

Информация
titleNote:

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.

Предупреждение
titleWarning!

While

the

deleting tablespaces

are being deleted

, access to the corresponding tables is closed. For this reason, log files of the iw_

deliverd

deliver, iw_x2db, iw_updater

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.

Предупреждение
titleWarning!

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 owner). Specify period to store information of archived tablespaces:

  • For daily TS storing objects with Violation status:

begin

sp_setting_set('violation_delete_enabled', 1);

sp_setting_set('violation_delete_period', D);

  commit;

end;
/ 

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

    sp_setting_set('noviolation_delete_enabled', 1);

        sp_setting_set('noviolation_delete_period', D);

  commit;

end;
/ 

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

 

sp_setting_set('other_delete_enabled', 1);

 

sp_setting_set('other_delete_period', D);

  commit;

end;
/ 

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.

Enabling procedure autorun according to schedule

By default,

 This number should be larger than the set number of days before archiving the daily tablespace (see "Automatic Archiving of Daily Tablespaces").

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:

  • delete tablespaces manually;

  • add new tasks to be started according to the schedule from the file /etc/cron.d/iwtm_error_queue. 
Информация
titleExample:

To delete all archived daily tablespaces that are older than 150 days:

  1. Open the  /etc/cron.d/iwtm_error_queue file for editing.
  2. 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 &
  3. Save changes.
  4. Apply new settings of the cron service: service crond reload

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 s), run the following script under the account of the database schema owner:

BEGIN

dbms_scheduler.enable('IWTM_DELETE_TABLESPACES ');

COMMIT;

END;

/

To disable procedure autorun, run the following script:

BEGIN

dbms_scheduler.disable('IWTM_DELETE_TABLESPACES');

COMMIT;

END;

/

Manual runDeleting 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 owner:

BEGIN

dbms_scheduler.run_job('IWTM_DELETE_TABLESPACES');

END;

/

Procedure implementation using Deleting daily tablespaces with a script

If you require setting up an want to configure automatic deletion of  daily TS, daily tablespaces, use the /opt/iw/tm5/bin/dbtools/dbconf-iwdrop-oracle.sh. script is to be used. To use it, run the following commandsh script. You can use the following commands:

Purpose
Command

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]
Go through View the state of settings
/opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh show [-v]
Информация
titleExample
.
:
Objective:

To delete all

the

objects with "No violation" status,

made in the last 15 days.

Solution: 

Run the command: 

which are older than 15 days, run the following commands:

/opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh set noviolation 15 [-v]

Run the command: 

/opt/iw/tm5/bin/dbconf-iwdrop-oracle.sh enable noviolation [-v]