meta données pour cette page
  •  

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
postgresql:restoredb [26/01/2026 15:30] mdlpostgresql:restoredb [06/02/2026 13:18] (Version actuelle) mdl
Ligne 6: Ligne 6:
 </code> </code>
  
-  * création DB+  * création user applicatif
 <code BASH> <code BASH>
-psql -U postgres +CREATE USER dvdrental with NOSUPERUSER,LOGIN,ENCRYPTED PASSWORD 'your_password';
-CREATE DATABASE dvdrental;+
 </code> </code>
 +
 +  * création schéma dédié
 +<code BASH>
 +CREATE SCHEMA IF NOT EXISTS s_db_dvdrental AUTHORIZATION dvdrental ;
 +</code>
 +
  
   * tablespace dedié   * tablespace dedié
 <code BASH> <code BASH>
-postgres=# \connect dvdrental +create tablespace tbs_dvdrental_1 location '/u02/pgsql/data/dvdrental';
-dvdrental=# create tablespace dvdrental_data location '/u02/pgsql/data/dvdrental';+
  
 dvdrental=# \db dvdrental=# \db
Ligne 21: Ligne 25:
       Nom       | Propriétaire |        Emplacement               Nom       | Propriétaire |        Emplacement        
 ----------------+--------------+--------------------------- ----------------+--------------+---------------------------
- dvdrental_data | postgres     | /u02/pgsql/data/dvdrental+tbs_dvdrental_1 | postgres     | /u02/pgsql/data/dvdrental
  pg_default     | postgres       pg_default     | postgres     
  pg_global      | postgres       pg_global      | postgres     
 (3 lignes) (3 lignes)
  
 +</code>
 +
 +  * création DB
 +<code BASH>
 +psql -U postgres
 +CREATE DATABASE db_dvdrental TABLESPACE 'tbs_dvdrental_1' ;
 +</code>
 +
 +  * assigner schema à la nouvelle BDD
 +<code BASH>
 +ALTER DATABASE db_dvdrental SET search_path TO s_db_dvdrental ;
 +</code>
 +
 +
 +  * création role dédié DB Owner 
 +<code BASH>
 +create role r_db_dvdrental_owner;
 +</code>
 +
 +  * on donne tous les privilèges au role sur la BDD
 +<code BASH>
 +grant ALL PRIVILEGES ON DATABASE db_dvdrental to r_db_dvdrental_owner;
 +</code>
 +
 +  * on ajoute le user applicatif à ce role
 +<code BASH>
 +grant dvdrental to r_db_dvdrental_owner;
 </code> </code>