[postgres@postgre1 ~]$ mkdir -p /u02/pgsql/data/dvdrental
CREATE USER dvdrental with NOSUPERUSER,LOGIN,ENCRYPTED PASSWORD 'your_password';
CREATE SCHEMA IF NOT EXISTS s_db_dvdrental AUTHORIZATION dvdrental ;
create tablespace tbs_dvdrental_1 location '/u02/pgsql/data/dvdrental';
dvdrental=# \db
Liste des tablespaces
Nom | Propriétaire | Emplacement
----------------+--------------+---------------------------
tbs_dvdrental_1 | postgres | /u02/pgsql/data/dvdrental
pg_default | postgres |
pg_global | postgres |
(3 lignes)
psql -U postgres
CREATE DATABASE db_dvdrental TABLESPACE 'tbs_dvdrental_1' ;
ALTER DATABASE db_dvdrental SET search_path TO s_db_dvdrental ;
create role r_db_dvdrental_owner;
grant ALL PRIVILEGES ON DATABASE db_dvdrental to r_db_dvdrental_owner;
grant dvdrental to r_db_dvdrental_owner;
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
pg_restore -U postgres -d dvdrental --verbose dvdrental.tar -j 2