powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / PostgreSQL [игнор отключен] [закрыт для гостей] / Восстоновление БД из дампа
5 сообщений из 5, страница 1 из 1
Восстоновление БД из дампа
    #35213577
akrischenko
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Есть домп с базы сделанный pg_dum из под Линукса. Нужно его вставить в ПГ под Виндовс. Ещё один нюас, пользователей и их ролей нет, так что сделать как того требует документация
"Before restoring a SQL dump, all the users who own objects or were granted permissions on objects in the dumped database must already exist. If they do not, then the restore will fail to recreate the objects with the original ownership and/or permissions."
не получится. Соответственно (может и не по этому), при psql dbname < infile вылазит куча ошибок и ничего не восстанавливается. Что можно сделать?
...
Рейтинг: 0 / 0
Восстоновление БД из дампа
    #35213850
Andrey Daeron
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
akrischenkoЕсть домп с базы сделанный pg_dum из под Линукса. Нужно его вставить в ПГ под Виндовс. Ещё один нюас, пользователей и их ролей нет, так что сделать как того требует документация
"Before restoring a SQL dump, all the users who own objects or were granted permissions on objects in the dumped database must already exist. If they do not, then the restore will fail to recreate the objects with the original ownership and/or permissions."
не получится. Соответственно (может и не по этому), при psql dbname < infile вылазит куча ошибок и ничего не восстанавливается. Что можно сделать?
1. Есть дамполл. Который можно сделать под линуксом. Думаю, это то, что Вам нужно.
2. Если ашипка не сильно страшная, то этих пользователей можно и руками создать.

С другой стороны - может у Вас какая-то другая задача? Например восстановить дамп без ошибок? А будет или не будет работать ПО на этой БД Вас не интересует?
...
Рейтинг: 0 / 0
Восстоновление БД из дампа
    #35213865
Фотография ss25
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Попробуйте вот это:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
D:\dev\pgsql\bin>pg_restore.exe --help
pg_restore restores a PostgreSQL database from an archive created by pg_dump.

Usage:
  pg_restore [OPTION]... [FILE]

General options:
  -d, --dbname=NAME        connect to database name
  -f, --file=FILENAME      output file name
  -F, --format=c|t         specify backup file format
  -i, --ignore-version     proceed even when server version mismatches
  -l, --list               print summarized TOC of the archive
  -v, --verbose            verbose mode
  --help                   show this help, then exit
  --version                output version information, then exit

Options controlling the restore:
  -a, --data-only          restore only the data, no schema
  -c, --clean              clean (drop) schema prior to create
  -C, --create             create the target database
  -I, --index=NAME         restore named index
  -L, --use-list=FILENAME  use specified table of contents for ordering
                           output from this file
  -n, --schema=NAME        restore only objects in this schema
   -O, --no-owner           skip restoration of object ownership 
  -P, --function=NAME(args)
                           restore named function
  -s, --schema-only        restore only the schema, no data
  -S, --superuser=NAME     specify the superuser user name to use for
                           disabling triggers
  -t, --table=NAME         restore named table
  -T, --trigger=NAME       restore named trigger
   -x, --no-privileges      skip restoration of access privileges (grant/revoke) 
  --disable-triggers       disable triggers during data-only restore
  --use-set-session-authorization
                           use SESSION AUTHORIZATION commands instead of
                           OWNER TO commands
  --no-data-for-failed-tables
                           do not restore data of tables that could not be
                           created
  -1, --single-transaction
                           restore as a single transaction

Connection options:
  -h, --host=HOSTNAME      database server host or socket directory
  -p, --port=PORT          database server port number
  -U, --username=NAME      connect as specified database user
  -W, --password           force password prompt (should happen automatically)
  -e, --exit-on-error      exit on error, default is to continue

If no input file name is supplied, then standard input is used.

Report bugs to <pgsql-bugs@postgresql.org>;.
...
Рейтинг: 0 / 0
Восстоновление БД из дампа
    #35216171
akrischenko
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Мой дамп это plain text, а как говорит дока "pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats."
Вот что выдаёт:
C:\Program Files\PostgreSQL\8.3\bin>pg_restore.exe -C -O -x dump.sql
pg_restore: [archiver] input file does not appear to be a valid archive
Мне нужны только таблицы, впринципе можно даже без полей. Всё это нужно для того, чтобы понять как организована уже существующая база, и для построения новой инфологической а потом и даталогической модели.
Я так понимаю что быстрее всего будет пробежаться вручную, база всего 4 мб :)
...
Рейтинг: 0 / 0
Восстоновление БД из дампа
    #35222250
ZemA
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
akrischenkoМой дамп это plain text, а как говорит дока "pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats."
Вот что выдаёт:
C:\Program Files\PostgreSQL\8.3\bin>pg_restore.exe -C -O -x dump.sql
pg_restore: [archiver] input file does not appear to be a valid archive
Мне нужны только таблицы, впринципе можно даже без полей. Всё это нужно для того, чтобы понять как организована уже существующая база, и для построения новой инфологической а потом и даталогической модели.
Я так понимаю что быстрее всего будет пробежаться вручную, база всего 4 мб :)
pg_dump.exe -s -O -x имя_базы > схема.sql
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / PostgreSQL [игнор отключен] [закрыт для гостей] / Восстоновление БД из дампа
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]