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

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

Ключ

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

Архивирование ЕТП вручную производится в порядке, представленном ниже.

Выборка ежедневных табличных пространств и файлов данных

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

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

SELECT t.tbs_name, t.tbs_id, t.tbs_type, t.part_date, pg_tablespace_location(oid), pg_size_pretty(pg_tablespace_size(spcname)), t.status, t.note
FROM  pg_tablespace, iwtm.tbs_list t
WHERE t.tbs_name = pg_tablespace.spcname AND t.status IN (0, 3);

tbs_name | tbs_id | tbs_type | part_date  | pg_tablespace_location | pg_size_pretty | status |        note       
----------+--------+----------+------------+------------------------+----------------+--------+--------------------
 iwtm_2   |      2 |        1 | 2017-03-30 | /u02/pgdata/iwtm_2     | 692 kB         |      0 | Partitions created
 iwtm_3   |      3 |        2 | 2017-03-30 | /u02/pgdata/iwtm_3     | 692 kB         |      0 | Partitions created
 iwtm_4   |      4 |        0 | 2017-03-31 | /u02/pgdata/iwtm_4     | 25 MB          |      0 | Partitions created
 iwtm_5   |      5 |        1 | 2017-03-31 | /u02/pgdata/iwtm_5     | 692 kB         |      0 | Partitions created
 iwtm_6   |      6 |        2 | 2017-03-31 | /u02/pgdata/iwtm_6     | 692 kB         |      0 | Partitions created
 iwtm_7   |      7 |        0 | 2017-04-01 | /u02/pgdata/iwtm_7     | 692 kB         |      0 | Partitions created
 iwtm_8   |      8 |        1 | 2017-04-01 | /u02/pgdata/iwtm_8     | 692 kB         |      0 | Partitions created
 iwtm_9   |      9 |        2 | 2017-04-01 | /u02/pgdata/iwtm_9     | 692 kB         |      0 | Partitions created
Предупреждение
titleВажно!

Настоятельно рекомендуется для получения списка файлов использовать запрос, пример которого описывается далее в этом разделе. Это связано с тем, что список файлов данных, полученный другими способами, может оказаться неполным.

Отключение ежедневных табличных пространств от базы данных

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

Не отключайте ежедневные ТП во время работы заданий <SchemaOwner>_iwtm_add_parts, <SchemaOwner>_iwtm_delete_tablespaces, <SchemaOwner>_iwtm_archive_tablespaces так как это может привести к повреждению данных.

  1. От имени владельца схемы базы данных вызовите процедуру:

    select pkg_part_archive_tablespace(N);

    где N – это значение атрибута tbs_id целевого ТП из таблицы tbs_list.
    После выполнения этого сценария статус ежедневного ТП изменится на Отключено от базы данных.
  2. Повторите вызов процедуры для каждого ежедневного ТП, которое нужно отключить.

Перенос файлов данных

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

Для получения списка отключенных табличных пространств используйте команду:
select * from tbs_list where status = 10;
Файлы данных хранятся в каталоге:
select value from setting where setting = 'archive_path';

Sv translation
languageen

Manual archiving of You can archive daily tablespaces is performed in the following steps:manually. The order is described below.

Selecting daily tablespaces and data files

To You can get a list of disconnected tablespaces, you must run the following query tablespaces that can be disconnected by running queries to the database under the account on behalf of the database schema owner. The queries are built made according to the archiving policy of your company. For example, to select the daily TS storing the objects which were intercepted more than 100 days ago, run

Example. To select daily tablespaces with basic attributes (name, identifier, path, types, creation date, size), you can use the following query:

SELECT SELECT t.tbs_name, t.tbs_id, t.tbs_nametype, t.part_date, pg_tablespace_location(oid), pg_size_pretty(pg_tablespace_size(spcname)), t.status, t.note
FROM  pg_tablespace, iwtm.tbs_list t
WHERE tWHERE t.part_date < current_date - 100 + 23 / 24 tbs_name = pg_tablespace.spcname AND t.status IN (0, 3);

tbs_name | tbs_id | tbs_type | part_date  | pg_tablespace_location | pg_size_pretty | status |        note       
----------+--------+----------+------------+------------------------+----------------+--------+--------------------
 iwtm_2   |      2 |        1 | 2017-03-30 | /u02/pgdata/iwtm_2     | 692 kB         |      0 | Partitions created
 iwtm_3   |      3 |        2 | 2017-03-30 | /u02/pgdata/iwtm_3     | 692 kB         |      0 | Partitions created
 iwtm_4   |      4 |        0 | 2017-03-31 | /u02/pgdata/iwtm_4     | 25 MB          |      0 | Partitions created
 iwtm_5   |      5 |        1 | 2017-03-31 | /u02/pgdata/iwtm_5     | 692 kB         |      0 | Partitions created
 iwtm_6   |      6 |        2 | 2017-03-31 | /u02/pgdata/iwtm_6     | 692 kB         |      0 | Partitions created
 iwtm_7   |      7 |        0 | 2017-04-01 | /u02/pgdata/iwtm_7     | 692 kB         |      0 | Partitions created
 iwtm_8   |      8 |        1 | 2017-04-01 | /u02/pgdata/iwtm_8     | 692 kB         |      0 | Partitions created
 iwtm_9   |      9 |        2 | 2017-04-01 | /u02/pgdata/iwtm_9     | 692 kB         |      0 | Partitions created

 

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

It is strongly recommended to run the following sample query in this section in order to retrieve the list of files. This is due to the fact that the file list if generated by any other ways To get the list of files, we highly recommend using the sample query described in the article. If you use a different query, the list of files may be incomplete.


Disconnecting Daily Tablespaces from the Database

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

It is strongly recommended not to disable daily TS You should not disconnect daily tablespaces when the <SchemaOwner>_iwtm_add_parts, <SchemaOwner>_iwtm_delete_tablespaces,<SchemaOwner>_iwtm_archive_tablespaces jobs are running as it may cause the data losscorruption.

  1. Call the procedure on behalf of the owner of the database schema, call the procedure:
    select pkg_part_archive_tablespace(N);
    where N is a value of tbs_id attribute of the target TS required tablespace from the tbs_list table.
    After running this script status of daily TS , the daily tablespace status will change to Offline.
  2. Repeat the procedure call for each daily TS tablespace you want to disabledisconnect.

Moving Datafiles

Transfer the data files belonging to the disabled daily TS to the other data storage device

Data Files

Move catalogs with archived tablespaces which belong disconnected daily tablespaces to a different storage.

To get a the list of data files for all disconnected tablespaces, use the following scriptcommand:
select * from tbs_list where status = 10;
Data files are located in the directory:
select value from setting where setting = 'archive_path';