meta données pour cette page
Ceci est une ancienne révision du document !
Restore DB
- arborescence dédiée
[postgres@postgre1 ~]$ mkdir -p /u02/pgsql/data/dvdrental
- création user applicatif
CREATE USER dvdrental with NOSUPERUSER,LOGIN,ENCRYPTED PASSWORD 'your_password';
- création schéma dédié
CREATE SCHEMA IF NOT EXISTS s_dvdrental_db AUTHORIZATION dvdrental ;
- tablespace dedié
postgres=# \connect dvdrental dvdrental=# create tablespace dvdrental_data location '/u02/pgsql/data/dvdrental'; dvdrental=# \db Liste des tablespaces Nom | Propriétaire | Emplacement ----------------+--------------+--------------------------- dvdrental_data | postgres | /u02/pgsql/data/dvdrental pg_default | postgres | pg_global | postgres | (3 lignes)
- création DB
psql -U postgres
CREATE DATABASE dvdrental;
- Lister le contenu du backup
postgres@postgre1 Downloads]$ pg_restore -l dvdrental.tar ; ; Archive created at 2019-05-12 11:36:37 CEST ; dbname: dvdrental ; TOC Entries: 144 ; Compression: none ; Dump Version: 1.13-0 ; Format: TAR ; Integer: 4 bytes ; Offset: 8 bytes ; Dumped from database version: 11.3 ; Dumped by pg_dump version: 11.2 ; ; ; Selected TOC Entries: ; 632; 1247 16723 TYPE public mpaa_rating postgres 635; 1247 16734 DOMAIN public year postgres 231; 1255 16736 FUNCTION public _group_concat(text, text) postgres 232; 1255 16737 FUNCTION public film_in_stock(integer, integer) postgres 233; 1255 16738 FUNCTION public film_not_in_stock(integer, integer) postgres [...] 2910; 2606 17039 FK CONSTRAINT public store store_manager_staff_id_fkey postgres
- restore sur la BDD précédemment crée
pg_restore -U postgres -d dvdrental --verbose dvdrental.tar -j 2