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

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

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMAG and version 6.11
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_iwtm_add_parts, <SchemaOwner>iwtm_iwtm_delete_tablespaces, <SchemaOwner>iwtm_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);

Предупреждение
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 may be incomplete.

Daily TS are located in separate catalogues.

To get names of these catalogues, run the following command:

#su - postgres -c 'psql postgres iwtm'

postgres=# \db

               List of tablespaces

    Name    |  Owner   |        Location

tbs_name | tbs_id | tbs_type | part_date  | pg_tablespace_location | pg_size_pretty | status |        note       
----------+--------+----------+------------+------------------------+----------------+--------+--------------------

 iwtm       | iwtm     | /u01/iwtm_main/iwtm

 iwtm_421   | iwtm     | /u01/iwtm_data/iwtm_421

 iwtm_423   | iwtm     | /u01/iwtm_data/iwtm_423

 iwtm_424   | iwtm     | /u01/iwtm_data/iwtm_424

 iwtm_425   | iwtm     | /u01/iwtm_data/iwtm_425

 iwtm_426   | iwtm     | /u01/iwtm_data/iwtm_426

 iwtm_427   | iwtm     | /u01/iwtm_data/iwtm_427

 iwtm_428   | iwtm     | /u01/iwtm_data/iwtm_428

 iwtm_429   | iwtm     | /u01/iwtm_data/iwtm_429

 iwtm_430   | iwtm     | /u01/iwtm_data/iwtm_430

 iwtm_431   | iwtm     | /u01/iwtm_data/iwtm_431

 iwtm_432   | iwtm     | /u01/iwtm_data/iwtm_432

 iwtm_433   | iwtm     | /u01/iwtm_data/iwtm_433

 iwtm_434   | iwtm     | /u01/iwtm_data/iwtm_434

 iwtm_435   | iwtm     | /u01/iwtm_data/iwtm_435

 iwtm_436   | iwtm     | /u01/iwtm_data/iwtm_436

 iwtm_437   | iwtm     | /u01/iwtm_data/iwtm_437

 iwtm_438   | iwtm     | /u01/iwtm_data/iwtm_438

 iwtm_439   | iwtm     | /u01/iwtm_data/iwtm_439

 iwtm_440   | iwtm     | /u01/iwtm_data/iwtm_440

 iwtm_441   | iwtm     | /u01/iwtm_data/iwtm_441

 iwtm_442   | iwtm     | /u01/iwtm_data/iwtm_442

 iwtm_443   | iwtm     | /u01/iwtm_data/iwtm_443

 iwtm_444   | iwtm     | /u01/iwtm_data/iwtm_444

 iwtm_445   | iwtm     | /u01/iwtm_data/iwtm_445

 iwtm_446   | iwtm     | /u01/iwtm_data/iwtm_446

 pg_default | postgres |

 pg_global  | postgres |

(28 rows)

Where Name corresponds to values from sample select tbs_name, tbs_id from iwtm.tbs_list

 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!

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 when the <SchemaOwner>You should not disconnect daily tablespaces when the iwtm_iwtm_add_parts, <SchemaOwner> iwtm_iwtm_delete_tablespaces, <SchemaOwner> iwtm_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 carrier

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';