Tag Archives: PostgreSQL

How PostgreSQL Replay Uncommitted Data During Crash Recovery

How PostgreSQL Replay Uncommitted Data During Crash Recovery

  1. When PostgreSQL crashes, everything in memory is lost but the important files on disk survive — WAL files (transaction history), data files (actual tables), CLOG (who committed or not) and pg_control (database status file).
  2. When PostgreSQL restarts, the Postmaster (the main process) first reads pg_control file — if it sees the database was not shut down cleanly, it understands a crash happened and starts the Startup Process to fix the database.
  3. The Startup Process reads pg_control to find the last checkpoint position (think of it as the last known good save point) and goes to that exact position in the WAL files to start reading from there.
  4. The Startup Process reads WAL files one record at a time — for each record, it finds the related data page, loads it into memory (Shared Buffers), applies the change to that page in memory and marks it as dirty (modified but not yet written to disk).
  5. The Startup Process applies every single WAL record to memory pages — it does not care whether the transaction was committed or not — both committed and uncommitted changes are loaded into Shared Buffers because the WAL replay never checks CLOG at this stage.
  6. Before applying any change to a page, the Startup Process checks if that page was already updated before the crash (by checking pd_lsn on the page) — if the page is already up to date it simply skips that WAL record and moves to the next one — this makes replay safe to run multiple times.
  7. When the Startup Process sees a COMMIT or ABORT record in the WAL, it immediately updates the CLOG file — marking that transaction as COMMITTED or ABORTED so PostgreSQL knows the final outcome of that transaction.
  8. When the Startup Process reaches the end of WAL files (the crash point), any transaction that had no COMMIT or ABORT record is considered as never completed — the Startup Process explicitly marks all those transactions as ABORTED in CLOG right away before allowing any user to connect — this is why you always see ABORTED and never IN_PROGRESS after a crash recovery.
  9. Once WAL replay is done, a final checkpoint runs — BGWriter and Checkpointer take all the dirty pages sitting in Shared Buffers (including pages with uncommitted data) and write them permanently to the actual database files on disk — then pg_control is updated to say the database is healthy and users are allowed to connect.
  10. Even though uncommitted data physically exists in the database files on disk, no user will ever see it — because CLOG says those transactions are ABORTED, MVCC automatically hides those rows from every query — and later VACUUM comes along and physically cleans up those dead rows from the pages and frees up the space.
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

How ABORT/ROLLBACK Works in PostgreSQL

How ABORT Works in PostgreSQL

 

  • Signal: The database detects an error or receives a ROLLBACK command and marks the transaction as aborted.

  • WAL File Write: An ABORT record is written to the WAL buffer in RAM and flushed into the actual 16MB WAL files on disk to keep a complete history.

  • CLOG Status: The status of the Transaction ID (XID) is instantly switched to “Aborted” in the Commit Log bitmap.

  • MVCC Isolation: The modified data rows are left on the disk but immediately become invisible to all other users.

  • Cleanup: The background Autovacuum process later scans the database, clears out these dead rows, and reclaims the disk space.

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

WAL Commit Process

PostgreSQL WAL Commit Process

1. The Modification (In-Memory)

When a user executes a data-modifying query (like INSERT, UPDATE, or DELETE):

  • The change is made to the table or index data inside the Shared Buffers (RAM). The page in memory is now marked as “dirty.”

  • Simultaneously, a record of this exact change is constructed and written sequentially into the WAL Buffers (also in RAM).

2. The COMMIT Command Issued

When the client sends the COMMIT command, PostgreSQL must guarantee that this change will survive a sudden power outage or crash before it can tell the user “Success.”

3. Flushing to Disk (XLogFlush)

To ensure durability without the massive overhead of writing entire data pages to disk immediately, Postgres uses the Write-Ahead Logging protocol:

  • The internal function XLogFlush() is called.

  • It identifies the exact position (Log Sequence Number, or LSN) of the commit record in the WAL Buffer.

  • It issues a synchronous write to flush all WAL buffers up to that LSN out of RAM and into the current 16MB WAL segment file on permanent storage.

  • An fsync() system call is issued to ensure the OS cache actually commits the data to physical disk platters or flash memory.

4. Acknowledgment to the Client

Once the operating system confirms that the WAL record is safely written to the physical storage, the transaction status is updated to “committed” in the commit log (CLOG), and PostgreSQL sends a success acknowledgment back to the client application.

Crucial Architectural Concepts

  • Write-Ahead Rule: The core rule of WAL is that changes to data pages must not be written to permanent database files on disk until the log records describing those changes have been flushed to stable storage. If the server crashes, Postgres reads the WAL from the last checkpoint forward and reapplies the changes (“redoes” them).

  • Asynchronous Commit Alternative: If you set the configuration parameter synchronous_commit = off, Postgres will acknowledge the client’s COMMIT before the WAL buffer is flushed to disk (relying on the WAL Writer background process to flush it within roughly 3 times wal_writer_delay). This massively increases write throughput but introduces a risk of losing up to a split-second of recent transactions if the server suddenly loses power.

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

Schema Backup and Restore Using pg_dump in PostgreSQL

PostgreSQL Schema Level Backup & Restore

EnvironmentUAT (Source)SIT (Target)
Databasegebuagebta
Server/HostGEBUA / 192.168.2.23GEBTA / 192.168.2.21
Schema 1geb (tables: emp, dept,hr,pgbench_accounts,pgbench_branches,pgbench_history,pgbench_tellers)geb (to be populated)
Schema 2trd (table: orders)trd (optional)
Backup Location/pgBackup/gebua/backup/pgBackup/gebta/backup

Schema Backup Flags Reference

FlagDescriptionExample
-n schemaInclude specific schema onlypg_dump -n geb -d gebua
-n schema1 -n schema2Include multiple schemaspg_dump -n geb -n sales -d gebua
-N schemaExclude specific schemapg_dump -N pg_catalog -d gebua
-sStructure only (no data)pg_dump -n geb -s -d gebua
-aData only (no structure)pg_dump -n geb -a -d gebua
-FcCustom format (recommended)pg_dump -n geb -Fc -f backup.dmp
-vVerbose outputpg_dump -n geb -v -d gebua
-OSkip object ownershippg_dump -n geb -O -d gebua

Contents



Important: Do not use the -n option during restore unless it is absolutely necessary.

When the -n option is used, PostgreSQL restores only the specified schema. However, if that schema does not already exist in the target database, the restore will fail even if the schema is present in the backup dump file.

If you decide to use the -n option to restore a single schema from either:

  • a multi-schema backup dump, or
  • a full database backup dump,

make sure you create the target schema before starting the restore. Otherwise, the restore will fail because pg_restore -n does not create the schema automatically.


0. Sample Data on Source


SCHEMA 1: GEB

[postgres@pgdb02 backup]$ psql -d gebua -c "SELECT 'emp' AS table_name, COUNT(*) AS row_count FROM geb.emp UNION ALL SELECT 'dept', COUNT(*) FROM geb.dept UNION ALL SELECT 'pgbench_accounts', COUNT(*) FROM geb.pgbench_accounts UNION ALL SELECT 'pgbench_branches', COUNT(*) FROM geb.pgbench_branches UNION ALL SELECT 'pgbench_history', COUNT(*) FROM geb.pgbench_history UNION ALL SELECT 'pgbench_tellers', COUNT(*) FROM geb.pgbench_tellers ORDER BY table_name;"
    table_name    | row_count
------------------+-----------
 dept             |         5
 emp              |         3
 pgbench_accounts |  10000000
 pgbench_branches |       100
 pgbench_history  |         0
 pgbench_tellers  |      1000
(6 rows)

[postgres@pgdb02 backup]$

SCHEMA 2: TRD
[postgres@pgdb02 backup]$ psql -d gebua -c "SELECT COUNT(*) FROM TRD.ORDERS;"
  count
---------
 1000001
(1 row)

[postgres@pgdb02 backup]$

1. Single Schema Backup/Restore

BACKUP on UAT:

[postgres@pgdb02 ~]$ cd /pgBackup/gebua/backup
[postgres@pgdb02 backup]$

[postgres@pgdb02 backup]$ nohup pg_dump -d gebua -n geb -Fc -v -f 01_task_gebua_geb_backup_binary.dmp > 01_task_gebua_geb_backup_binary.log 2>&1 &
[1] 4312
[postgres@pgdb02 backup]$

[postgres@pgdb02 backup]$ cat 01_task_gebua_geb_backup_binary.log
nohup: ignoring input
pg_dump: last built-in OID is 16383
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined access methods
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading transforms
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension tables
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: flagging inherited columns in subtables
pg_dump: reading partitioning data
pg_dump: reading indexes
pg_dump: flagging indexes in partitioned tables
pg_dump: reading extended statistics
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading policies
pg_dump: reading row-level security policies
pg_dump: reading publications
pg_dump: reading publication membership of tables
pg_dump: reading publication membership of schemas
pg_dump: reading subscriptions
pg_dump: reading subscription membership of tables
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving "standard_conforming_strings = on"
pg_dump: saving "search_path = "
pg_dump: saving database definition
pg_dump: dumping contents of table "geb.dept"
pg_dump: dumping contents of table "geb.emp"
pg_dump: dumping contents of table "geb.pgbench_accounts"
pg_dump: dumping contents of table "geb.pgbench_branches"
pg_dump: dumping contents of table "geb.pgbench_history"
pg_dump: dumping contents of table "geb.pgbench_tellers"
[postgres@pgdb02 backup]$

TRANSFER to SIT:

[postgres@pgdb02 backup]$ scp 01_task_gebua_geb_backup_binary.dmp lxceftsgvdb01:/pgBackup/gebta/backup
01_task_gebua_geb_backup_binary.dmp 100% 54MB 62.4MB/s 00:00
[postgres@pgdb02 backup]$

RESTORE on SIT:

# Without Error

Note: Please don't use the '-n' option during restore. The restore will fail if the specified schema does not already exist in the target database, even if that schema is present in the backup dump file.

psql -d gebta -c "DROP SCHEMA geb CASCADE;"   
nohup pg_restore -d gebta -Fc -v 01_task_gebua_geb_backup_binary.dmp > 01_task_gebua_geb_backup_binary_restore.log 2>&1 &

[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -Fc -c -v 01_task_gebua_geb_backup_binary.dmp > 01_task_gebua_geb_backup_binary_restore.log 2>&1 &
[postgres@lxceftsgvdb01 backup]$ cat 01_task_gebua_geb_backup_binary_restore.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: dropping CONSTRAINT pgbench_tellers pgbench_tellers_pkey
pg_restore: dropping CONSTRAINT pgbench_branches pgbench_branches_pkey
pg_restore: dropping CONSTRAINT pgbench_accounts pgbench_accounts_pkey
pg_restore: dropping CONSTRAINT dept dept_pkey
pg_restore: dropping TABLE pgbench_tellers
pg_restore: dropping TABLE pgbench_history
pg_restore: dropping TABLE pgbench_branches
pg_restore: dropping TABLE pgbench_accounts
pg_restore: dropping TABLE emp
pg_restore: dropping TABLE dept
pg_restore: dropping SCHEMA geb
pg_restore: creating SCHEMA "geb"
pg_restore: creating TABLE "geb.dept"
pg_restore: creating TABLE "geb.emp"
pg_restore: creating TABLE "geb.pgbench_accounts"
pg_restore: creating TABLE "geb.pgbench_branches"
pg_restore: creating TABLE "geb.pgbench_history"
pg_restore: creating TABLE "geb.pgbench_tellers"
pg_restore: processing data for table "geb.dept"
pg_restore: processing data for table "geb.emp"
pg_restore: processing data for table "geb.pgbench_accounts"
pg_restore: processing data for table "geb.pgbench_branches"
pg_restore: processing data for table "geb.pgbench_history"
pg_restore: processing data for table "geb.pgbench_tellers"
pg_restore: creating CONSTRAINT "geb.dept dept_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_accounts pgbench_accounts_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_branches pgbench_branches_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_tellers pgbench_tellers_pkey"
[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "\dn;"
      List of schemas
  Name  |       Owner
--------+-------------------
 geb    | gebadm
 public | pg_database_owner
(2 rows)

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "SELECT 'emp' AS table_name, COUNT(*) AS row_count FROM geb.emp UNION ALL SELECT 'dept', COUNT(*) FROM geb.dept UNION ALL SELECT 'pgbench_accounts', COUNT(*) FROM geb.pgbench_accounts UNION ALL SELECT 'pgbench_branches', COUNT(*) FROM geb.pgbench_branches UNION ALL SELECT 'pgbench_history', COUNT(*) FROM geb.pgbench_history UNION ALL SELECT 'pgbench_tellers', COUNT(*) FROM geb.pgbench_tellers ORDER BY table_name;"
    table_name    | row_count
------------------+-----------
 dept             |         5
 emp              |         3
 pgbench_accounts |  10000000
 pgbench_branches |       100
 pgbench_history  |         0
 pgbench_tellers  |      1000
(6 rows)

[postgres@lxceftsgvdb01 backup]$

2. Single Schema Backup/Restore(STRUCTURE ONLY + DATA BACKUP)

BACKUP on UAT:(BOTH STRUCTURE + DATA)

# Backup Structure
[postgres@pgdb02 backup]$ nohup pg_dump -d gebua -n geb -Fc -s -v -f 02_task_gebua_geb_backup_structure.dmp > 02_task_gebua_geb_backup_structure.log 2>&1 &

[postgres@pgdb02 backup]$ cat 02_task_gebua_geb_backup_structure.log
nohup: ignoring input
pg_dump: last built-in OID is 16383
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined access methods
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading transforms
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension tables
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: flagging inherited columns in subtables
pg_dump: reading partitioning data
pg_dump: reading indexes
pg_dump: flagging indexes in partitioned tables
pg_dump: reading extended statistics
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading policies
pg_dump: reading row-level security policies
pg_dump: reading publications
pg_dump: reading publication membership of tables
pg_dump: reading publication membership of schemas
pg_dump: reading subscriptions
pg_dump: reading subscription membership of tables
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving "standard_conforming_strings = on"
pg_dump: saving "search_path = "
pg_dump: saving database definition
[postgres@pgdb02 backup]$

# Backup Data only 
[postgres@pgdb02 backup]$ nohup pg_dump -d gebua -n geb -Fc -a -v -f 03_task_gebua_geb_backup_data.dmp > 03_task_gebua_geb_backup_data.log 2>&1 &

[postgres@pgdb02 backup]$ cat 03_task_gebua_geb_backup_data.log
nohup: ignoring input
pg_dump: last built-in OID is 16383
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined access methods
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading transforms
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension tables
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: flagging inherited columns in subtables
pg_dump: reading partitioning data
pg_dump: reading indexes
pg_dump: flagging indexes in partitioned tables
pg_dump: reading extended statistics
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading policies
pg_dump: reading row-level security policies
pg_dump: reading publications
pg_dump: reading publication membership of tables
pg_dump: reading publication membership of schemas
pg_dump: reading subscriptions
pg_dump: reading subscription membership of tables
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving "standard_conforming_strings = on"
pg_dump: saving "search_path = "
pg_dump: saving database definition
pg_dump: dumping contents of table "geb.dept"
pg_dump: dumping contents of table "geb.emp"
pg_dump: dumping contents of table "geb.pgbench_accounts"
pg_dump: dumping contents of table "geb.pgbench_branches"
pg_dump: dumping contents of table "geb.pgbench_history"
pg_dump: dumping contents of table "geb.pgbench_tellers"
[postgres@pgdb02 backup]$

TRANSFER to SIT:(BOTH STRUCTURE + DATA)

scp /pgBackup/gebua/backup/02_task_gebua_geb_backup_structure.dmp postgres@192.168.2.21:/pgBackup/gebta/backup/
scp /pgBackup/gebua/backup/03_task_gebua_geb_backup_data.dmp postgres@192.168.2.21:/pgBackup/gebta/backup/

RESTORE on SIT: (BOTH STRUCTURE + DATA)

psql -d gebua -c "DROP SCHEMA geb CASCADE;"

# Restore Structure
[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -Fc -c -v 02_task_gebua_geb_backup_structure.dmp > 02_task_gebua_geb_backup_structure_restore.log 2>&1 &

[postgres@lxceftsgvdb01 backup]$ cat 02_task_gebua_geb_backup_structure_restore.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: dropping CONSTRAINT pgbench_tellers pgbench_tellers_pkey
pg_restore: dropping CONSTRAINT pgbench_branches pgbench_branches_pkey
pg_restore: dropping CONSTRAINT pgbench_accounts pgbench_accounts_pkey
pg_restore: dropping CONSTRAINT dept dept_pkey
pg_restore: dropping TABLE pgbench_tellers
pg_restore: dropping TABLE pgbench_history
pg_restore: dropping TABLE pgbench_branches
pg_restore: dropping TABLE pgbench_accounts
pg_restore: dropping TABLE emp
pg_restore: dropping TABLE dept
pg_restore: creating TABLE "geb.dept"
pg_restore: creating TABLE "geb.emp"
pg_restore: creating TABLE "geb.pgbench_accounts"
pg_restore: creating TABLE "geb.pgbench_branches"
pg_restore: creating TABLE "geb.pgbench_history"
pg_restore: creating TABLE "geb.pgbench_tellers"
pg_restore: creating CONSTRAINT "geb.dept dept_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_accounts pgbench_accounts_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_branches pgbench_branches_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_tellers pgbench_tellers_pkey"
[postgres@lxceftsgvdb01 backup]$
[postgres@lxceftsgvdb01 backup]$

# Restore Data
[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -Fc -a -v 03_task_gebua_geb_backup_data.dmp > 03_task_gebua_geb_backup_data_restore.log 2>&1 &

[postgres@lxceftsgvdb01 backup]$ cat 03_task_gebua_geb_backup_data_restore.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: processing data for table "geb.dept"
pg_restore: processing data for table "geb.emp"
pg_restore: processing data for table "geb.pgbench_accounts"
pg_restore: processing data for table "geb.pgbench_branches"
pg_restore: processing data for table "geb.pgbench_history"
pg_restore: processing data for table "geb.pgbench_tellers"
[postgres@lxceftsgvdb01 backup]$
[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "\dn;"
      List of schemas
  Name  |       Owner
--------+-------------------
 geb    | gebadm
 public | pg_database_owner
(2 rows)

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "SELECT 'emp' AS table_name, COUNT(*) AS row_count FROM geb.emp UNION ALL SELECT 'dept', COUNT(*) FROM geb.dept UNION ALL SELECT 'pgbench_accounts', COUNT(*) FROM geb.pgbench_accounts UNION ALL SELECT 'pgbench_branches', COUNT(*) FROM geb.pgbench_branches UNION ALL SELECT 'pgbench_history', COUNT(*) FROM geb.pgbench_history UNION ALL SELECT 'pgbench_tellers', COUNT(*) FROM geb.pgbench_tellers ORDER BY table_name;"
    table_name    | row_count
------------------+-----------
 dept             |         5
 emp              |         3
 pgbench_accounts |  10000000
 pgbench_branches |       100
 pgbench_history  |         0
 pgbench_tellers  |      1000
(6 rows)

[postgres@lxceftsgvdb01 backup]$

3. Multiple Schemas Backup/Restore

BACKUP on UAT:

[postgres@pgdb02 backup]$ nohup pg_dump -d gebua -n geb -n trd -Fc -v -f 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_geb_sales_backup_multi_schema.log 2>&1 &
[1] 4688
[postgres@pgdb02 backup]$

[postgres@pgdb02 backup]$ cat 04_task_gebua_geb_sales_backup_multi_schema.log
nohup: ignoring input
pg_dump: last built-in OID is 16383
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined access methods
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading transforms
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension tables
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: finding table default expressions
pg_dump: flagging inherited columns in subtables
pg_dump: reading partitioning data
pg_dump: reading indexes
pg_dump: flagging indexes in partitioned tables
pg_dump: reading extended statistics
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading policies
pg_dump: reading row-level security policies
pg_dump: reading publications
pg_dump: reading publication membership of tables
pg_dump: reading publication membership of schemas
pg_dump: reading subscriptions
pg_dump: reading subscription membership of tables
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving "standard_conforming_strings = on"
pg_dump: saving "search_path = "
pg_dump: saving database definition
pg_dump: dumping contents of table "geb.dept"
pg_dump: dumping contents of table "geb.emp"
pg_dump: dumping contents of table "geb.pgbench_accounts"
pg_dump: dumping contents of table "geb.pgbench_branches"
pg_dump: dumping contents of table "geb.pgbench_history"
pg_dump: dumping contents of table "geb.pgbench_tellers"
pg_dump: dumping contents of table "trd.orders"
[postgres@pgdb02 backup]$

TRANSFER to SIT:

[postgres@pgdb02 backup]$ scp /pgBackup/gebua/backup/04_task_gebua_geb_sales_backup_multi_schema.dmp postgres@192.168.2.21:/pgBackup/gebta/backup/
04_task_gebua_geb_sales_backup_multi_schema.dmp 100% 27MB 55.1MB/s 00:00
[postgres@pgdb02 backup]$

RESTORE on SIT:

# Without errors -- Manually 
psql -d gebua -c "DROP SCHEMA geb CASCADE; DROP SCHEMA sales CASCADE;"
nohup pg_restore -d gebta -Fc -v 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_geb_sales_backup_multi_schema_restore.log 2>&1 &

# Drop and recreate
[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -Fc -c -v 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_geb_sales_backup_multi_schema_restore.log 2>&1 &
[1] 4305
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ cat 04_task_gebua_geb_sales_backup_multi_schema_restore.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: dropping CONSTRAINT orders orders_pkey
pg_restore: dropping CONSTRAINT pgbench_tellers pgbench_tellers_pkey
pg_restore: dropping CONSTRAINT pgbench_branches pgbench_branches_pkey
pg_restore: dropping CONSTRAINT pgbench_accounts pgbench_accounts_pkey
pg_restore: dropping CONSTRAINT dept dept_pkey
pg_restore: dropping DEFAULT orders order_id
pg_restore: dropping SEQUENCE orders_order_id_seq
pg_restore: dropping TABLE orders
pg_restore: dropping TABLE pgbench_tellers
pg_restore: dropping TABLE pgbench_history
pg_restore: dropping TABLE pgbench_branches
pg_restore: dropping TABLE pgbench_accounts
pg_restore: dropping TABLE emp
pg_restore: dropping TABLE dept
pg_restore: dropping SCHEMA trd
pg_restore: dropping SCHEMA geb
pg_restore: creating SCHEMA "geb"
pg_restore: creating SCHEMA "trd"
pg_restore: creating TABLE "geb.dept"
pg_restore: creating TABLE "geb.emp"
pg_restore: creating TABLE "geb.pgbench_accounts"
pg_restore: creating TABLE "geb.pgbench_branches"
pg_restore: creating TABLE "geb.pgbench_history"
pg_restore: creating TABLE "geb.pgbench_tellers"
pg_restore: creating TABLE "trd.orders"
pg_restore: creating SEQUENCE "trd.orders_order_id_seq"
pg_restore: creating SEQUENCE OWNED BY "trd.orders_order_id_seq"
pg_restore: creating DEFAULT "trd.orders order_id"
pg_restore: processing data for table "geb.dept"
pg_restore: processing data for table "geb.emp"
pg_restore: processing data for table "geb.pgbench_accounts"
pg_restore: processing data for table "geb.pgbench_branches"
pg_restore: processing data for table "geb.pgbench_history"
pg_restore: processing data for table "geb.pgbench_tellers"
pg_restore: processing data for table "trd.orders"
pg_restore: executing SEQUENCE SET orders_order_id_seq
pg_restore: creating CONSTRAINT "geb.dept dept_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_accounts pgbench_accounts_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_branches pgbench_branches_pkey"
pg_restore: creating CONSTRAINT "geb.pgbench_tellers pgbench_tellers_pkey"
pg_restore: creating CONSTRAINT "trd.orders orders_pkey"
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "\dn;"
      List of schemas
  Name  |       Owner
--------+-------------------
 geb    | gebadm
 public | pg_database_owner
 trd    | trdadm
(3 rows)

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "SELECT 'emp' AS table_name, COUNT(*) AS row_count FROM geb.emp UNION ALL SELECT 'dept', COUNT(*) FROM geb.dept UNION ALL SELECT 'pgbench_accounts', COUNT(*) FROM geb.pgbench_accounts UNION ALL SELECT 'pgbench_branches', COUNT(*) FROM geb.pgbench_branches UNION ALL SELECT 'pgbench_history', COUNT(*) FROM geb.pgbench_history UNION ALL SELECT 'pgbench_tellers', COUNT(*) FROM geb.pgbench_tellers ORDER BY table_name;"
    table_name    | row_count
------------------+-----------
 dept             |         5
 emp              |         3
 pgbench_accounts |  10000000
 pgbench_branches |       100
 pgbench_history  |         0
 pgbench_tellers  |      1000
(6 rows)

[postgres@lxceftsgvdb01 backup]$
[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "SELECT COUNT(*) FROM TRD.ORDERS;"
  count
---------
 1000001
(1 row)

[postgres@lxceftsgvdb01 backup]$

4. Restore Single Schema from Multi-Schema Dump

[postgres@lxceftsgvdb01 ~]$ psql -d gebta
psql (17.10)
Type "help" for help.

gebta=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 geb    | gebadm
 public | pg_database_owner
 trd    | trdadm
(3 rows)

gebta=# drop schema geb cascade;
NOTICE:  drop cascades to 6 other objects
DETAIL:  drop cascades to table geb.dept
drop cascades to table geb.emp
drop cascades to table geb.pgbench_accounts
drop cascades to table geb.pgbench_branches
drop cascades to table geb.pgbench_history
drop cascades to table geb.pgbench_tellers
DROP SCHEMA
gebta=#
gebta=# drop schema trd cascade;
NOTICE:  drop cascades to table trd.orders
DROP SCHEMA
gebta=#
gebta=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 public | pg_database_owner
(1 row)

gebta=#


[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -n trd -Fc -v 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_sales_restore_single_from_multi.log 2>&1 &
[1] 3725
[postgres@lxceftsgvdb01 backup]$
[1]+ Exit 1 nohup pg_restore -d gebta -n trd -Fc -v 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_sales_restore_single_from_multi.log 2>&1
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ cat 04_task_gebua_sales_restore_single_from_multi.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: creating TABLE "trd.orders"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 222; 1259 41085 TABLE orders trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
LINE 1: CREATE TABLE trd.orders (
                     ^
Command was: CREATE TABLE trd.orders (
    order_id integer NOT NULL,
    product character varying(100),
    amount numeric(10,2)
);


pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: ALTER TABLE trd.orders OWNER TO trdadm;

pg_restore: creating SEQUENCE "trd.orders_order_id_seq"
pg_restore: from TOC entry 221; 1259 41084 SEQUENCE orders_order_id_seq trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: CREATE SEQUENCE trd.orders_order_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: ALTER SEQUENCE trd.orders_order_id_seq OWNER TO trdadm;

pg_restore: creating SEQUENCE OWNED BY "trd.orders_order_id_seq"
pg_restore: from TOC entry 4386; 0 0 SEQUENCE OWNED BY orders_order_id_seq trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: ALTER SEQUENCE trd.orders_order_id_seq OWNED BY trd.orders.order_id;


pg_restore: creating DEFAULT "trd.orders order_id"
pg_restore: from TOC entry 4216; 2604 41088 DEFAULT orders order_id trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: ALTER TABLE ONLY trd.orders ALTER COLUMN order_id SET DEFAULT nextval('trd.orders_order_id_seq'::regclass);


pg_restore: processing data for table "trd.orders"
pg_restore: from TOC entry 4375; 0 41085 TABLE DATA orders trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: COPY trd.orders (order_id, product, amount) FROM stdin;
pg_restore: executing SEQUENCE SET orders_order_id_seq
pg_restore: from TOC entry 4387; 0 0 SEQUENCE SET orders_order_id_seq trdadm
pg_restore: error: could not execute query: ERROR:  relation "trd.orders_order_id_seq" does not exist
LINE 1: SELECT pg_catalog.setval('trd.orders_order_id_seq', 1000001,...
                                 ^
Command was: SELECT pg_catalog.setval('trd.orders_order_id_seq', 1000001, true);


pg_restore: creating CONSTRAINT "trd.orders orders_pkey"
pg_restore: from TOC entry 4220; 2606 41090 CONSTRAINT orders orders_pkey trdadm
pg_restore: error: could not execute query: ERROR:  schema "trd" does not exist
Command was: ALTER TABLE ONLY trd.orders
    ADD CONSTRAINT orders_pkey PRIMARY KEY (order_id);


pg_restore: warning: errors ignored on restore: 9
[postgres@lxceftsgvdb01 backup]$



Issue : If the target schema does not already exist in your destination database, pg_restore will throw an error because it does not automatically create the schema container when filtering with the -n flag.

Solution: # CREATE SCHEMA FIRST THEN TRIGGER RESTORE

# CREATE SCHEMA 
gebta=# CREATE SCHEMA TRD;
CREATE SCHEMA
gebta=#

gebta=# ALTER SCHEMA TRD OWNER TO TRDADM; 
ALTER SCHEMA 
gebta=# 

# Restore singel schema 'trd' from multi schema dump file

[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -n trd -Fc -v 04_task_gebua_geb_sales_backup_multi_schema.dmp > 04_task_gebua_sales_restore_single_from_multi.log 2>&1 &
[1] 3752
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ cat 04_task_gebua_sales_restore_single_from_multi.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: creating TABLE "trd.orders"
pg_restore: creating SEQUENCE "trd.orders_order_id_seq"
pg_restore: creating SEQUENCE OWNED BY "trd.orders_order_id_seq"
pg_restore: creating DEFAULT "trd.orders order_id"
pg_restore: processing data for table "trd.orders"
pg_restore: executing SEQUENCE SET orders_order_id_seq
pg_restore: creating CONSTRAINT "trd.orders orders_pkey"
[postgres@lxceftsgvdb01 backup]$

Note: ALTER SCHEMA OWNER is optional. If the original schema owner does not exist on the target database, you can use the --no-owner option during restore to skip restoring object ownership. 

5. Restore Single Schema from Full Database Dump

BACKUP on UAT:

[postgres@pgdb02 backup]$ nohup pg_dump -d gebua -Fc -v -f 02_task_gebua_full_backup_binary.dmp > 02_task_gebua_full_backup_binary.log 2>&1 &
[1] 4737
[postgres@pgdb02 backup]$

[postgres@pgdb02 backup]$ cat 02_task_gebua_full_backup_binary.log
nohup: ignoring input
pg_dump: last built-in OID is 16383
pg_dump: reading extensions
pg_dump: identifying extension members
pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined access methods
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading transforms
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension tables
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: finding table default expressions
pg_dump: flagging inherited columns in subtables
pg_dump: reading partitioning data
pg_dump: reading indexes
pg_dump: flagging indexes in partitioned tables
pg_dump: reading extended statistics
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading policies
pg_dump: reading row-level security policies
pg_dump: reading publications
pg_dump: reading publication membership of tables
pg_dump: reading publication membership of schemas
pg_dump: reading subscriptions
pg_dump: reading subscription membership of tables
pg_dump: reading large objects
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving "standard_conforming_strings = on"
pg_dump: saving "search_path = "
pg_dump: saving database definition
pg_dump: dumping contents of table "geb.dept"
pg_dump: dumping contents of table "geb.emp"
pg_dump: dumping contents of table "geb.pgbench_accounts"
pg_dump: dumping contents of table "geb.pgbench_branches"
pg_dump: dumping contents of table "geb.pgbench_history"
pg_dump: dumping contents of table "geb.pgbench_tellers"
pg_dump: dumping contents of table "trd.orders"
[postgres@pgdb02 backup]$

TRANSFER to SIT:

scp /pgBackup/gebua/backup/02_task_gebua_full_backup_binary.dmp postgres@192.168.2.21:/pgBackup/gebta/backup/

RESTORE on SIT: 

If the target schema does not already exist in your destination database, pg_restore will throw an error because it does not automatically create the schema container when filtering with the -n flag.

# Cleanup

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "DROP SCHEMA trd CASCADE;"
NOTICE: drop cascades to table trd.orders
DROP SCHEMA
[postgres@lxceftsgvdb01 backup]$

# Restore
[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "CREATE SCHEMA trd;"
CREATE SCHEMA
[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "ALTER SCHEMA TRD OWNER TO TRDADM;"
ALTER SCHEMA
[postgres@lxceftsgvdb01 backup]$

# I will remove '-c' flag
[postgres@lxceftsgvdb01 backup]$ nohup pg_restore -d gebta -n trd -Fc -v 02_task_gebua_full_backup_binary.dmp > 02_task_gebua_full_backup_binary_restore.log 2>&1 &
[1] 3814
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ cat 02_task_gebua_full_backup_binary_restore.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: creating TABLE "trd.orders"
pg_restore: creating SEQUENCE "trd.orders_order_id_seq"
pg_restore: creating SEQUENCE OWNED BY "trd.orders_order_id_seq"
pg_restore: creating DEFAULT "trd.orders order_id"
pg_restore: processing data for table "trd.orders"
pg_restore: executing SEQUENCE SET orders_order_id_seq
pg_restore: creating CONSTRAINT "trd.orders orders_pkey"
[postgres@lxceftsgvdb01 backup]$

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "\dn;"
      List of schemas
  Name  |       Owner
--------+-------------------
 public | pg_database_owner
 trd    | trdadm
(2 rows)

[postgres@lxceftsgvdb01 backup]$ psql -d gebta -c "select count(*) from trd.orders;"
  count
---------
 1000001  <--------------
(1 row)

[postgres@lxceftsgvdb01 backup]$

6. List Dump Contents

#  List dumps
pg_restore -l 02_task_gebua_full_backup_binary.dmp

[postgres@lxceftsgvdb01 backup]$ pg_restore -l 02_task_gebua_full_backup_binary.dmp
;
; Archive created at 2026-07-15 20:46:43 +08
;     dbname: gebua
;     TOC Entries: 29
;     Compression: gzip
;     Dump Version: 1.16-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 17.10
;     Dumped by pg_dump version: 17.10
;
;
; Selected TOC Entries:
;
6; 2615 32843 SCHEMA - geb gebadm
7; 2615 41083 SCHEMA - trd trdadm
220; 1259 32849 TABLE geb dept gebadm
219; 1259 32844 TABLE geb emp gebadm
225; 1259 41097 TABLE geb pgbench_accounts gebadm
226; 1259 41100 TABLE geb pgbench_branches gebadm
223; 1259 41091 TABLE geb pgbench_history gebadm
224; 1259 41094 TABLE geb pgbench_tellers gebadm
222; 1259 41085 TABLE trd orders trdadm
221; 1259 41084 SEQUENCE trd orders_order_id_seq trdadm
4386; 0 0 SEQUENCE OWNED BY trd orders_order_id_seq trdadm
4216; 2604 41088 DEFAULT trd orders order_id trdadm
4373; 0 32849 TABLE DATA geb dept gebadm
4372; 0 32844 TABLE DATA geb emp gebadm
4378; 0 41097 TABLE DATA geb pgbench_accounts gebadm
4379; 0 41100 TABLE DATA geb pgbench_branches gebadm
4376; 0 41091 TABLE DATA geb pgbench_history gebadm
4377; 0 41094 TABLE DATA geb pgbench_tellers gebadm
4375; 0 41085 TABLE DATA trd orders trdadm
4387; 0 0 SEQUENCE SET trd orders_order_id_seq trdadm
4218; 2606 32853 CONSTRAINT geb dept dept_pkey gebadm
4224; 2606 41112 CONSTRAINT geb pgbench_accounts pgbench_accounts_pkey gebadm
4226; 2606 41108 CONSTRAINT geb pgbench_branches pgbench_branches_pkey gebadm
4222; 2606 41110 CONSTRAINT geb pgbench_tellers pgbench_tellers_pkey gebadm
4220; 2606 41090 CONSTRAINT trd orders orders_pkey trdadm
[postgres@lxceftsgvdb01 backup]$

# Extract only object definitions (Schema Only)
pg_restore -s -f schema.sql 02_task_gebua_full_backup_binary.dmp

# Extract the dump into SQL (extract DDL and data)
pg_restore -f backup.sql 02_task_gebua_full_backup_binary.dmp

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

Types of Shutdown in PostgreSQL

Types of Shutdown in PostgreSQL

PostgreSQL Shutdown TypeOracleBehavior
Smart (SIGTERM)SHUTDOWN NORMALThe server stops accepting new connections but allows existing sessions to continue running normally. PostgreSQL shuts down only after all active sessions disconnect and their transactions complete successfully.
Fast (SIGINT – Default)SHUTDOWN IMMEDIATEThe server stops accepting new connections and immediately terminates all active sessions. Any uncommitted transactions are rolled back, and PostgreSQL performs a clean shutdown gracefully.
Immediate (SIGQUIT)SHUTDOWN ABORTThe server terminates all processes instantly without performing a proper shutdown. No cleanup or checkpoint occurs, so PostgreSQL performs crash recovery by replaying WAL files during the next startup.
Shutdown TypeSignalCommand ExampleBehavior
SmartSIGTERMpg_ctl stop -D /pgData -m smartStops new connections, waits for existing sessions to finish normally, then shuts down.
Fast (Default)SIGINTpg_ctl stop -D /pgdata -m fastStops new connections, terminates active sessions, rolls back uncommitted transactions, and shuts down cleanly.
ImmediateSIGQUITpg_ctl stop -D /pgdata -m immediateStops immediately without proper shutdown. Recovery from WAL files happens during next startup.

Difference Between Reload and Restart

  • When we change server configuration parameters, PostgreSQL needs to read those changes before they become active.
  • Reload applies the new configuration without stopping or restarting the database service. Existing connections and database activity continue normally.
  • Some configuration parameter changes cannot be applied through reload and will only take effect after a restart.
  • Restart stops the PostgreSQL server gracefully, ends all running activities, releases resources, closes open files, and then starts the server again with the new configuration.

 

Smart Shutdown (SIGTERM):

[postgres@pgdb02 ~]$ pg_ctl stop -D /pgData/pgsql17/data -m smart
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

2026-07-03 14:26:59.741 +08 [3476] LOG:  received smart shutdown request
2026-07-03 14:26:59.752 +08 [3476] LOG:  background worker "logical replication launcher" (PID 3483) exited with exit code 1
2026-07-03 14:26:59.753 +08 [3478] LOG:  shutting down
2026-07-03 14:26:59.755 +08 [3478] LOG:  checkpoint starting: shutdown immediate
2026-07-03 14:26:59.765 +08 [3478] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.003 s, total=0.012 s; sync files=2, longest=0.003 s, average=0.002 s; distance=0 kB, estimate=0 kB; lsn=1/105465F0, redo lsn=1/105465F0
2026-07-03 14:26:59.771 +08 [3476] LOG:  database system is shut down


[postgres@pgdb02 ~]$ pg_ctl start -D /pgData/pgsql17/data
waiting for server to start....2026-07-03 14:27:18.394 +08 [3487] LOG:  redirecting log output to logging collector process
2026-07-03 14:27:18.394 +08 [3487] HINT:  Future log output will appear in directory "log".
 done
server started
[postgres@pgdb02 ~]$

2026-07-03 14:27:18.394 +08 [3487] LOG:  starting PostgreSQL 17.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14), 64-bit
2026-07-03 14:27:18.396 +08 [3487] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2026-07-03 14:27:18.396 +08 [3487] LOG:  listening on IPv6 address "::", port 5432
2026-07-03 14:27:18.399 +08 [3487] LOG:  listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2026-07-03 14:27:18.404 +08 [3487] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2026-07-03 14:27:18.413 +08 [3491] LOG:  database system was shut down at 2026-07-03 14:26:59 +08
2026-07-03 14:27:18.425 +08 [3487] LOG:  database system is ready to accept connections

Fast Shutdown (SIGINT – Default):

[postgres@pgdb02 ~]$ pg_ctl stop -D /pgData/pgsql17/data -m fast
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

2026-07-03 14:28:26.839 +08 [3487] LOG:  received fast shutdown request
2026-07-03 14:28:26.844 +08 [3487] LOG:  aborting any active transactions
2026-07-03 14:28:26.854 +08 [3487] LOG:  background worker "logical replication launcher" (PID 3494) exited with exit code 1
2026-07-03 14:28:26.860 +08 [3489] LOG:  shutting down
2026-07-03 14:28:26.862 +08 [3489] LOG:  checkpoint starting: shutdown immediate
2026-07-03 14:28:26.874 +08 [3489] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.005 s, total=0.015 s; sync files=2, longest=0.004 s, average=0.003 s; distance=0 kB, estimate=0 kB; lsn=1/105466A0, redo lsn=1/105466A0
2026-07-03 14:28:26.882 +08 [3487] LOG:  database system is shut down

[postgres@pgdb02 ~]$ pg_ctl start -D /pgData/pgsql17/data
waiting for server to start....2026-07-03 14:29:00.574 +08 [3505] LOG:  redirecting log output to logging collector process
2026-07-03 14:29:00.574 +08 [3505] HINT:  Future log output will appear in directory "log".
 done
server started
[postgres@pgdb02 ~]$

2026-07-03 14:29:00.575 +08 [3505] LOG:  starting PostgreSQL 17.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14), 64-bit
2026-07-03 14:29:00.579 +08 [3505] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2026-07-03 14:29:00.580 +08 [3505] LOG:  listening on IPv6 address "::", port 5432
2026-07-03 14:29:00.582 +08 [3505] LOG:  listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2026-07-03 14:29:00.587 +08 [3505] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2026-07-03 14:29:00.595 +08 [3509] LOG:  database system was shut down at 2026-07-03 14:28:26 +08
2026-07-03 14:29:00.607 +08 [3505] LOG:  database system is ready to accept connections

Immediate Shutdown (SIGQUIT):

[postgres@pgdb02 ~]$ pg_ctl stop -D /pgData/pgsql17/data -m immediate
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

2026-07-03 14:29:47.471 +08 [3505] LOG:  received immediate shutdown request
2026-07-03 14:29:47.485 +08 [3505] LOG:  database system is shut down


[postgres@pgdb02 ~]$ pg_ctl start -D /pgData/pgsql17/data
waiting for server to start....2026-07-03 14:30:17.965 +08 [3520] LOG:  redirecting log output to logging collector process
2026-07-03 14:30:17.965 +08 [3520] HINT:  Future log output will appear in directory "log".
. done
server started
[postgres@pgdb02 ~]$

2026-07-03 14:30:17.966 +08 [3520] LOG:  starting PostgreSQL 17.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-14), 64-bit
2026-07-03 14:30:17.966 +08 [3520] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2026-07-03 14:30:17.966 +08 [3520] LOG:  listening on IPv6 address "::", port 5432
2026-07-03 14:30:17.970 +08 [3520] LOG:  listening on Unix socket "/run/postgresql/.s.PGSQL.5432"
2026-07-03 14:30:17.974 +08 [3520] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2026-07-03 14:30:17.983 +08 [3524] LOG:  database system was interrupted; last known up at 2026-07-03 14:29:00 +08
2026-07-03 14:30:19.211 +08 [3524] LOG:  database system was not properly shut down; automatic recovery in progress
2026-07-03 14:30:19.216 +08 [3524] LOG:  redo starts at 1/10546718
2026-07-03 14:30:19.216 +08 [3524] LOG:  invalid record length at 1/10546750: expected at least 24, got 0
2026-07-03 14:30:19.217 +08 [3524] LOG:  redo done at 1/10546718 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2026-07-03 14:30:19.221 +08 [3522] LOG:  checkpoint starting: end-of-recovery immediate wait
2026-07-03 14:30:19.231 +08 [3522] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.003 s, total=0.012 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB; lsn=1/10546750, redo lsn=1/10546750
2026-07-03 14:30:19.239 +08 [3520] LOG:  database system is ready to accept connections

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

Create a Second PostgreSQL Instance on the Same Linux Server

Create a Second PostgreSQL Instance on the Same Linux Server

Table of Contents



0. Verify existing setup

[postgres@pgdb02 ~]$ ps -ef | grep postgres
root        3641    3561  0 16:57 pts/1    00:00:00 su - postgres
postgres    3642    3641  0 16:57 pts/1    00:00:00 -bash
postgres    3711       1  0 17:03 ?        00:00:00 /pgBin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
postgres    3712    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: checkpointer
postgres    3713    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: background writer
postgres    3715    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: walwriter
postgres    3716    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: autovacuum launcher
postgres    3717    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: logical replication launcher
postgres    3731    3642  0 17:03 pts/1    00:00:00 psql
postgres    3732    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: postgres postgres [local] idle
root        3748    3164  0 17:09 pts/0    00:00:00 su - postgres
postgres    3749    3748  0 17:09 pts/0    00:00:00 -bash
postgres    3911    3749  0 17:59 pts/0    00:00:00 ps -ef
postgres    3912    3749  0 17:59 pts/0    00:00:00 grep --color=auto postgres
[postgres@pgdb02 ~]$

1. Create new directories

[root@pgdb02 ~]# mkdir -p /pgData/pgsql/17.4/dev
[root@pgdb02 ~]# mkdir -p /pgWal/pgsql/17.4/dev
[root@pgdb02 ~]# chown -R postgres:postgres /pgData /pgWal
[root@pgdb02 ~]#

2. Initialize second cluster

# As postgres user 

[postgres@pgdb02 ~]$ /pgBin/pgsql/17.4/bin/initdb -D /pgData/pgsql/17.4/dev --waldir=/pgWal/pgsql/17.4/dev --wal-segsize=128
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_SG.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /pgData/pgsql/17.4/dev ... ok
fixing permissions on existing directory /pgWal/pgsql/17.4/dev ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Asia/Singapore
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /pgBin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4/dev -l logfile start

[postgres@pgdb02 ~]$

[postgres@pgdb02 ~]$ ls -ld /pgData/pgsql/17.4/dev
drwx------. 18 postgres postgres 4096 Jun 20 18:03 /pgData/pgsql/17.4/dev
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ ls -ltr /pgData/pgsql/17.4/dev
total 56
lrwxrwxrwx. 1 postgres postgres    21 Jun 20 18:03 pg_wal -> /pgWal/pgsql/17.4/dev
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_commit_ts
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_dynshmem
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_twophase
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_tblspc
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_stat_tmp
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_snapshots
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_serial
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_replslot
drwx------. 2 postgres postgres     6 Jun 20 18:03 pg_notify
drwx------. 4 postgres postgres    36 Jun 20 18:03 pg_multixact
-rw-------. 1 postgres postgres     3 Jun 20 18:03 PG_VERSION
-rw-------. 1 postgres postgres 30718 Jun 20 18:03 postgresql.conf
-rw-------. 1 postgres postgres    88 Jun 20 18:03 postgresql.auto.conf
-rw-------. 1 postgres postgres  5711 Jun 20 18:03 pg_hba.conf
-rw-------. 1 postgres postgres  2640 Jun 20 18:03 pg_ident.conf
drwx------. 2 postgres postgres    18 Jun 20 18:03 pg_xact
drwx------. 2 postgres postgres    18 Jun 20 18:03 pg_subtrans
drwx------. 2 postgres postgres  4096 Jun 20 18:03 global
drwx------. 5 postgres postgres    33 Jun 20 18:03 base
drwx------. 4 postgres postgres    68 Jun 20 18:03 pg_logical
drwx------. 2 postgres postgres    25 Jun 20 18:03 pg_stat
[postgres@pgdb02 ~]$

**** we can see here 700 permission set by initdb command.

3. Edit second instance config

[postgres@pgdb02 ~]$ egrep "^(#)?(port|cluster_name)" /pgData/pgsql/17.4/dev/postgresql.conf
#port = 5432                            # (change requires restart)
#cluster_name = ''                      # added to process titles if nonempty
[postgres@pgdb02 ~]$


[postgres@pgdb02 ~]$ cp /pgData/pgsql/17.4/dev/postgresql.conf /pgData/pgsql/17.4/dev/postgresql.conf.bkp
[postgres@pgdb02 ~]$

[postgres@pgdb02 ~]$ sed -i "s/^#port = 5432.*/port = 5433/" /pgData/pgsql/17.4/dev/postgresql.conf
[postgres@pgdb02 ~]$ sed -i "s/^#cluster_name = ''.*/cluster_name = 'PGDB_UAT'/" /pgData/pgsql/17.4/dev/postgresql.conf
[postgres@pgdb02 ~]$
[postgres@pgdb02 ~]$ egrep "^(#)?(port|cluster_name)" /pgData/pgsql/17.4/dev/postgresql.conf
port = 5433
cluster_name = 'PGDB_UAT'
[postgres@pgdb02 ~]$

4. Start PostgreSQL Service

[postgres@pgdb02 ~]$ /pgBin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4/dev -l logfile start
waiting for server to start.... done
server started
[postgres@pgdb02 ~]$

5. Connect to second instance

[postgres@pgdb02 ~]$ psql -p 5433
psql (17.4)
Type "help" for help.

postgres=# SHOW port;
 port
------
 5433  <-----------
(1 row)

postgres=# SHOW cluster_name;
 cluster_name
--------------
 PGDB_UAT  <---------------
(1 row)

postgres=#\q

[postgres@pgdb02 ~]$ pg_ctl stop -D /pgData/pgsql/17.4/dev
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

6. Create second systemd service

[root@pgdb02 ~]# cp /etc/systemd/system/postgresql-17.service /etc/systemd/system/postgresql-17-dev.service
[root@pgdb02 ~]#
[root@pgdb02 ~]# grep -i Environment=PGDATA /etc/systemd/system/postgresql-17-dev.service
Environment=PGDATA=/pgData/pgsql/17.4
[root@pgdb02 ~]#

[root@pgdb02 ~]# sed -i 's|Environment=PGDATA=/pgData/pgsql/17.4|Environment=PGDATA=/pgData/pgsql/17.4/dev|' /etc/systemd/system/postgresql-17-dev.service
[root@pgdb02 ~]# grep -i Environment=PGDATA /etc/systemd/system/postgresql-17-dev.service
Environment=PGDATA=/pgData/pgsql/17.4/dev
[root@pgdb02 ~]#

[root@pgdb02 ~]# systemctl daemon-reload
[root@pgdb02 ~]# systemctl start postgresql-17-dev
[root@pgdb02 ~]# systemctl enable postgresql-17-dev
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-17-dev.service → /etc/systemd/system/postgresql-17-dev.service.
[root@pgdb02 ~]#
[root@pgdb02 ~]# systemctl status postgresql-17-dev
● postgresql-17-dev.service - PostgreSQL 17 Database Server
     Loaded: loaded (/etc/systemd/system/postgresql-17-dev.service; enabled; preset: disabled)
     Active: active (running) since Sat 2026-06-20 18:25:39 +08; 12s ago
       Docs: https://www.postgresql.org/docs/17/
   Main PID: 4106 (postgres)
      Tasks: 6 (limit: 15700)
     Memory: 15.2M
        CPU: 62ms
     CGroup: /system.slice/postgresql-17-dev.service
             ├─4106 /pgBin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4/dev
             ├─4107 "postgres: PGDB_UAT: checkpointer "
             ├─4108 "postgres: PGDB_UAT: background writer "
             ├─4110 "postgres: PGDB_UAT: walwriter "
             ├─4111 "postgres: PGDB_UAT: autovacuum launcher "
             └─4112 "postgres: PGDB_UAT: logical replication launcher "

Jun 20 18:25:39 pgdb02 systemd[1]: Starting PostgreSQL 17 Database Server...
Jun 20 18:25:39 pgdb02 pg_ctl[4103]: waiting for server to start.... done
Jun 20 18:25:39 pgdb02 pg_ctl[4103]: server started
Jun 20 18:25:39 pgdb02 systemd[1]: Started PostgreSQL 17 Database Server.
[root@pgdb02 ~]#

7. Verify instances

[postgres@pgdb02 ~]$ ps -ef | grep postgres
postgres    3711       1  0 17:03 ?        00:00:00 /pgBin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
postgres    3712    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: checkpointer
postgres    3713    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: background writer
postgres    3715    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: walwriter
postgres    3716    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: autovacuum launcher
postgres    3717    3711  0 17:03 ?        00:00:00 postgres: PGDB_SIT: logical replication launcher
root        3748    3164  0 17:09 pts/0    00:00:00 su - postgres
postgres    3749    3748  0 17:09 pts/0    00:00:00 -bash
postgres    4106       1  0 18:25 ?        00:00:00 /pgBin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4/dev
postgres    4107    4106  0 18:25 ?        00:00:00 postgres: PGDB_UAT: checkpointer
postgres    4108    4106  0 18:25 ?        00:00:00 postgres: PGDB_UAT: background writer
postgres    4110    4106  0 18:25 ?        00:00:00 postgres: PGDB_UAT: walwriter
postgres    4111    4106  0 18:25 ?        00:00:00 postgres: PGDB_UAT: autovacuum launcher
postgres    4112    4106  0 18:25 ?        00:00:00 postgres: PGDB_UAT: logical replication launcher
postgres    4157    3749 99 18:26 pts/0    00:00:00 ps -ef
postgres    4158    3749  0 18:26 pts/0    00:00:00 grep --color=auto postgres
[postgres@pgdb02 ~]$

[postgres@pgdb02 ~]$ ss -tulpn | grep 543
tcp   LISTEN 0      200        127.0.0.1:5433       0.0.0.0:*    users:(("postgres",pid=4106,fd=7))
tcp   LISTEN 0      200        127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=3711,fd=7))
tcp   LISTEN 0      200            [::1]:5432          [::]:*    users:(("postgres",pid=3711,fd=6))
tcp   LISTEN 0      200            [::1]:5433          [::]:*    users:(("postgres",pid=4106,fd=6))
[postgres@pgdb02 ~]$

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL 17 DBA Free Training Roadmap

PostgreSQL DBA Free Coaching

Free PostgreSQL DBA Training in Telugu for Beginners | Live Ongoing Batch | June 15 - July 31, 2026.
తెలుగులో నేర్చుకోండి · 5 Weeks · Online · Beginner Friendly · 100% Free

DBA Training Program
// 5-week structured training · 19 sessions · hands-on labs
5
Weeks
19
Sessions
100+
Topics
Future Free
Week 01 Lab Setup, Linux & PostgreSQL Fundamentals
Session 01 Lab Setup & Storage Configuration
Pre-requisites
  • Install VirtualBox on Windows (Do your self)
  • Install PgAdmin4 on Windows (Do your self)
  • Configure Oracle Linux 9.6 VM (will share link)
Linux VM Setup
  • Create Oracle Linux 9.6 VM
  • VM Hardware Sizing for PostgreSQL
  • Add Multiple Virtual Disks
Storage Configuration
  • Create Partitions
  • Create Filesystems
  • Mount Filesystems
  • Configure /etc/fstab
PostgreSQL Directory Layout
  • Create Mount Points: /pgData, /pgWal, /pgArch, /pgBackup, /pgLog
Session 02 Linux Administration for DBAs
  • Basic Linux Commands
  • File and Directory Management
  • User and Group Management
  • Permissions and Ownership
  • Process Management
  • Service Management using systemctl
  • Network Commands
  • Disk and Memory Monitoring
Session 03 PostgreSQL 17 Installation
Overview
  • PostgreSQL Overview and Versions
Installation Methods
  • RPM Installation
  • DNF/YUM Installation
  • Source Code Installation
Database Initialization
  • initdb
  • Custom WAL Location
  • PostgreSQL Service Configuration
Validation
  • Start PostgreSQL
  • Connect using psql
  • Connect using PgAdmin4
Session 04 PostgreSQL Architecture
Memory Architecture
  • Shared Buffers
  • WAL Buffers
  • Work Memory
  • Maintenance Work Memory
Process Architecture
  • Postmaster
  • Backend Processes
  • Checkpointer
  • Background Writer
  • WAL Writer
  • Autovacuum
Physical Storage Layout
  • Base Directory
  • Global Directory
  • WAL Directory
  • Tablespaces
Session 05 PostgreSQL Configuration Files
  • postgresql.conf
  • postgresql.auto.conf
  • pg_hba.conf
  • pg_ident.conf
  • Reload vs Restart
Week 02 Administration & Security
Session 06 Startup, Shutdown
  • PostgreSQL Startup Process
  • Smart Shutdown
  • Fast Shutdown (default)
  • Immediate Shutdown
Session 07 Database Administration
  • Creating Databases
  • Creating Schemas
  • Schema Search Path
  • Roles and Users
  • Access Control
Session 08 Tablespaces Management
  • pg_default
  • pg_global
  • Custom Tablespaces
  • Move Objects Between Tablespaces
  • Tablespace Monitoring
Session 09 Security
  • pg_hba.conf
  • Authentication Methods
  • pg_ident.conf
  • .pgpass
  • SSL/TLS Setup
Session 10 Vacuum and Analyze
  • MVCC Concepts
  • Dead Tuples
  • VACUUM
  • VACUUM FULL
  • ANALYZE
  • Autovacuum
Week 03 Backup & Recovery
Session 11 WAL Archiving
  • WAL Fundamentals
  • Archive Mode
  • Archive Command
Session 12 Logical Backup and Restore
  • pg_dump
  • pg_dumpall
  • Backup Formats
  • pg_restore
  • Restore using psql
Session 13 Physical Backup and Restore
  • pg_basebackup
  • Full Cluster Backup
  • Database Refresh on New Server
Session 14 PITR — Point-in-Time Recovery
  • PITR Concepts and Architecture
  • PITR Demonstration (hands-on)
Session 15 Full Recovery & Disaster Recovery
  • Full Database Recovery
  • Disaster Recovery Scenarios
Week 04 Replication, Failover
Session 16 Streaming Replication
  • Primary Configuration
  • Replica Configuration
  • Base Backup for Replica
  • Verify Replication
Session 17 Replication Administration
  • Replication Slots
  • Monitoring Replication
  • Async Replication
  • Sync Replication
  • Convert from ASYNC to SYNC
Session 18 Failover and pg_rewind
  • Manual Failover
  • Promote Replica
  • pg_rewind
  • Rejoin Old Primary as Replica
Week 05 Upgrades
Session 19 PostgreSQL Upgrades & Final Lab
  • Minor Version Upgrade
  • Major Version Upgrades
  • pg_upgrade
  • Upgrade using pg_dump/pg_restore
  • Upgrade Validation
  • Final End-to-End Lab
Future Batch Advanced Topics — Free Training
// Topics reserved for the next advanced batch · access is free
EXPLAIN / EXPLAIN ANALYZE Index Types & Tuning Table Partitioning Performance Tuning PostgreSQL Extensions PgBouncer pgmetrics pgcollector pgbadger Repmgr Patroni Maintenance Operations Oracle → PostgreSQL (Ora2Pg) Advanced Data Migration Logical Replication Multi-Node HA Architectures

PostgreSQL DBA Free Training Roadmap · Click any session card to expand topics

Install PostgreSQL 17.4 from Source code

Install PostgreSQL 17.4 Using Source Code (Linux 9)

Table of Contents



0. Environment

ParameterValue
Host Namepgdb01
IP192.168.2.71
OSLinux 9
PostgreSQL Version17.4
Data Directory/pgData/pgsql/17.4
PG WAL/pgWal/pgsql/17.4
BIN Directory/pgbin/pgsql/17.4/bin
Software Staging Directory/pg_Backup/stage

1. Set SELINUX to Permissive and Restart the server

# Set SELINUX to permissive

[root@pgdb02 ~]# grep ^SELINUX= /etc/selinux/config
SELINUX=enforcing
[root@pgdb02 ~]#
[root@pgdb02 ~]# sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
[root@pgdb02 ~]#
[root@pgdb02 ~]# grep ^SELINUX= /etc/selinux/config
SELINUX=permissive
[root@pgdb02 ~]#
[root@pgdb02 ~]# shutdown -Fr now   <---- Restart the server to take effect

2. Install Dependencies

**Note:** For testing purposes, I intentionally did not install the following dependency packages: dnf install -y perl perl-core perl-ExtUtils-MakeMakerWe can see dependency-related error to be reproduced and observed during the installation process.**Caution:** If you do not want to  encounter the error described in **Step 7**, install the above packages before proceeding.As part of this exercise, the installation will be cleaned up after the error is encountered, and the installation process will then be repeated with the required dependencies installed to demonstrate a successful installation.
[root@pgdb01 ~]# dnf install -y readline-devel zlib-devel gcc make libicu-devel openssl-devel bison flex wget tar
Last metadata expiration check: 0:08:12 ago on Tue 21 Apr 2026 07:35:12 PM.
Package wget-1.21.1-8.el9_4.x86_64 is already installed.
Package tar-2:1.34-7.el9.x86_64 is already installed.
Dependencies resolved.
==============================================================================================================================================================================================================
 Package                                                 Architecture                          Version                                                 Repository                                        Size
==============================================================================================================================================================================================================
Installing:
 bison                                                   x86_64                                3.7.4-5.el9                                             ol9_appstream                                    1.0 M
 flex                                                    x86_64                                2.6.4-9.el9                                             ol9_appstream                                    341 k
 gcc                                                     x86_64                                11.5.0-11.0.2.el9                                       ol9_appstream                                     33 M
 libicu-devel                                            x86_64                                67.1-10.el9_6                                           ol9_appstream                                    1.3 M
 make                                                    x86_64                                1:4.3-8.el9                                             ol9_baseos_latest                                570 k
 openssl-devel                                           x86_64                                1:3.5.1-7.0.1.el9_7                                     ol9_appstream                                    4.2 M
 readline-devel                                          x86_64                                8.1-4.el9                                               ol9_appstream                                    238 k
 zlib-devel                                              x86_64                                1.2.11-40.el9                                           ol9_appstream                                     51 k
Upgrading:
 cpp                                                     x86_64                                11.5.0-11.0.2.el9                                       ol9_appstream                                     11 M
 glibc                                                   x86_64                                2.34-231.0.1.el9_7.10                                   ol9_baseos_latest                                2.0 M
 glibc-all-langpacks                                     x86_64                                2.34-231.0.1.el9_7.10                                   ol9_baseos_latest                                 18 M
 glibc-common                                            x86_64                                2.34-231.0.1.el9_7.10                                   ol9_baseos_latest                                330 k
 glibc-gconv-extra                                       x86_64                                2.34-231.0.1.el9_7.10                                   ol9_baseos_latest                                1.8 M
 glibc-langpack-en                                       x86_64                                2.34-231.0.1.el9_7.10                                   ol9_baseos_latest                                969 k
 libgcc                                                  x86_64                                11.5.0-11.0.2.el9                                       ol9_baseos_latest                                 94 k
 libgomp                                                 x86_64                                11.5.0-11.0.2.el9                                       ol9_baseos_latest                                263 k
 libicu                                                  x86_64                                67.1-10.el9_6                                           ol9_baseos_latest                                9.6 M
 openssl                                                 x86_64                                1:3.5.1-7.0.1.el9_7                                     ol9_baseos_latest                                1.6 M
 openssl-fips-provider                                   x86_64                                3.0.7-8.0.1.el9                                         ol9_baseos_latest                                8.3 k
 openssl-fips-provider-so                                x86_64                                3.0.7-8.0.1.el9                                         ol9_baseos_latest                                575 k
 openssl-libs                                            x86_64                                1:3.5.1-7.0.1.el9_7                                     ol9_baseos_latest                                2.3 M
 tar                                                     x86_64                                2:1.34-9.el9_7                                          ol9_baseos_latest                                927 k
Installing dependencies:
 glibc-devel                                             x86_64                                2.34-231.0.1.el9_7.10                                   ol9_appstream                                     60 k
 glibc-headers                                           x86_64                                2.34-231.0.1.el9_7.10                                   ol9_appstream                                    921 k
 kernel-headers                                          x86_64                                5.14.0-611.47.1.el9_7                                   ol9_appstream                                    3.6 M
 libxcrypt-devel                                         x86_64                                4.4.18-3.el9                                            ol9_appstream                                     42 k
 m4                                                      x86_64                                1.4.19-1.el9                                            ol9_appstream                                    333 k
 ncurses-c++-libs                                        x86_64                                6.2-10.20210508.el9                                     ol9_appstream                                     36 k
 ncurses-devel                                           x86_64                                6.2-10.20210508.el9                                     ol9_appstream                                    684 k

Transaction Summary
==============================================================================================================================================================================================================
Install  15 Packages
Upgrade  14 Packages

Total download size: 95 M
Downloading Packages:
(1/29): make-4.3-8.el9.x86_64.rpm                                                                                                                                             1.3 MB/s | 570 kB     00:00
(2/29): flex-2.6.4-9.el9.x86_64.rpm                                                                                                                                           792 kB/s | 341 kB     00:00
(3/29): bison-3.7.4-5.el9.x86_64.rpm                                                                                                                                          2.2 MB/s | 1.0 MB     00:00
(4/29): glibc-devel-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                          1.4 MB/s |  60 kB     00:00
(5/29): glibc-headers-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                        3.8 MB/s | 921 kB     00:00
(6/29): kernel-headers-5.14.0-611.47.1.el9_7.x86_64.rpm                                                                                                                       3.7 MB/s | 3.6 MB     00:00
(7/29): libicu-devel-67.1-10.el9_6.x86_64.rpm                                                                                                                                 1.6 MB/s | 1.3 MB     00:00
(8/29): libxcrypt-devel-4.4.18-3.el9.x86_64.rpm                                                                                                                               885 kB/s |  42 kB     00:00
(9/29): ncurses-c++-libs-6.2-10.20210508.el9.x86_64.rpm                                                                                                                       255 kB/s |  36 kB     00:00
(10/29): m4-1.4.19-1.el9.x86_64.rpm                                                                                                                                           1.9 MB/s | 333 kB     00:00
(11/29): ncurses-devel-6.2-10.20210508.el9.x86_64.rpm                                                                                                                         2.8 MB/s | 684 kB     00:00
(12/29): readline-devel-8.1-4.el9.x86_64.rpm                                                                                                                                  1.5 MB/s | 238 kB     00:00
(13/29): zlib-devel-1.2.11-40.el9.x86_64.rpm                                                                                                                                  425 kB/s |  51 kB     00:00
(14/29): glibc-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                               3.2 MB/s | 2.0 MB     00:00
(15/29): openssl-devel-3.5.1-7.0.1.el9_7.x86_64.rpm                                                                                                                           3.5 MB/s | 4.2 MB     00:01
(16/29): glibc-common-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                        1.9 MB/s | 330 kB     00:00
(17/29): glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                   3.0 MB/s | 1.8 MB     00:00
(18/29): glibc-langpack-en-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                   2.4 MB/s | 969 kB     00:00
(19/29): libgcc-11.5.0-11.0.2.el9.x86_64.rpm                                                                                                                                  921 kB/s |  94 kB     00:00
(20/29): libgomp-11.5.0-11.0.2.el9.x86_64.rpm                                                                                                                                 1.3 MB/s | 263 kB     00:00
(21/29): glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64.rpm                                                                                                                 5.4 MB/s |  18 MB     00:03
(22/29): openssl-3.5.1-7.0.1.el9_7.x86_64.rpm                                                                                                                                 3.2 MB/s | 1.6 MB     00:00
(23/29): openssl-fips-provider-3.0.7-8.0.1.el9.x86_64.rpm                                                                                                                     273 kB/s | 8.3 kB     00:00
(24/29): libicu-67.1-10.el9_6.x86_64.rpm                                                                                                                                      3.9 MB/s | 9.6 MB     00:02
(25/29): openssl-fips-provider-so-3.0.7-8.0.1.el9.x86_64.rpm                                                                                                                  2.3 MB/s | 575 kB     00:00
(26/29): tar-1.34-9.el9_7.x86_64.rpm                                                                                                                                          3.7 MB/s | 927 kB     00:00
(27/29): openssl-libs-3.5.1-7.0.1.el9_7.x86_64.rpm                                                                                                                            3.6 MB/s | 2.3 MB     00:00
(28/29): cpp-11.5.0-11.0.2.el9.x86_64.rpm                                                                                                                                     5.4 MB/s |  11 MB     00:02
(29/29): gcc-11.5.0-11.0.2.el9.x86_64.rpm                                                                                                                                     3.5 MB/s |  33 MB     00:09
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                         9.8 MB/s |  95 MB     00:09
Oracle Linux 9 BaseOS Latest (x86_64)                                                                                                                                         3.9 MB/s | 6.2 kB     00:00
Importing GPG key 0x8D8B756F:
 Userid     : "Oracle Linux (release key 1) <secalert_us@oracle.com>"
 Fingerprint: 3E6D 826D 3FBA B389 C2F3 8E34 BC4D 06A0 8D8B 756F
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Key imported successfully
Importing GPG key 0x8B4EFBE6:
 Userid     : "Oracle Linux (backup key 1) <secalert_us@oracle.com>"
 Fingerprint: 9822 3175 9C74 6706 5D0C E9B2 A7DD 0708 8B4E FBE6
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                      1/1
  Upgrading        : glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                    1/43
  Upgrading        : glibc-common-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                           2/43
  Upgrading        : glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                      3/43
  Running scriptlet: glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                      3/43
  Upgrading        : glibc-langpack-en-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                      4/43
  Upgrading        : libgcc-11.5.0-11.0.2.el9.x86_64                                                                                                                                                     5/43
  Running scriptlet: libgcc-11.5.0-11.0.2.el9.x86_64                                                                                                                                                     5/43
  Running scriptlet: glibc-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                                  6/43
  Upgrading        : glibc-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                                  6/43
  Running scriptlet: glibc-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                                  6/43
  Installing       : m4-1.4.19-1.el9.x86_64                                                                                                                                                              7/43
  Installing       : make-1:4.3-8.el9.x86_64                                                                                                                                                             8/43
  Installing       : glibc-headers-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                          9/43
  Installing       : ncurses-c++-libs-6.2-10.20210508.el9.x86_64                                                                                                                                        10/43
  Installing       : ncurses-devel-6.2-10.20210508.el9.x86_64                                                                                                                                           11/43
  Upgrading        : libgomp-11.5.0-11.0.2.el9.x86_64                                                                                                                                                   12/43
  Upgrading        : libicu-67.1-10.el9_6.x86_64                                                                                                                                                        13/43
  Upgrading        : openssl-fips-provider-so-3.0.7-8.0.1.el9.x86_64                                                                                                                                    14/43
  Upgrading        : openssl-fips-provider-3.0.7-8.0.1.el9.x86_64                                                                                                                                       15/43
  Upgrading        : openssl-libs-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                            16/43
  Upgrading        : cpp-11.5.0-11.0.2.el9.x86_64                                                                                                                                                       17/43
  Installing       : kernel-headers-5.14.0-611.47.1.el9_7.x86_64                                                                                                                                        18/43
  Installing       : libxcrypt-devel-4.4.18-3.el9.x86_64                                                                                                                                                19/43
  Installing       : glibc-devel-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                           20/43
  Installing       : gcc-11.5.0-11.0.2.el9.x86_64                                                                                                                                                       21/43
  Installing       : openssl-devel-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                           22/43
  Upgrading        : openssl-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                                 23/43
  Installing       : libicu-devel-67.1-10.el9_6.x86_64                                                                                                                                                  24/43
  Installing       : readline-devel-8.1-4.el9.x86_64                                                                                                                                                    25/43
  Installing       : bison-3.7.4-5.el9.x86_64                                                                                                                                                           26/43
  Installing       : flex-2.6.4-9.el9.x86_64                                                                                                                                                            27/43
  Upgrading        : tar-2:1.34-9.el9_7.x86_64                                                                                                                                                          28/43
  Installing       : zlib-devel-1.2.11-40.el9.x86_64                                                                                                                                                    29/43
  Cleanup          : openssl-1:3.2.2-6.0.1.el9_5.1.x86_64                                                                                                                                               30/43
  Cleanup          : libicu-67.1-9.el9.x86_64                                                                                                                                                           31/43
  Cleanup          : openssl-libs-1:3.2.2-6.0.1.el9_5.1.x86_64                                                                                                                                          32/43
  Cleanup          : cpp-11.5.0-5.0.1.el9.x86_64                                                                                                                                                        33/43
  Cleanup          : tar-2:1.34-7.el9.x86_64                                                                                                                                                            34/43
  Cleanup          : libgomp-11.5.0-5.0.1.el9.x86_64                                                                                                                                                    35/43
  Cleanup          : openssl-fips-provider-3.0.7-6.0.1.el9_5.x86_64                                                                                                                                     36/43
  Cleanup          : openssl-fips-provider-so-3.0.7-6.0.1.el9_5.x86_64                                                                                                                                  37/43
  Cleanup          : glibc-all-langpacks-2.34-168.0.1.el9.x86_64                                                                                                                                        38/43
  Cleanup          : glibc-gconv-extra-2.34-168.0.1.el9.x86_64                                                                                                                                          39/43
  Running scriptlet: glibc-gconv-extra-2.34-168.0.1.el9.x86_64                                                                                                                                          39/43
  Cleanup          : glibc-common-2.34-168.0.1.el9.x86_64                                                                                                                                               40/43
  Cleanup          : glibc-langpack-en-2.34-168.0.1.el9.x86_64                                                                                                                                          41/43
  Cleanup          : glibc-2.34-168.0.1.el9.x86_64                                                                                                                                                      42/43
  Cleanup          : libgcc-11.5.0-5.0.1.el9.x86_64                                                                                                                                                     43/43
  Running scriptlet: libgcc-11.5.0-5.0.1.el9.x86_64                                                                                                                                                     43/43
  Running scriptlet: glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                   43/43
  Running scriptlet: libgcc-11.5.0-5.0.1.el9.x86_64                                                                                                                                                     43/43
  Verifying        : make-1:4.3-8.el9.x86_64                                                                                                                                                             1/43
  Verifying        : bison-3.7.4-5.el9.x86_64                                                                                                                                                            2/43
  Verifying        : flex-2.6.4-9.el9.x86_64                                                                                                                                                             3/43
  Verifying        : gcc-11.5.0-11.0.2.el9.x86_64                                                                                                                                                        4/43
  Verifying        : glibc-devel-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                            5/43
  Verifying        : glibc-headers-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                          6/43
  Verifying        : kernel-headers-5.14.0-611.47.1.el9_7.x86_64                                                                                                                                         7/43
  Verifying        : libicu-devel-67.1-10.el9_6.x86_64                                                                                                                                                   8/43
  Verifying        : libxcrypt-devel-4.4.18-3.el9.x86_64                                                                                                                                                 9/43
  Verifying        : m4-1.4.19-1.el9.x86_64                                                                                                                                                             10/43
  Verifying        : ncurses-c++-libs-6.2-10.20210508.el9.x86_64                                                                                                                                        11/43
  Verifying        : ncurses-devel-6.2-10.20210508.el9.x86_64                                                                                                                                           12/43
  Verifying        : openssl-devel-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                           13/43
  Verifying        : readline-devel-8.1-4.el9.x86_64                                                                                                                                                    14/43
  Verifying        : zlib-devel-1.2.11-40.el9.x86_64                                                                                                                                                    15/43
  Verifying        : glibc-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                                 16/43
  Verifying        : glibc-2.34-168.0.1.el9.x86_64                                                                                                                                                      17/43
  Verifying        : glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                   18/43
  Verifying        : glibc-all-langpacks-2.34-168.0.1.el9.x86_64                                                                                                                                        19/43
  Verifying        : glibc-common-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                          20/43
  Verifying        : glibc-common-2.34-168.0.1.el9.x86_64                                                                                                                                               21/43
  Verifying        : glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                     22/43
  Verifying        : glibc-gconv-extra-2.34-168.0.1.el9.x86_64                                                                                                                                          23/43
  Verifying        : glibc-langpack-en-2.34-231.0.1.el9_7.10.x86_64                                                                                                                                     24/43
  Verifying        : glibc-langpack-en-2.34-168.0.1.el9.x86_64                                                                                                                                          25/43
  Verifying        : libgcc-11.5.0-11.0.2.el9.x86_64                                                                                                                                                    26/43
  Verifying        : libgcc-11.5.0-5.0.1.el9.x86_64                                                                                                                                                     27/43
  Verifying        : libgomp-11.5.0-11.0.2.el9.x86_64                                                                                                                                                   28/43
  Verifying        : libgomp-11.5.0-5.0.1.el9.x86_64                                                                                                                                                    29/43
  Verifying        : libicu-67.1-10.el9_6.x86_64                                                                                                                                                        30/43
  Verifying        : libicu-67.1-9.el9.x86_64                                                                                                                                                           31/43
  Verifying        : openssl-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                                 32/43
  Verifying        : openssl-1:3.2.2-6.0.1.el9_5.1.x86_64                                                                                                                                               33/43
  Verifying        : openssl-fips-provider-3.0.7-8.0.1.el9.x86_64                                                                                                                                       34/43
  Verifying        : openssl-fips-provider-3.0.7-6.0.1.el9_5.x86_64                                                                                                                                     35/43
  Verifying        : openssl-fips-provider-so-3.0.7-8.0.1.el9.x86_64                                                                                                                                    36/43
  Verifying        : openssl-fips-provider-so-3.0.7-6.0.1.el9_5.x86_64                                                                                                                                  37/43
  Verifying        : openssl-libs-1:3.5.1-7.0.1.el9_7.x86_64                                                                                                                                            38/43
  Verifying        : openssl-libs-1:3.2.2-6.0.1.el9_5.1.x86_64                                                                                                                                          39/43
  Verifying        : tar-2:1.34-9.el9_7.x86_64                                                                                                                                                          40/43
  Verifying        : tar-2:1.34-7.el9.x86_64                                                                                                                                                            41/43
  Verifying        : cpp-11.5.0-11.0.2.el9.x86_64                                                                                                                                                       42/43
  Verifying        : cpp-11.5.0-5.0.1.el9.x86_64                                                                                                                                                        43/43

Upgraded:
  cpp-11.5.0-11.0.2.el9.x86_64                      glibc-2.34-231.0.1.el9_7.10.x86_64                glibc-all-langpacks-2.34-231.0.1.el9_7.10.x86_64    glibc-common-2.34-231.0.1.el9_7.10.x86_64
  glibc-gconv-extra-2.34-231.0.1.el9_7.10.x86_64    glibc-langpack-en-2.34-231.0.1.el9_7.10.x86_64    libgcc-11.5.0-11.0.2.el9.x86_64                     libgomp-11.5.0-11.0.2.el9.x86_64
  libicu-67.1-10.el9_6.x86_64                       openssl-1:3.5.1-7.0.1.el9_7.x86_64                openssl-fips-provider-3.0.7-8.0.1.el9.x86_64        openssl-fips-provider-so-3.0.7-8.0.1.el9.x86_64
  openssl-libs-1:3.5.1-7.0.1.el9_7.x86_64           tar-2:1.34-9.el9_7.x86_64
Installed:
  bison-3.7.4-5.el9.x86_64                           flex-2.6.4-9.el9.x86_64                             gcc-11.5.0-11.0.2.el9.x86_64                        glibc-devel-2.34-231.0.1.el9_7.10.x86_64
  glibc-headers-2.34-231.0.1.el9_7.10.x86_64         kernel-headers-5.14.0-611.47.1.el9_7.x86_64         libicu-devel-67.1-10.el9_6.x86_64                   libxcrypt-devel-4.4.18-3.el9.x86_64
  m4-1.4.19-1.el9.x86_64                             make-1:4.3-8.el9.x86_64                             ncurses-c++-libs-6.2-10.20210508.el9.x86_64         ncurses-devel-6.2-10.20210508.el9.x86_64
  openssl-devel-1:3.5.1-7.0.1.el9_7.x86_64           readline-devel-8.1-4.el9.x86_64                     zlib-devel-1.2.11-40.el9.x86_64

Complete!
[root@pgdb01 ~]#

3. Create postgres User

[root@pgdb01 ~]# useradd postgres
[root@pgdb01 ~]# passwd postgres
Changing password for user postgres.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@pgdb01 ~]#

4. Download PostgreSQL Source

[root@pgdb01 ~]# mkdir -p /pg_Backup/stage

[root@pgdb01 ~]# cd /pg_Backup/stage
[root@pgdb01 stage]# wget https://ftp.postgresql.org/pub/source/v17.4/postgresql-17.4.tar.gz
--2026-04-21 20:22:48--  https://ftp.postgresql.org/pub/source/v17.4/postgresql-17.4.tar.gz
Resolving ftp.postgresql.org (ftp.postgresql.org)... 151.101.211.52, 2a04:4e42:31::820
Connecting to ftp.postgresql.org (ftp.postgresql.org)|151.101.211.52|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 28056622 (27M) [application/gzip]
Saving to: ‘postgresql-17.4.tar.gz’

postgresql-17.4.tar.gz                              100%[=================================================================================================================>]  26.76M  10.2MB/s    in 2.6s

2026-04-21 20:22:51 (10.2 MB/s) - ‘postgresql-17.4.tar.gz’ saved [28056622/28056622]

[root@pgdb01 stage]#

5. Extract Source

[root@pgdb01 stage]# tar -xvf postgresql-17.4.tar.gz
postgresql-17.4/
postgresql-17.4/.cirrus.star
postgresql-17.4/.cirrus.tasks.yml
..
..
postgresql-17.4/src/tutorial/funcs.source
postgresql-17.4/src/tutorial/syscat.source
[root@pgdb01 stage]#
[root@pgdb01 stage]# ls -ltr
total 27404
drwxrwxr-x. 6 root root     4096 Feb 18  2025 postgresql-17.4
-rw-r--r--. 1 root root 28056622 Feb 18  2025 postgresql-17.4.tar.gz
[root@pgdb01 stage]# cd postgresql-17.4
[root@pgdb01 postgresql-17.4]# pwd
/pg_Backup/stage/postgresql-17.4
[root@pgdb01 postgresql-17.4]#

6. Configure Build

[root@pgdb01 postgresql-17.4]# ls -ltr /pg_Backup/stage/postgresql-17.4/configure
-rwxrwxr-x. 1 root root 580836 Feb 18  2025 /pg_Backup/stage/postgresql-17.4/configure
[root@pgdb01 postgresql-17.4]#

Configure do only:

-- checks system dependencies
-- prepares Makefiles
-- stores your install path (/pgbin/pgsql/17.4) internally, it won't create bin directory.
-- It does NOT install anything yet


[root@pgdb01 postgresql-17.4]# ./configure --prefix=/pgbin/pgsql/17.4 --with-pgport=5432
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking for g++... no
checking for c++... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for gawk... gawk
checking whether gcc supports -Wdeclaration-after-statement, for CFLAGS... yes
checking whether gcc supports -Werror=vla, for CFLAGS... yes
checking whether gcc supports -Werror=unguarded-availability-new, for CFLAGS... no
checking whether g++ supports -Werror=unguarded-availability-new, for CXXFLAGS... no
checking whether gcc supports -Wendif-labels, for CFLAGS... yes
checking whether g++ supports -Wendif-labels, for CXXFLAGS... no
checking whether gcc supports -Wmissing-format-attribute, for CFLAGS... yes
checking whether g++ supports -Wmissing-format-attribute, for CXXFLAGS... no
checking whether gcc supports -Wimplicit-fallthrough=3, for CFLAGS... yes
checking whether g++ supports -Wimplicit-fallthrough=3, for CXXFLAGS... no
checking whether gcc supports -Wcast-function-type, for CFLAGS... yes
checking whether g++ supports -Wcast-function-type, for CXXFLAGS... no
checking whether gcc supports -Wshadow=compatible-local, for CFLAGS... yes
checking whether g++ supports -Wshadow=compatible-local, for CXXFLAGS... no
checking whether gcc supports -Wformat-security, for CFLAGS... yes
checking whether g++ supports -Wformat-security, for CXXFLAGS... no
checking whether gcc supports -fno-strict-aliasing, for CFLAGS... yes
checking whether g++ supports -fno-strict-aliasing, for CXXFLAGS... no
checking whether gcc supports -fwrapv, for CFLAGS... yes
checking whether g++ supports -fwrapv, for CXXFLAGS... no
checking whether gcc supports -fexcess-precision=standard, for CFLAGS... yes
checking whether g++ supports -fexcess-precision=standard, for CXXFLAGS... no
checking whether gcc supports -funroll-loops, for CFLAGS_UNROLL_LOOPS... yes
checking whether gcc supports -ftree-vectorize, for CFLAGS_VECTORIZE... yes
checking whether gcc supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wformat-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wstringop-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... no
checking whether gcc supports -fvisibility=hidden, for CFLAGS_SL_MODULE... yes
checking whether g++ supports -fvisibility=hidden, for CXXFLAGS_SL_MODULE... no
checking whether g++ supports -fvisibility-inlines-hidden, for CXXFLAGS_SL_MODULE... no
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether to build with ICU support... yes
checking for icu-uc icu-i18n... yes
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with PAM support... no
checking whether to build with BSD Authentication support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with SELinux support... no
checking whether to build with systemd support... no
checking whether to build with XML support... no
checking whether to build with LZ4 support... no
checking whether to build with ZSTD support... no
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking for tar... /usr/bin/tar
checking whether ln -s works... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for bison... /usr/bin/bison
configure: using bison (GNU Bison) 3.7.4
checking for flex... /usr/bin/flex
configure: using flex 2.6.4
checking for perl... /usr/bin/perl
configure: using perl 5.32.1
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... yes
checking whether strerror_r returns int... no
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlsym... none required
checking for library containing socket... none required
checking for library containing getopt_long... none required
checking for library containing shm_open... none required
checking for library containing shm_unlink... none required
checking for library containing clock_gettime... none required
checking for library containing shmget... none required
checking for library containing backtrace_symbols... none required
checking for library containing pthread_barrier_wait... none required
checking for library containing readline... -lreadline
checking for inflate in -lz... yes
checking atomic.h usability... no
checking atomic.h presence... no
checking for atomic.h... no
checking copyfile.h usability... no
checking copyfile.h presence... no
checking for copyfile.h... no
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking ifaddrs.h usability... yes
checking ifaddrs.h presence... yes
checking for ifaddrs.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking mbarrier.h usability... no
checking mbarrier.h presence... no
checking for mbarrier.h... no
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking sys/event.h usability... no
checking sys/event.h presence... no
checking for sys/event.h... no
checking sys/personality.h usability... yes
checking sys/personality.h presence... yes
checking for sys/personality.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking sys/procctl.h usability... no
checking sys/procctl.h presence... no
checking for sys/procctl.h... no
checking sys/signalfd.h usability... yes
checking sys/signalfd.h presence... yes
checking for sys/signalfd.h... yes
checking sys/ucred.h usability... no
checking sys/ucred.h presence... no
checking for sys/ucred.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking ucred.h usability... no
checking ucred.h presence... no
checking for ucred.h... no
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for lz4... no
checking for zstd... no
checking for openssl... /usr/bin/openssl
configure: using openssl: OpenSSL 3.5.1 1 Jul 2025 (Library: OpenSSL 3.5.1 1 Jul 2025)
checking whether byte ordering is bigendian... no
checking for inline... inline
checking for printf format archetype... gnu_printf
checking for _Static_assert... yes
checking for typeof... typeof
checking for __builtin_types_compatible_p... yes
checking for __builtin_constant_p... yes
checking for __builtin_unreachable... yes
checking for computed goto support... yes
checking for struct tm.tm_zone... yes
checking for union semun... no
checking for socklen_t... yes
checking for struct sockaddr.sa_len... no
checking for locale_t... yes
checking for C/C++ restrict keyword... __restrict
checking for struct option... yes
checking whether assembler supports x86_64 popcntq... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of off_t... 8
checking size of bool... 1
checking for int timezone... yes
checking for wcstombs_l declaration... no
checking for backtrace_symbols... yes
checking for copyfile... no
checking for copy_file_range... yes
checking for getifaddrs... yes
checking for getpeerucred... no
checking for inet_pton... yes
checking for kqueue... no
checking for mbstowcs_l... no
checking for memset_s... no
checking for posix_fallocate... yes
checking for ppoll... yes
checking for pthread_is_threaded_np... no
checking for setproctitle... no
checking for setproctitle_fast... no
checking for strchrnul... yes
checking for strsignal... yes
checking for syncfs... yes
checking for sync_file_range... yes
checking for uselocale... yes
checking for wcstombs_l... no
checking for __builtin_bswap16... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for __builtin_clz... yes
checking for __builtin_ctz... yes
checking for __builtin_popcount... yes
checking for __builtin_frame_address... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking how gcc reports undeclared, standard C functions... error
checking for posix_fadvise... yes
checking whether posix_fadvise is declared... yes
checking whether fdatasync is declared... yes
checking whether strlcat is declared... no
checking whether strlcpy is declared... no
checking whether strnlen is declared... yes
checking whether preadv is declared... yes
checking whether pwritev is declared... yes
checking whether F_FULLFSYNC is declared... no
checking for explicit_bzero... yes
checking for getopt... yes
checking for getpeereid... no
checking for inet_aton... yes
checking for mkdtemp... yes
checking for strlcat... no
checking for strlcpy... no
checking for strnlen... yes
checking for pthread_barrier_wait... yes
checking for getopt_long... yes
checking for syslog... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for opterr... yes
checking for optreset... no
checking unicode/ucol.h usability... yes
checking unicode/ucol.h presence... yes
checking for unicode/ucol.h... yes
checking for rl_completion_suppress_quote... yes
checking for rl_filename_quote_characters... yes
checking for rl_filename_quoting_function... yes
checking for append_history... yes
checking for history_truncate_file... yes
checking for rl_completion_matches... yes
checking for rl_filename_completion_function... yes
checking for rl_reset_screen_size... yes
checking for rl_variable_bind... yes
checking test program... ok
checking whether long int is 64 bits... yes
checking for __builtin_mul_overflow... yes
checking size of void *... 8
checking size of size_t... 8
checking size of long... 8
checking alignment of short... 2
checking alignment of int... 4
checking alignment of long... 8
checking alignment of double... 8
checking for int8... no
checking for uint8... no
checking for int64... no
checking for uint64... no
checking for __int128... yes
checking for __int128 alignment bug... ok
checking alignment of PG_INT128_TYPE... 16
checking for builtin __sync char locking functions... yes
checking for builtin __sync int32 locking functions... yes
checking for builtin __sync int32 atomic operations... yes
checking for builtin __sync int64 atomic operations... yes
checking for builtin __atomic int32 atomic operations... yes
checking for builtin __atomic int64 atomic operations... yes
checking for __get_cpuid... yes
checking for __get_cpuid_count... yes
checking for __cpuid... no
checking for __cpuidex... no
checking for _xgetbv with CFLAGS=... no
checking for _xgetbv with CFLAGS=-mxsave... yes
checking for _mm512_popcnt_epi64 with CFLAGS=... no
checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw... yes
checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... yes
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc+simd... no
checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=-march=armv8-a+crc... no
checking for __builtin_loongarch_crcc_w_b_w, __builtin_loongarch_crcc_w_h_w, __builtin_loongarch_crcc_w_w_w and __builtin_loongarch_crcc_w_d_w... no
checking which CRC-32C implementation to use... SSE 4.2
checking for library containing sem_init... none required
checking which semaphore API to use... unnamed POSIX
checking which random number source to use... /dev/urandom
checking for /dev/urandom... yes
checking for xmllint... /usr/bin/xmllint
checking for xsltproc... /usr/bin/xsltproc
checking for fop... no
checking for dbtoepub... no
checking whether gcc supports -Wl,--as-needed, for LDFLAGS... yes
checking whether gcc supports -Wl,--export-dynamic, for LDFLAGS_EX_BE... yes
configure: using compiler=gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-11.0.2)
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
[root@pgdb01 postgresql-17.4]#

7. Compile Source

A Makefile is a special text configuration file used by the make build automation tool to automatically compile and link C programs. Instead of manually typing long gcc compilation commands every time you modify your code, a Makefile lets you build your entire project by simply typing make into your terminal. make compiles source code into executable binary files, while make install copies those compiled files into your system directories so the program can be run from anywhere.
[root@pgdb01 postgresql-17.4]# which make
/usr/bin/make
[root@pgdb01 postgresql-17.4]#
[root@pgdb01 postgresql-17.4]# ls -ltr Makefile
-rw-rw-r--. 1 root root 1822 Feb 18  2025 Makefile
[root@pgdb01 postgresql-17.4]#

[root@pgdb01 postgresql-17.4]# make
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
'/usr/bin/perl' ../../../src/backend/catalog/genbki.pl --include-path=../../../src/include/ \
        --set-version=17 ../../../src/include/catalog/pg_proc.h ../../../src/include/catalog/pg_type.h ../../../src/include/catalog/pg_attribute.h ../../../src/include/catalog/pg_class.h ../../../src/include/catalog/pg_attrdef.h ../../../src/include/catalog/pg_constraint.h ../../../src/include/catalog/pg_inherits.h ../../../src/include/catalog/pg_index.h ../../../src/include/catalog/pg_operator.h ../../../src/include/catalog/pg_opfamily.h ../../../src/include/catalog/pg_opclass.h ../../../src/include/catalog/pg_am.h ../../../src/include/catalog/pg_amop.h ../../../src/include/catalog/pg_amproc.h ../../../src/include/catalog/pg_language.h ../../../src/include/catalog/pg_largeobject_metadata.h ../../../src/include/catalog/pg_largeobject.h ../../../src/include/catalog/pg_aggregate.h ../../../src/include/catalog/pg_statistic.h ../../../src/include/catalog/pg_statistic_ext.h ../../../src/include/catalog/pg_statistic_ext_data.h ../../../src/include/catalog/pg_rewrite.h ../../../src/include/catalog/pg_trigger.h ../../../src/include/catalog/pg_event_trigger.h ../../../src/include/catalog/pg_description.h ../../../src/include/catalog/pg_cast.h ../../../src/include/catalog/pg_enum.h ../../../src/include/catalog/pg_namespace.h ../../../src/include/catalog/pg_conversion.h ../../../src/include/catalog/pg_depend.h ../../../src/include/catalog/pg_database.h ../../../src/include/catalog/pg_db_role_setting.h ../../../src/include/catalog/pg_tablespace.h ../../../src/include/catalog/pg_authid.h ../../../src/include/catalog/pg_auth_members.h ../../../src/include/catalog/pg_shdepend.h ../../../src/include/catalog/pg_shdescription.h ../../../src/include/catalog/pg_ts_config.h ../../../src/include/catalog/pg_ts_config_map.h ../../../src/include/catalog/pg_ts_dict.h ../../../src/include/catalog/pg_ts_parser.h ../../../src/include/catalog/pg_ts_template.h ../../../src/include/catalog/pg_extension.h ../../../src/include/catalog/pg_foreign_data_wrapper.h ../../../src/include/catalog/pg_foreign_server.h ../../../src/include/catalog/pg_user_mapping.h ../../../src/include/catalog/pg_foreign_table.h ../../../src/include/catalog/pg_policy.h ../../../src/include/catalog/pg_replication_origin.h ../../../src/include/catalog/pg_default_acl.h ../../../src/include/catalog/pg_init_privs.h ../../../src/include/catalog/pg_seclabel.h ../../../src/include/catalog/pg_shseclabel.h ../../../src/include/catalog/pg_collation.h ../../../src/include/catalog/pg_parameter_acl.h ../../../src/include/catalog/pg_partitioned_table.h ../../../src/include/catalog/pg_range.h ../../../src/include/catalog/pg_transform.h ../../../src/include/catalog/pg_sequence.h ../../../src/include/catalog/pg_publication.h ../../../src/include/catalog/pg_publication_namespace.h ../../../src/include/catalog/pg_publication_rel.h ../../../src/include/catalog/pg_subscription.h ../../../src/include/catalog/pg_subscription_rel.h
Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ../../../src/backend/catalog/genbki.pl line 20.
BEGIN failed--compilation aborted at ../../../src/backend/catalog/genbki.pl line 20.
make[2]: *** [Makefile:141: bki-stamp] Error 2
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
make[1]: *** [Makefile:121: submake-catalog-headers] Error 2
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make: *** [src/Makefile.global:384: submake-generated-headers] Error 2
[root@pgdb01 postgresql-17.4]#

*** The FindBin module is a core Perl library used to locate the absolute directory path of the currently executing script. It is primarily used in conjunction with the lib module to dynamically load local, relative modules without hardcoding paths. ****

[root@pgdb01 postgresql-17.4]# dnf install -y perl perl-core perl-ExtUtils-MakeMaker
Last metadata expiration check: 1:17:45 ago on Tue 21 Apr 2026 07:35:12 PM.
Dependencies resolved.
==============================================================================================================================================================================================================
 Package                                                    Architecture                         Version                                                Repository                                       Size
==============================================================================================================================================================================================================
Installing:
 perl                                                       x86_64                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                    11 k
 perl-ExtUtils-MakeMaker                                    noarch                               2:7.60-3.el9                                           ol9_appstream                                   352 k
Upgrading:
 libstdc++                                                  x86_64                               11.5.0-11.0.2.el9                                      ol9_baseos_latest                               757 k
 perl-Errno                                                 x86_64                               1.30-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-interpreter                                           x86_64                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                    76 k
 perl-libs                                                  x86_64                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                   2.7 M
Installing dependencies:
 annobin                                                    x86_64                               12.92-1.el9                                            ol9_appstream                                   1.1 M
 dwz                                                        x86_64                               0.16-1.el9                                             ol9_appstream                                   139 k
 efi-srpm-macros                                            noarch                               6-4.0.1.el9                                            ol9_appstream                                    26 k
 fonts-srpm-macros                                          noarch                               1:2.0.5-7.el9.1                                        ol9_appstream                                    32 k
 gcc-c++                                                    x86_64                               11.5.0-11.0.2.el9                                      ol9_appstream                                    13 M
 gcc-plugin-annobin                                         x86_64                               11.5.0-11.0.2.el9                                      ol9_appstream                                    38 k
 ghc-srpm-macros                                            noarch                               1.5.0-6.el9                                            ol9_appstream                                   8.7 k
 go-srpm-macros                                             noarch                               3.6.0-14.el9_7                                         ol9_appstream                                    31 k
 kernel-srpm-macros                                         noarch                               1.0-14.0.1.el9                                         ol9_appstream                                    20 k
 libstdc++-devel                                            x86_64                               11.5.0-11.0.2.el9                                      ol9_appstream                                   3.1 M
 lua-srpm-macros                                            noarch                               1-6.el9                                                ol9_appstream                                   9.4 k
 ocaml-srpm-macros                                          noarch                               6-6.el9                                                ol9_appstream                                   8.7 k
 openblas-srpm-macros                                       noarch                               2-11.el9                                               ol9_appstream                                   8.3 k
 perl-Algorithm-Diff                                        noarch                               1.2010-4.el9                                           ol9_appstream                                    58 k
 perl-Archive-Tar                                           noarch                               2.38-6.el9                                             ol9_appstream                                    85 k
 perl-Archive-Zip                                           noarch                               1.68-6.el9                                             ol9_appstream                                   144 k
 perl-Attribute-Handlers                                    noarch                               1.01-481.1.el9_6                                       ol9_appstream                                    26 k
 perl-AutoSplit                                             noarch                               5.74-481.1.el9_6                                       ol9_appstream                                    20 k
 perl-Benchmark                                             noarch                               1.23-481.1.el9_6                                       ol9_appstream                                    25 k
 perl-CPAN                                                  noarch                               2.29-5.el9_6                                           ol9_appstream                                   630 k
 perl-CPAN-Meta                                             noarch                               2.150010-460.el9                                       ol9_appstream                                   292 k
 perl-CPAN-Meta-Requirements                                noarch                               2.140-461.el9                                          ol9_appstream                                    38 k
 perl-CPAN-Meta-YAML                                        noarch                               0.018-461.el9                                          ol9_appstream                                    31 k
 perl-Compress-Bzip2                                        x86_64                               2.28-5.el9                                             ol9_appstream                                    78 k
 perl-Compress-Raw-Bzip2                                    x86_64                               2.101-5.el9                                            ol9_appstream                                    40 k
 perl-Compress-Raw-Lzma                                     x86_64                               2.101-3.el9                                            ol9_appstream                                    57 k
 perl-Compress-Raw-Zlib                                     x86_64                               2.101-5.el9                                            ol9_appstream                                    66 k
 perl-Config-Extensions                                     noarch                               0.03-481.1.el9_6                                       ol9_appstream                                    11 k
 perl-Config-Perl-V                                         noarch                               0.33-4.el9                                             ol9_appstream                                    28 k
 perl-DBM_Filter                                            noarch                               0.06-481.1.el9_6                                       ol9_appstream                                    43 k
 perl-DB_File                                               x86_64                               1.855-4.el9                                            ol9_appstream                                    87 k
 perl-Data-OptList                                          noarch                               0.110-17.el9                                           ol9_appstream                                    36 k
 perl-Data-Section                                          noarch                               0.200007-14.el9                                        ol9_appstream                                    30 k
 perl-Devel-PPPort                                          x86_64                               3.62-4.el9                                             ol9_appstream                                   220 k
 perl-Devel-Peek                                            x86_64                               1.28-481.1.el9_6                                       ol9_appstream                                    30 k
 perl-Devel-SelfStubber                                     noarch                               1.06-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-Devel-Size                                            x86_64                               0.83-10.el9                                            ol9_appstream                                    32 k
 perl-Digest-SHA                                            x86_64                               1:6.02-461.el9                                         ol9_appstream                                    70 k
 perl-Digest-SHA1                                           x86_64                               2.13-34.el9                                            ol9_appstream                                    60 k
 perl-DirHandle                                             noarch                               1.05-481.1.el9_6                                       ol9_appstream                                    11 k
 perl-Dumpvalue                                             noarch                               2.27-481.1.el9_6                                       ol9_appstream                                    17 k
 perl-Encode-devel                                          x86_64                               4:3.08-462.el9                                         ol9_appstream                                    51 k
 perl-English                                               noarch                               1.11-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-Env                                                   noarch                               1.04-460.el9                                           ol9_appstream                                    25 k
 perl-ExtUtils-CBuilder                                     noarch                               1:0.280236-4.el9                                       ol9_appstream                                    69 k
 perl-ExtUtils-Command                                      noarch                               2:7.60-3.el9                                           ol9_appstream                                    15 k
 perl-ExtUtils-Constant                                     noarch                               0.25-481.1.el9_6                                       ol9_appstream                                    55 k
 perl-ExtUtils-Embed                                        noarch                               1.35-481.1.el9_6                                       ol9_appstream                                    16 k
 perl-ExtUtils-Install                                      noarch                               2.20-4.el9                                             ol9_appstream                                    53 k
 perl-ExtUtils-MM-Utils                                     noarch                               2:7.60-3.el9                                           ol9_appstream                                    13 k
 perl-ExtUtils-Manifest                                     noarch                               1:1.73-4.el9                                           ol9_appstream                                    40 k
 perl-ExtUtils-Miniperl                                     noarch                               1.09-481.1.el9_6                                       ol9_appstream                                    14 k
 perl-ExtUtils-ParseXS                                      noarch                               1:3.40-460.el9                                         ol9_appstream                                   212 k
 perl-File-Compare                                          noarch                               1.100.600-481.1.el9_6                                  ol9_appstream                                    12 k
 perl-File-Copy                                             noarch                               2.34-481.1.el9_6                                       ol9_appstream                                    19 k
 perl-File-DosGlob                                          x86_64                               1.12-481.1.el9_6                                       ol9_appstream                                    18 k
 perl-File-Fetch                                            noarch                               1.00-4.el9                                             ol9_appstream                                    31 k
 perl-File-HomeDir                                          noarch                               1.006-4.el9                                            ol9_appstream                                    81 k
 perl-File-Which                                            noarch                               1.23-10.el9                                            ol9_appstream                                    22 k
 perl-FileCache                                             noarch                               1.10-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-Filter                                                x86_64                               2:1.60-4.el9                                           ol9_appstream                                   121 k
 perl-Filter-Simple                                         noarch                               0.96-460.el9                                           ol9_appstream                                    28 k
 perl-FindBin                                               noarch                               1.51-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-GDBM_File                                             x86_64                               1.18-481.1.el9_6                                       ol9_appstream                                    21 k
 perl-Hash-Util                                             x86_64                               0.23-481.1.el9_6                                       ol9_appstream                                    33 k
 perl-Hash-Util-FieldHash                                   x86_64                               1.20-481.1.el9_6                                       ol9_appstream                                    36 k
 perl-I18N-Collate                                          noarch                               1.02-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-I18N-LangTags                                         noarch                               0.44-481.1.el9_6                                       ol9_appstream                                    59 k
 perl-I18N-Langinfo                                         x86_64                               0.19-481.1.el9_6                                       ol9_appstream                                    21 k
 perl-IO-Compress                                           noarch                               2.102-4.el9                                            ol9_appstream                                   321 k
 perl-IO-Compress-Lzma                                      noarch                               2.101-4.el9                                            ol9_appstream                                   101 k
 perl-IO-Zlib                                               noarch                               1:1.11-4.el9                                           ol9_appstream                                    20 k
 perl-IPC-Cmd                                               noarch                               2:1.04-461.el9                                         ol9_appstream                                    40 k
 perl-IPC-SysV                                              x86_64                               2.09-4.el9                                             ol9_appstream                                    55 k
 perl-IPC-System-Simple                                     noarch                               1.30-6.el9                                             ol9_appstream                                    46 k
 perl-Importer                                              noarch                               0.026-4.el9                                            ol9_appstream                                    45 k
 perl-JSON-PP                                               noarch                               1:4.06-4.el9                                           ol9_appstream                                    74 k
 perl-Locale-Maketext                                       noarch                               1.29-461.el9                                           ol9_appstream                                   108 k
 perl-Locale-Maketext-Simple                                noarch                               1:0.21-481.1.el9_6                                     ol9_appstream                                    16 k
 perl-MIME-Charset                                          noarch                               1.012.2-15.el9                                         ol9_appstream                                    60 k
 perl-MRO-Compat                                            noarch                               0.13-15.el9                                            ol9_appstream                                    27 k
 perl-Math-BigInt-FastCalc                                  x86_64                               0.500.900-460.el9                                      ol9_appstream                                    35 k
 perl-Math-BigRat                                           noarch                               0.2614-460.el9                                         ol9_appstream                                    46 k
 perl-Memoize                                               noarch                               1.03-481.1.el9_6                                       ol9_appstream                                    72 k
 perl-Module-Build                                          noarch                               2:0.42.31-9.el9                                        ol9_appstream                                   305 k
 perl-Module-CoreList                                       noarch                               1:5.20240609-1.el9                                     ol9_appstream                                    95 k
 perl-Module-CoreList-tools                                 noarch                               1:5.20240609-1.el9                                     ol9_appstream                                    16 k
 perl-Module-Load                                           noarch                               1:0.36-4.el9                                           ol9_appstream                                    18 k
 perl-Module-Load-Conditional                               noarch                               0.74-4.el9                                             ol9_appstream                                    23 k
 perl-Module-Loaded                                         noarch                               1:0.08-481.1.el9_6                                     ol9_appstream                                    12 k
 perl-Module-Metadata                                       noarch                               1.000037-460.el9                                       ol9_appstream                                    42 k
 perl-Module-Signature                                      noarch                               0.88-1.el9                                             ol9_appstream                                    95 k
 perl-NEXT                                                  noarch                               0.67-481.1.el9_6                                       ol9_appstream                                    19 k
 perl-Net                                                   noarch                               1.02-481.1.el9_6                                       ol9_appstream                                    33 k
 perl-Net-Ping                                              noarch                               2.74-5.el9                                             ol9_appstream                                    55 k
 perl-ODBM_File                                             x86_64                               1.16-481.1.el9_6                                       ol9_appstream                                    21 k
 perl-Object-HashBase                                       noarch                               0.009-7.el9                                            ol9_appstream                                    31 k
 perl-Opcode                                                x86_64                               1.48-481.1.el9_6                                       ol9_appstream                                    40 k
 perl-Package-Generator                                     noarch                               1.106-23.el9                                           ol9_appstream                                    31 k
 perl-Params-Check                                          noarch                               1:0.38-461.el9                                         ol9_appstream                                    23 k
 perl-Params-Util                                           x86_64                               1.102-5.el9                                            ol9_appstream                                    41 k
 perl-Perl-OSType                                           noarch                               1.010-461.el9                                          ol9_appstream                                    29 k
 perl-PerlIO-via-QuotedPrint                                noarch                               0.09-4.el9                                             ol9_appstream                                    29 k
 perl-Pod-Checker                                           noarch                               4:1.74-4.el9                                           ol9_appstream                                    38 k
 perl-Pod-Functions                                         noarch                               1.13-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-Pod-Html                                              noarch                               1.25-481.1.el9_6                                       ol9_appstream                                    31 k
 perl-Safe                                                  noarch                               2.41-481.1.el9_6                                       ol9_appstream                                    23 k
 perl-Search-Dict                                           noarch                               1.07-481.1.el9_6                                       ol9_appstream                                    11 k
 perl-SelfLoader                                            noarch                               1.26-481.1.el9_6                                       ol9_appstream                                    20 k
 perl-Software-License                                      noarch                               0.103014-12.el9                                        ol9_appstream                                   196 k
 perl-Sub-Exporter                                          noarch                               0.987-27.el9                                           ol9_appstream                                   103 k
 perl-Sub-Install                                           noarch                               0.928-28.el9                                           ol9_appstream                                    28 k
 perl-Sys-Hostname                                          x86_64                               1.23-481.1.el9_6                                       ol9_appstream                                    15 k
 perl-Sys-Syslog                                            x86_64                               0.36-461.el9                                           ol9_appstream                                    54 k
 perl-Term-Complete                                         noarch                               1.403-481.1.el9_6                                      ol9_appstream                                    11 k
 perl-Term-ReadLine                                         noarch                               1.17-481.1.el9_6                                       ol9_appstream                                    17 k
 perl-Term-Size-Perl                                        x86_64                               0.031-12.el9                                           ol9_appstream                                    28 k
 perl-Term-Table                                            noarch                               0.015-8.el9                                            ol9_appstream                                    50 k
 perl-Test                                                  noarch                               1.31-481.1.el9_6                                       ol9_appstream                                    27 k
 perl-Test-Harness                                          noarch                               1:3.42-461.el9                                         ol9_appstream                                   387 k
 perl-Test-Simple                                           noarch                               3:1.302183-4.el9                                       ol9_appstream                                   949 k
 perl-Text-Abbrev                                           noarch                               1.02-481.1.el9_6                                       ol9_appstream                                    11 k
 perl-Text-Balanced                                         noarch                               2.04-4.el9                                             ol9_appstream                                    53 k
 perl-Text-Diff                                             noarch                               1.45-13.el9                                            ol9_appstream                                    50 k
 perl-Text-Glob                                             noarch                               0.11-15.el9                                            ol9_appstream                                    14 k
 perl-Text-Template                                         noarch                               1.59-5.el9                                             ol9_appstream                                    66 k
 perl-Thread                                                noarch                               3.05-481.1.el9_6                                       ol9_appstream                                    16 k
 perl-Thread-Queue                                          noarch                               3.14-460.el9                                           ol9_appstream                                    28 k
 perl-Thread-Semaphore                                      noarch                               2.13-481.1.el9_6                                       ol9_appstream                                    14 k
 perl-Tie                                                   noarch                               4.6-481.1.el9_6                                        ol9_appstream                                    41 k
 perl-Tie-File                                              noarch                               1.06-481.1.el9_6                                       ol9_appstream                                    42 k
 perl-Tie-Memoize                                           noarch                               1.1-481.1.el9_6                                        ol9_appstream                                    13 k
 perl-Tie-RefHash                                           noarch                               1.40-4.el9                                             ol9_appstream                                    29 k
 perl-Time                                                  noarch                               1.03-481.1.el9_6                                       ol9_appstream                                    24 k
 perl-Time-HiRes                                            x86_64                               4:1.9764-462.el9                                       ol9_appstream                                    64 k
 perl-Time-Piece                                            x86_64                               1.3401-481.1.el9_6                                     ol9_appstream                                    45 k
 perl-Unicode-Collate                                       x86_64                               1.29-4.el9                                             ol9_appstream                                   849 k
 perl-Unicode-Normalize                                     x86_64                               1.27-461.el9                                           ol9_appstream                                    96 k
 perl-Unicode-UCD                                           noarch                               0.75-481.1.el9_6                                       ol9_appstream                                    77 k
 perl-User-pwent                                            noarch                               1.03-481.1.el9_6                                       ol9_appstream                                    24 k
 perl-autodie                                               noarch                               2.34-4.el9                                             ol9_appstream                                   117 k
 perl-autouse                                               noarch                               1.11-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-bignum                                                noarch                               0.51-460.el9                                           ol9_appstream                                    56 k
 perl-blib                                                  noarch                               1.07-481.1.el9_6                                       ol9_appstream                                    11 k
 perl-debugger                                              noarch                               1.56-481.1.el9_6                                       ol9_appstream                                   139 k
 perl-deprecate                                             noarch                               0.04-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-devel                                                 x86_64                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                   748 k
 perl-diagnostics                                           noarch                               1.37-481.1.el9_6                                       ol9_appstream                                   216 k
 perl-doc                                                   noarch                               5.32.1-481.1.el9_6                                     ol9_appstream                                   4.9 M
 perl-encoding                                              x86_64                               4:3.00-462.el9                                         ol9_appstream                                    68 k
 perl-encoding-warnings                                     noarch                               0.13-481.1.el9_6                                       ol9_appstream                                    15 k
 perl-experimental                                          noarch                               0.022-6.el9                                            ol9_appstream                                    27 k
 perl-fields                                                noarch                               2.27-481.1.el9_6                                       ol9_appstream                                    15 k
 perl-filetest                                              noarch                               1.03-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-inc-latest                                            noarch                               2:0.500-20.el9                                         ol9_appstream                                    31 k
 perl-less                                                  noarch                               0.03-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-lib                                                   x86_64                               0.65-481.1.el9_6                                       ol9_appstream                                    13 k
 perl-libnetcfg                                             noarch                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                    15 k
 perl-local-lib                                             noarch                               2.000024-13.el9                                        ol9_appstream                                    76 k
 perl-macros                                                noarch                               4:5.32.1-481.1.el9_6                                   ol9_appstream                                   9.2 k
 perl-meta-notation                                         noarch                               5.32.1-481.1.el9_6                                     ol9_appstream                                   8.2 k
 perl-open                                                  noarch                               1.12-481.1.el9_6                                       ol9_appstream                                    15 k
 perl-perlfaq                                               noarch                               5.20210520-1.el9                                       ol9_appstream                                   399 k
 perl-ph                                                    x86_64                               5.32.1-481.1.el9_6                                     ol9_appstream                                    67 k
 perl-sigtrap                                               noarch                               1.09-481.1.el9_6                                       ol9_appstream                                    14 k
 perl-sort                                                  noarch                               2.04-481.1.el9_6                                       ol9_appstream                                    12 k
 perl-srpm-macros                                           noarch                               1-41.el9                                               ol9_appstream                                   9.1 k
 perl-threads                                               x86_64                               1:2.25-460.el9                                         ol9_appstream                                    65 k
 perl-threads-shared                                        x86_64                               1.61-460.el9                                           ol9_appstream                                    50 k
 perl-utils                                                 noarch                               5.32.1-481.1.el9_6                                     ol9_appstream                                    64 k
 perl-version                                               x86_64                               7:0.99.28-4.el9                                        ol9_appstream                                    74 k
 perl-vmsish                                                noarch                               1.04-481.1.el9_6                                       ol9_appstream                                    13 k
 pyproject-srpm-macros                                      noarch                               1.16.2-1.el9                                           ol9_appstream                                    13 k
 python-srpm-macros                                         noarch                               3.9-54.el9                                             ol9_appstream                                    16 k
 qt5-srpm-macros                                            noarch                               5.15.9-1.el9                                           ol9_appstream                                   7.7 k
 redhat-rpm-config                                          noarch                               210-1.0.1.el9                                          ol9_appstream                                   101 k
 rust-srpm-macros                                           noarch                               17-4.el9                                               ol9_appstream                                    10 k
 sombok                                                     x86_64                               2.4.0-16.el9                                           ol9_appstream                                    55 k
 systemtap-sdt-devel                                        x86_64                               5.3-3.0.1.el9                                          ol9_appstream                                    76 k
 systemtap-sdt-dtrace                                       x86_64                               5.3-3.0.1.el9                                          ol9_appstream                                    75 k
Installing weak dependencies:
 perl-CPAN-DistnameInfo                                     noarch                               0.12-23.el9                                            ol9_appstream                                    15 k
 perl-Encode-Locale                                         noarch                               1.05-21.el9                                            ol9_appstream                                    20 k
 perl-Term-Size-Any                                         noarch                               0.002-35.el9                                           ol9_appstream                                    19 k
 perl-TermReadKey                                           x86_64                               2.38-11.el9                                            ol9_appstream                                    42 k
 perl-Unicode-LineBreak                                     x86_64                               2019.001-11.el9                                        ol9_appstream                                   144 k

Transaction Summary
==============================================================================================================================================================================================================
Install  187 Packages
Upgrade    4 Packages

Total download size: 38 M
Downloading Packages:
(1/191): annobin-12.92-1.el9.x86_64.rpm                                                      2.9 MB/s | 1.1 MB     00:00
(2/191): fonts-srpm-macros-2.0.5-7.el9.1.noarch.rpm                                          849 kB/s |  32 kB     00:00
(3/191): efi-srpm-macros-6-4.0.1.el9.noarch.rpm                                               21 kB/s |  26 kB     00:01
(4/191): gcc-plugin-annobin-11.5.0-11.0.2.el9.x86_64.rpm                                     535 kB/s |  38 kB     00:00
(5/191): ghc-srpm-macros-1.5.0-6.el9.noarch.rpm                                              149 kB/s | 8.7 kB     00:00
(6/191): go-srpm-macros-3.6.0-14.el9_7.noarch.rpm                                            332 kB/s |  31 kB     00:00
(7/191): gcc-c++-11.5.0-11.0.2.el9.x86_64.rpm                                                9.7 MB/s |  13 MB     00:01
(8/191): libstdc++-devel-11.5.0-11.0.2.el9.x86_64.rpm                                        9.0 MB/s | 3.1 MB     00:00
(9/191): lua-srpm-macros-1-6.el9.noarch.rpm                                                  268 kB/s | 9.4 kB     00:00
(10/191): kernel-srpm-macros-1.0-14.0.1.el9.noarch.rpm                                        10 kB/s |  20 kB     00:01
(11/191): ocaml-srpm-macros-6-6.el9.noarch.rpm                                               4.7 kB/s | 8.7 kB     00:01
(12/191): perl-5.32.1-481.1.el9_6.x86_64.rpm                                                 316 kB/s |  11 kB     00:00
(13/191): perl-Algorithm-Diff-1.2010-4.el9.noarch.rpm                                                                                                                         229 kB/s |  58 kB     00:00
(14/191): perl-Archive-Tar-2.38-6.el9.noarch.rpm                                                                                                                              878 kB/s |  85 kB     00:00
(15/191): perl-Archive-Zip-1.68-6.el9.noarch.rpm                                                                                                                              2.3 MB/s | 144 kB     00:00
(16/191): perl-Attribute-Handlers-1.01-481.1.el9_6.noarch.rpm                                                                                                                 277 kB/s |  26 kB     00:00
(17/191): perl-AutoSplit-5.74-481.1.el9_6.noarch.rpm                                                                                                                          219 kB/s |  20 kB     00:00
(18/191): openblas-srpm-macros-2-11.el9.noarch.rpm                                                                                                                            4.4 kB/s | 8.3 kB     00:01
(19/191): perl-CPAN-2.29-5.el9_6.noarch.rpm                                                                                                                                   3.2 MB/s | 630 kB     00:00
(20/191): perl-Benchmark-1.23-481.1.el9_6.noarch.rpm                                                                                                                           13 kB/s |  25 kB     00:01
(21/191): dwz-0.16-1.el9.x86_64.rpm                                                                                                                                            21 kB/s | 139 kB     00:06
(22/191): perl-CPAN-Meta-Requirements-2.140-461.el9.noarch.rpm                                                                                                                370 kB/s |  38 kB     00:00
(23/191): perl-CPAN-Meta-YAML-0.018-461.el9.noarch.rpm                                                                                                                        326 kB/s |  31 kB     00:00
(24/191): perl-CPAN-Meta-2.150010-460.el9.noarch.rpm                                                                                                                          1.1 MB/s | 292 kB     00:00
(25/191): perl-Compress-Raw-Bzip2-2.101-5.el9.x86_64.rpm                                                                                                                      448 kB/s |  40 kB     00:00
(26/191): perl-Compress-Bzip2-2.28-5.el9.x86_64.rpm                                                                                                                           512 kB/s |  78 kB     00:00
(27/191): perl-Compress-Raw-Lzma-2.101-3.el9.x86_64.rpm                                                                                                                       1.2 MB/s |  57 kB     00:00
(28/191): perl-Config-Extensions-0.03-481.1.el9_6.noarch.rpm                                                                                                                  303 kB/s |  11 kB     00:00
(29/191): perl-Compress-Raw-Zlib-2.101-5.el9.x86_64.rpm                                                                                                                       604 kB/s |  66 kB     00:00
(30/191): perl-Config-Perl-V-0.33-4.el9.noarch.rpm                                                                                                                            275 kB/s |  28 kB     00:00
(31/191): perl-DB_File-1.855-4.el9.x86_64.rpm                                                                                                                                 1.5 MB/s |  87 kB     00:00
(32/191): perl-DBM_Filter-0.06-481.1.el9_6.noarch.rpm                                                                                                                         374 kB/s |  43 kB     00:00
(33/191): perl-Data-Section-0.200007-14.el9.noarch.rpm                                                                                                                        714 kB/s |  30 kB     00:00
(34/191): perl-Devel-PPPort-3.62-4.el9.x86_64.rpm                                                                                                                             3.1 MB/s | 220 kB     00:00
(35/191): perl-CPAN-DistnameInfo-0.12-23.el9.noarch.rpm                                                                                                                       8.0 kB/s |  15 kB     00:01
(36/191): perl-Devel-SelfStubber-1.06-481.1.el9_6.noarch.rpm                                                                                                                  336 kB/s |  13 kB     00:00
(37/191): perl-Devel-Size-0.83-10.el9.x86_64.rpm                                                                                                                              814 kB/s |  32 kB     00:00
(38/191): perl-Devel-Peek-1.28-481.1.el9_6.x86_64.rpm                                                                                                                         349 kB/s |  30 kB     00:00
(39/191): perl-Digest-SHA1-2.13-34.el9.x86_64.rpm                                                                                                                             1.3 MB/s |  60 kB     00:00
(40/191): perl-Digest-SHA-6.02-461.el9.x86_64.rpm                                                                                                                             852 kB/s |  70 kB     00:00
(41/191): perl-DirHandle-1.05-481.1.el9_6.noarch.rpm                                                                                                                          269 kB/s |  11 kB     00:00
(42/191): perl-Dumpvalue-2.27-481.1.el9_6.noarch.rpm                                                                                                                          446 kB/s |  17 kB     00:00
(43/191): perl-Encode-Locale-1.05-21.el9.noarch.rpm                                                                                                                           500 kB/s |  20 kB     00:00
(44/191): perl-English-1.11-481.1.el9_6.noarch.rpm                                                                                                                            422 kB/s |  12 kB     00:00
(45/191): perl-Encode-devel-3.08-462.el9.x86_64.rpm                                                                                                                           783 kB/s |  51 kB     00:00
(46/191): perl-Env-1.04-460.el9.noarch.rpm                                                                                                                                    606 kB/s |  25 kB     00:00
(47/191): perl-ExtUtils-CBuilder-0.280236-4.el9.noarch.rpm                                                                                                                    1.5 MB/s |  69 kB     00:00
(48/191): perl-ExtUtils-Command-7.60-3.el9.noarch.rpm                                                                                                                         374 kB/s |  15 kB     00:00
(49/191): perl-ExtUtils-Constant-0.25-481.1.el9_6.noarch.rpm                                                                                                                  1.2 MB/s |  55 kB     00:00
(50/191): perl-ExtUtils-Embed-1.35-481.1.el9_6.noarch.rpm                                                                                                                     433 kB/s |  16 kB     00:00
(51/191): perl-ExtUtils-Install-2.20-4.el9.noarch.rpm                                                                                                                         1.1 MB/s |  53 kB     00:00
(52/191): perl-ExtUtils-MakeMaker-7.60-3.el9.noarch.rpm                                                                                                                       1.7 MB/s | 352 kB     00:00
(53/191): perl-ExtUtils-Manifest-1.73-4.el9.noarch.rpm                                                                                                                        1.0 MB/s |  40 kB     00:00
(54/191): perl-ExtUtils-Miniperl-1.09-481.1.el9_6.noarch.rpm                                                                                                                  373 kB/s |  14 kB     00:00
(55/191): perl-ExtUtils-ParseXS-3.40-460.el9.noarch.rpm                                                                                                                       572 kB/s | 212 kB     00:00
(56/191): perl-File-Compare-1.100.600-481.1.el9_6.noarch.rpm                                                                                                                  139 kB/s |  12 kB     00:00
(57/191): perl-File-Copy-2.34-481.1.el9_6.noarch.rpm                                                                                                                          395 kB/s |  19 kB     00:00
(58/191): perl-File-DosGlob-1.12-481.1.el9_6.x86_64.rpm                                                                                                                       151 kB/s |  18 kB     00:00
(59/191): perl-File-Fetch-1.00-4.el9.noarch.rpm                                                                                                                               730 kB/s |  31 kB     00:00
(60/191): perl-File-HomeDir-1.006-4.el9.noarch.rpm                                                                                                                            1.8 MB/s |  81 kB     00:00
(61/191): perl-Data-OptList-0.110-17.el9.noarch.rpm                                                                                                                            19 kB/s |  36 kB     00:01
(62/191): perl-FileCache-1.10-481.1.el9_6.noarch.rpm                                                                                                                          365 kB/s |  13 kB     00:00
(63/191): perl-Filter-1.60-4.el9.x86_64.rpm                                                                                                                                   2.4 MB/s | 121 kB     00:00
(64/191): perl-Filter-Simple-0.96-460.el9.noarch.rpm                                                                                                                          200 kB/s |  28 kB     00:00
(65/191): perl-FindBin-1.51-481.1.el9_6.noarch.rpm                                                                                                                            111 kB/s |  12 kB     00:00
(66/191): perl-GDBM_File-1.18-481.1.el9_6.x86_64.rpm                                                                                                                          164 kB/s |  21 kB     00:00
(67/191): perl-ExtUtils-MM-Utils-7.60-3.el9.noarch.rpm                                                                                                                        6.9 kB/s |  13 kB     00:01
(68/191): perl-Hash-Util-0.23-481.1.el9_6.x86_64.rpm                                                                                                                          344 kB/s |  33 kB     00:00
(69/191): perl-I18N-Collate-1.02-481.1.el9_6.noarch.rpm                                                                                                                       287 kB/s |  13 kB     00:00
(70/191): perl-Hash-Util-FieldHash-1.20-481.1.el9_6.x86_64.rpm                                                                                                                275 kB/s |  36 kB     00:00
(71/191): perl-I18N-LangTags-0.44-481.1.el9_6.noarch.rpm                                                                                                                      1.3 MB/s |  59 kB     00:00
(72/191): perl-I18N-Langinfo-0.19-481.1.el9_6.x86_64.rpm                                                                                                                      475 kB/s |  21 kB     00:00
(73/191): perl-IO-Compress-Lzma-2.101-4.el9.noarch.rpm                                                                                                                        2.0 MB/s | 101 kB     00:00
(74/191): perl-IO-Zlib-1.11-4.el9.noarch.rpm                                                                                                                                  487 kB/s |  20 kB     00:00
(75/191): perl-IPC-Cmd-1.04-461.el9.noarch.rpm                                                                                                                                895 kB/s |  40 kB     00:00
(76/191): perl-IO-Compress-2.102-4.el9.noarch.rpm                                                                                                                             2.1 MB/s | 321 kB     00:00
(77/191): perl-IPC-SysV-2.09-4.el9.x86_64.rpm                                                                                                                                 625 kB/s |  55 kB     00:00
(78/191): perl-IPC-System-Simple-1.30-6.el9.noarch.rpm                                                                                                                        431 kB/s |  46 kB     00:00
(79/191): perl-Importer-0.026-4.el9.noarch.rpm                                                                                                                                475 kB/s |  45 kB     00:00
(80/191): perl-JSON-PP-4.06-4.el9.noarch.rpm                                                                                                                                  862 kB/s |  74 kB     00:00
(81/191): perl-Locale-Maketext-1.29-461.el9.noarch.rpm                                                                                                                        2.3 MB/s | 108 kB     00:00
(82/191): perl-Locale-Maketext-Simple-0.21-481.1.el9_6.noarch.rpm                                                                                                             237 kB/s |  16 kB     00:00
(83/191): perl-MRO-Compat-0.13-15.el9.noarch.rpm                                                                                                                              701 kB/s |  27 kB     00:00
(84/191): perl-MIME-Charset-1.012.2-15.el9.noarch.rpm                                                                                                                         679 kB/s |  60 kB     00:00
(85/191): perl-Math-BigRat-0.2614-460.el9.noarch.rpm                                                                                                                          743 kB/s |  46 kB     00:00
(86/191): perl-Math-BigInt-FastCalc-0.500.900-460.el9.x86_64.rpm                                                                                                              418 kB/s |  35 kB     00:00
(87/191): perl-Memoize-1.03-481.1.el9_6.noarch.rpm                                                                                                                            2.0 MB/s |  72 kB     00:00
(88/191): perl-Module-CoreList-5.20240609-1.el9.noarch.rpm                                                                                                                    802 kB/s |  95 kB     00:00
(89/191): perl-Module-Build-0.42.31-9.el9.noarch.rpm                                                                                                                          1.8 MB/s | 305 kB     00:00
(90/191): perl-Module-Load-0.36-4.el9.noarch.rpm                                                                                                                              495 kB/s |  18 kB     00:00
(91/191): perl-Module-CoreList-tools-5.20240609-1.el9.noarch.rpm                                                                                                              182 kB/s |  16 kB     00:00
(92/191): perl-Module-Loaded-0.08-481.1.el9_6.noarch.rpm                                                                                                                      305 kB/s |  12 kB     00:00
(93/191): perl-Module-Load-Conditional-0.74-4.el9.noarch.rpm                                                                                                                  229 kB/s |  23 kB     00:00
(94/191): perl-Module-Metadata-1.000037-460.el9.noarch.rpm                                                                                                                    461 kB/s |  42 kB     00:00
(95/191): perl-File-Which-1.23-10.el9.noarch.rpm                                                                                                                               12 kB/s |  22 kB     00:01
(96/191): perl-NEXT-0.67-481.1.el9_6.noarch.rpm                                                                                                                               473 kB/s |  19 kB     00:00
(97/191): perl-Net-1.02-481.1.el9_6.noarch.rpm                                                                                                                                796 kB/s |  33 kB     00:00
(98/191): perl-Module-Signature-0.88-1.el9.noarch.rpm                                                                                                                         706 kB/s |  95 kB     00:00
(99/191): perl-Object-HashBase-0.009-7.el9.noarch.rpm                                                                                                                         787 kB/s |  31 kB     00:00
(100/191): perl-Net-Ping-2.74-5.el9.noarch.rpm                                                                                                                                439 kB/s |  55 kB     00:00
(101/191): perl-ODBM_File-1.16-481.1.el9_6.x86_64.rpm                                                                                                                         175 kB/s |  21 kB     00:00
(102/191): perl-Params-Check-0.38-461.el9.noarch.rpm                                                                                                                          535 kB/s |  23 kB     00:00
(103/191): perl-Opcode-1.48-481.1.el9_6.x86_64.rpm                                                                                                                            353 kB/s |  40 kB     00:00
(104/191): perl-Package-Generator-1.106-23.el9.noarch.rpm                                                                                                                     253 kB/s |  31 kB     00:00
(105/191): perl-Perl-OSType-1.010-461.el9.noarch.rpm                                                                                                                          376 kB/s |  29 kB     00:00
(106/191): perl-Pod-Checker-1.74-4.el9.noarch.rpm                                                                                                                             961 kB/s |  38 kB     00:00
(107/191): perl-PerlIO-via-QuotedPrint-0.09-4.el9.noarch.rpm                                                                                                                  332 kB/s |  29 kB     00:00
(108/191): perl-Pod-Html-1.25-481.1.el9_6.noarch.rpm                                                                                                                          633 kB/s |  31 kB     00:00
(109/191): perl-Pod-Functions-1.13-481.1.el9_6.noarch.rpm                                                                                                                     148 kB/s |  12 kB     00:00
(110/191): perl-Search-Dict-1.07-481.1.el9_6.noarch.rpm                                                                                                                       307 kB/s |  11 kB     00:00
(111/191): perl-Safe-2.41-481.1.el9_6.noarch.rpm                                                                                                                              493 kB/s |  23 kB     00:00
(112/191): perl-SelfLoader-1.26-481.1.el9_6.noarch.rpm                                                                                                                        368 kB/s |  20 kB     00:00
(113/191): perl-Software-License-0.103014-12.el9.noarch.rpm                                                                                                                   2.9 MB/s | 196 kB     00:00
(114/191): perl-Sub-Install-0.928-28.el9.noarch.rpm                                                                                                                           556 kB/s |  28 kB     00:00
(115/191): perl-Sys-Hostname-1.23-481.1.el9_6.x86_64.rpm                                                                                                                      499 kB/s |  15 kB     00:00
(116/191): perl-Sub-Exporter-0.987-27.el9.noarch.rpm                                                                                                                          975 kB/s | 103 kB     00:00
(117/191): perl-Term-Complete-1.403-481.1.el9_6.noarch.rpm                                                                                                                    308 kB/s |  11 kB     00:00
(118/191): perl-Sys-Syslog-0.36-461.el9.x86_64.rpm                                                                                                                            1.0 MB/s |  54 kB     00:00
(119/191): perl-Term-ReadLine-1.17-481.1.el9_6.noarch.rpm                                                                                                                     465 kB/s |  17 kB     00:00
(120/191): perl-Term-Size-Perl-0.031-12.el9.x86_64.rpm                                                                                                                        573 kB/s |  28 kB     00:00
(121/191): perl-Params-Util-1.102-5.el9.x86_64.rpm                                                                                                                             22 kB/s |  41 kB     00:01
(122/191): perl-Term-Size-Any-0.002-35.el9.noarch.rpm                                                                                                                         9.7 kB/s |  19 kB     00:01
(123/191): perl-Test-1.31-481.1.el9_6.noarch.rpm                                                                                                                              702 kB/s |  27 kB     00:00
(124/191): perl-Term-Table-0.015-8.el9.noarch.rpm                                                                                                                              26 kB/s |  50 kB     00:01
(125/191): perl-Test-Harness-3.42-461.el9.noarch.rpm                                                                                                                          4.7 MB/s | 387 kB     00:00
(126/191): perl-Text-Abbrev-1.02-481.1.el9_6.noarch.rpm                                                                                                                       223 kB/s |  11 kB     00:00
(127/191): perl-Text-Balanced-2.04-4.el9.noarch.rpm                                                                                                                           548 kB/s |  53 kB     00:00
(128/191): perl-Test-Simple-1.302183-4.el9.noarch.rpm                                                                                                                         3.6 MB/s | 949 kB     00:00
(129/191): perl-Text-Diff-1.45-13.el9.noarch.rpm                                                                                                                              919 kB/s |  50 kB     00:00
(130/191): perl-Text-Template-1.59-5.el9.noarch.rpm                                                                                                                           1.0 MB/s |  66 kB     00:00
(131/191): perl-Text-Glob-0.11-15.el9.noarch.rpm                                                                                                                              167 kB/s |  14 kB     00:00
(132/191): perl-Thread-3.05-481.1.el9_6.noarch.rpm                                                                                                                            185 kB/s |  16 kB     00:00
(133/191): perl-Thread-Semaphore-2.13-481.1.el9_6.noarch.rpm                                                                                                                  201 kB/s |  14 kB     00:00
(134/191): perl-Tie-4.6-481.1.el9_6.noarch.rpm                                                                                                                                414 kB/s |  41 kB     00:00
(135/191): perl-Tie-File-1.06-481.1.el9_6.noarch.rpm                                                                                                                          903 kB/s |  42 kB     00:00
(136/191): perl-Tie-Memoize-1.1-481.1.el9_6.noarch.rpm                                                                                                                        133 kB/s |  13 kB     00:00
(137/191): perl-Tie-RefHash-1.40-4.el9.noarch.rpm                                                                                                                             737 kB/s |  29 kB     00:00
(138/191): perl-Time-1.03-481.1.el9_6.noarch.rpm                                                                                                                              804 kB/s |  24 kB     00:00
(139/191): perl-Time-HiRes-1.9764-462.el9.x86_64.rpm                                                                                                                          1.9 MB/s |  64 kB     00:00
(140/191): perl-Time-Piece-1.3401-481.1.el9_6.x86_64.rpm                                                                                                                      796 kB/s |  45 kB     00:00
(141/191): perl-Unicode-Collate-1.29-4.el9.x86_64.rpm                                                                                                                         6.8 MB/s | 849 kB     00:00
(142/191): perl-Unicode-LineBreak-2019.001-11.el9.x86_64.rpm                                                                                                                  1.5 MB/s | 144 kB     00:00
(143/191): perl-Unicode-Normalize-1.27-461.el9.x86_64.rpm                                                                                                                     683 kB/s |  96 kB     00:00
(144/191): perl-TermReadKey-2.38-11.el9.x86_64.rpm                                                                                                                             22 kB/s |  42 kB     00:01
(145/191): perl-Unicode-UCD-0.75-481.1.el9_6.noarch.rpm                                                                                                                       1.2 MB/s |  77 kB     00:00
(146/191): perl-User-pwent-1.03-481.1.el9_6.noarch.rpm                                                                                                                        242 kB/s |  24 kB     00:00
(147/191): perl-autodie-2.34-4.el9.noarch.rpm                                                                                                                                 1.1 MB/s | 117 kB     00:00
(148/191): perl-bignum-0.51-460.el9.noarch.rpm                                                                                                                                1.1 MB/s |  56 kB     00:00
(149/191): perl-blib-1.07-481.1.el9_6.noarch.rpm                                                                                                                              262 kB/s |  11 kB     00:00
(150/191): perl-autouse-1.11-481.1.el9_6.noarch.rpm                                                                                                                            70 kB/s |  12 kB     00:00
(151/191): perl-deprecate-0.04-481.1.el9_6.noarch.rpm                                                                                                                         163 kB/s |  13 kB     00:00
(152/191): perl-devel-5.32.1-481.1.el9_6.x86_64.rpm                                                                                                                           6.2 MB/s | 748 kB     00:00
(153/191): perl-diagnostics-1.37-481.1.el9_6.noarch.rpm                                                                                                                       1.9 MB/s | 216 kB     00:00
(154/191): perl-Thread-Queue-3.14-460.el9.noarch.rpm                                                                                                                           14 kB/s |  28 kB     00:01
(155/191): perl-doc-5.32.1-481.1.el9_6.noarch.rpm                                                                                                                             9.1 MB/s | 4.9 MB     00:00
(156/191): perl-encoding-3.00-462.el9.x86_64.rpm                                                                                                                              349 kB/s |  68 kB     00:00
(157/191): perl-encoding-warnings-0.13-481.1.el9_6.noarch.rpm                                                                                                                 374 kB/s |  15 kB     00:00
(158/191): perl-experimental-0.022-6.el9.noarch.rpm                                                                                                                           667 kB/s |  27 kB     00:00
(159/191): perl-filetest-1.03-481.1.el9_6.noarch.rpm                                                                                                                          352 kB/s |  13 kB     00:00
(160/191): perl-inc-latest-0.500-20.el9.noarch.rpm                                                                                                                            768 kB/s |  31 kB     00:00
(161/191): perl-fields-2.27-481.1.el9_6.noarch.rpm                                                                                                                            162 kB/s |  15 kB     00:00
(162/191): perl-less-0.03-481.1.el9_6.noarch.rpm                                                                                                                              307 kB/s |  12 kB     00:00
(163/191): perl-lib-0.65-481.1.el9_6.x86_64.rpm                                                                                                                               208 kB/s |  13 kB     00:00
(164/191): perl-libnetcfg-5.32.1-481.1.el9_6.noarch.rpm                                                                                                                       403 kB/s |  15 kB     00:00
(165/191): perl-macros-5.32.1-481.1.el9_6.noarch.rpm                                                                                                                          261 kB/s | 9.2 kB     00:00
(166/191): perl-local-lib-2.000024-13.el9.noarch.rpm                                                                                                                          839 kB/s |  76 kB     00:00
(167/191): perl-meta-notation-5.32.1-481.1.el9_6.noarch.rpm                                                                                                                   102 kB/s | 8.2 kB     00:00
(168/191): perl-open-1.12-481.1.el9_6.noarch.rpm                                                                                                                              369 kB/s |  15 kB     00:00
(169/191): perl-ph-5.32.1-481.1.el9_6.x86_64.rpm                                                                                                                              745 kB/s |  67 kB     00:00
(170/191): perl-perlfaq-5.20210520-1.el9.noarch.rpm                                                                                                                           2.7 MB/s | 399 kB     00:00
(171/191): perl-sigtrap-1.09-481.1.el9_6.noarch.rpm                                                                                                                           299 kB/s |  14 kB     00:00
(172/191): perl-srpm-macros-1-41.el9.noarch.rpm                                                                                                                               110 kB/s | 9.1 kB     00:00
(173/191): perl-sort-2.04-481.1.el9_6.noarch.rpm                                                                                                                               98 kB/s |  12 kB     00:00
(174/191): perl-threads-2.25-460.el9.x86_64.rpm                                                                                                                               698 kB/s |  65 kB     00:00
(175/191): perl-threads-shared-1.61-460.el9.x86_64.rpm                                                                                                                        589 kB/s |  50 kB     00:00
(176/191): perl-utils-5.32.1-481.1.el9_6.noarch.rpm                                                                                                                           1.4 MB/s |  64 kB     00:00
(177/191): perl-version-0.99.28-4.el9.x86_64.rpm                                                                                                                              1.6 MB/s |  74 kB     00:00
(178/191): pyproject-srpm-macros-1.16.2-1.el9.noarch.rpm                                                                                                                      353 kB/s |  13 kB     00:00
(179/191): perl-vmsish-1.04-481.1.el9_6.noarch.rpm                                                                                                                            132 kB/s |  13 kB     00:00
(180/191): qt5-srpm-macros-5.15.9-1.el9.noarch.rpm                                                                                                                            208 kB/s | 7.7 kB     00:00
(181/191): redhat-rpm-config-210-1.0.1.el9.noarch.rpm                                                                                                                         2.0 MB/s | 101 kB     00:00
(182/191): perl-debugger-1.56-481.1.el9_6.noarch.rpm                                                                                                                           75 kB/s | 139 kB     00:01
(183/191): sombok-2.4.0-16.el9.x86_64.rpm                                                                                                                                     1.3 MB/s |  55 kB     00:00
(184/191): rust-srpm-macros-17-4.el9.noarch.rpm                                                                                                                               107 kB/s |  10 kB     00:00
(185/191): python-srpm-macros-3.9-54.el9.noarch.rpm                                                                                                                           8.2 kB/s |  16 kB     00:02
(186/191): libstdc++-11.5.0-11.0.2.el9.x86_64.rpm                                                                                                                             6.4 MB/s | 757 kB     00:00
(187/191): systemtap-sdt-devel-5.3-3.0.1.el9.x86_64.rpm                                                                                                                        39 kB/s |  76 kB     00:01
(188/191): perl-Errno-1.30-481.1.el9_6.x86_64.rpm                                                                                                                             366 kB/s |  13 kB     00:00
(189/191): perl-interpreter-5.32.1-481.1.el9_6.x86_64.rpm                                                                                                                     858 kB/s |  76 kB     00:00
(190/191): perl-libs-5.32.1-481.1.el9_6.x86_64.rpm                                                                                                                            8.5 MB/s | 2.7 MB     00:00
(191/191): systemtap-sdt-dtrace-5.3-3.0.1.el9.x86_64.rpm                                                                                                                       22 kB/s |  75 kB     00:03
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                         1.9 MB/s |  38 MB     00:20
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                      1/1
  Upgrading        : libstdc++-11.5.0-11.0.2.el9.x86_64                                                                                                                                                 1/195
  Installing       : perl-GDBM_File-1.18-481.1.el9_6.x86_64                                                                                                                                             2/195
  Installing       : perl-ODBM_File-1.16-481.1.el9_6.x86_64                                                                                                                                             3/195
  Upgrading        : perl-libs-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                              4/195
  Installing       : perl-DB_File-1.855-4.el9.x86_64                                                                                                                                                    5/195
  Installing       : perl-version-7:0.99.28-4.el9.x86_64                                                                                                                                                6/195
  Installing       : perl-File-Copy-2.34-481.1.el9_6.noarch                                                                                                                                             7/195
  Installing       : perl-ExtUtils-Manifest-1:1.73-4.el9.noarch                                                                                                                                         8/195
  Installing       : perl-Time-HiRes-4:1.9764-462.el9.x86_64                                                                                                                                            9/195
  Installing       : perl-CPAN-Meta-Requirements-2.140-461.el9.noarch                                                                                                                                  10/195
  Installing       : perl-Compress-Raw-Zlib-2.101-5.el9.x86_64                                                                                                                                         11/195
  Installing       : perl-File-Compare-1.100.600-481.1.el9_6.noarch                                                                                                                                    12/195
  Installing       : perl-lib-0.65-481.1.el9_6.x86_64                                                                                                                                                  13/195
  Installing       : perl-threads-1:2.25-460.el9.x86_64                                                                                                                                                14/195
  Installing       : perl-threads-shared-1.61-460.el9.x86_64                                                                                                                                           15/195
  Installing       : perl-Module-CoreList-1:5.20240609-1.el9.noarch                                                                                                                                    16/195
  Installing       : perl-Module-Metadata-1.000037-460.el9.noarch                                                                                                                                      17/195
  Installing       : perl-Devel-Peek-1.28-481.1.el9_6.x86_64                                                                                                                                           18/195
  Installing       : perl-Filter-2:1.60-4.el9.x86_64                                                                                                                                                   19/195
  Installing       : perl-Module-Load-1:0.36-4.el9.noarch                                                                                                                                              20/195
  Installing       : perl-Perl-OSType-1.010-461.el9.noarch                                                                                                                                             21/195
  Installing       : perl-Term-ReadLine-1.17-481.1.el9_6.noarch                                                                                                                                        22/195
  Installing       : perl-Tie-4.6-481.1.el9_6.noarch                                                                                                                                                   23/195
  Installing       : perl-Unicode-Normalize-1.27-461.el9.x86_64                                                                                                                                        24/195
  Installing       : perl-doc-5.32.1-481.1.el9_6.noarch                                                                                                                                                25/195
  Upgrading        : perl-interpreter-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                      26/195
  Installing       : perl-ExtUtils-ParseXS-1:3.40-460.el9.noarch                                                                                                                                       27/195
  Installing       : perl-JSON-PP-1:4.06-4.el9.noarch                                                                                                                                                  28/195
  Installing       : perl-Digest-SHA-1:6.02-461.el9.x86_64                                                                                                                                             29/195
  Installing       : perl-meta-notation-5.32.1-481.1.el9_6.noarch                                                                                                                                      30/195
  Installing       : perl-Pod-Html-1.25-481.1.el9_6.noarch                                                                                                                                             31/195
  Installing       : perl-encoding-4:3.00-462.el9.x86_64                                                                                                                                               32/195
  Installing       : perl-Dumpvalue-2.27-481.1.el9_6.noarch                                                                                                                                            33/195
  Installing       : perl-Net-Ping-2.74-5.el9.noarch                                                                                                                                                   34/195
  Installing       : perl-ExtUtils-Command-2:7.60-3.el9.noarch                                                                                                                                         35/195
  Installing       : perl-AutoSplit-5.74-481.1.el9_6.noarch                                                                                                                                            36/195
  Installing       : perl-Benchmark-1.23-481.1.el9_6.noarch                                                                                                                                            37/195
  Installing       : perl-Test-Harness-1:3.42-461.el9.noarch                                                                                                                                           38/195
  Installing       : perl-CPAN-Meta-YAML-0.018-461.el9.noarch                                                                                                                                          39/195
  Installing       : perl-CPAN-Meta-2.150010-460.el9.noarch                                                                                                                                            40/195
  Installing       : perl-Compress-Raw-Bzip2-2.101-5.el9.x86_64                                                                                                                                        41/195
  Installing       : perl-IO-Compress-2.102-4.el9.noarch                                                                                                                                               42/195
  Installing       : perl-IO-Zlib-1:1.11-4.el9.noarch                                                                                                                                                  43/195
  Installing       : perl-Devel-PPPort-3.62-4.el9.x86_64                                                                                                                                               44/195
  Installing       : perl-DirHandle-1.05-481.1.el9_6.noarch                                                                                                                                            45/195
  Installing       : perl-ExtUtils-Constant-0.25-481.1.el9_6.noarch                                                                                                                                    46/195
  Installing       : perl-ExtUtils-MM-Utils-2:7.60-3.el9.noarch                                                                                                                                        47/195
  Installing       : perl-Hash-Util-FieldHash-1.20-481.1.el9_6.x86_64                                                                                                                                  48/195
  Installing       : perl-Hash-Util-0.23-481.1.el9_6.x86_64                                                                                                                                            49/195
  Installing       : perl-I18N-LangTags-0.44-481.1.el9_6.noarch                                                                                                                                        50/195
  Installing       : perl-Locale-Maketext-1.29-461.el9.noarch                                                                                                                                          51/195
  Installing       : perl-Locale-Maketext-Simple-1:0.21-481.1.el9_6.noarch                                                                                                                             52/195
  Installing       : perl-Params-Check-1:0.38-461.el9.noarch                                                                                                                                           53/195
  Installing       : perl-Module-Load-Conditional-0.74-4.el9.noarch                                                                                                                                    54/195
  Installing       : perl-IPC-Cmd-2:1.04-461.el9.noarch                                                                                                                                                55/195
  Installing       : perl-I18N-Langinfo-0.19-481.1.el9_6.x86_64                                                                                                                                        56/195
  Installing       : perl-Math-BigRat-0.2614-460.el9.noarch                                                                                                                                            57/195
  Installing       : perl-Opcode-1.48-481.1.el9_6.x86_64                                                                                                                                               58/195
  Installing       : perl-Safe-2.41-481.1.el9_6.noarch                                                                                                                                                 59/195
  Installing       : perl-Params-Util-1.102-5.el9.x86_64                                                                                                                                               60/195
  Installing       : perl-SelfLoader-1.26-481.1.el9_6.noarch                                                                                                                                           61/195
  Installing       : perl-Sub-Install-0.928-28.el9.noarch                                                                                                                                              62/195
  Installing       : perl-Sys-Hostname-1.23-481.1.el9_6.x86_64                                                                                                                                         63/195
  Installing       : perl-TermReadKey-2.38-11.el9.x86_64                                                                                                                                               64/195
  Installing       : perl-Text-Balanced-2.04-4.el9.noarch                                                                                                                                              65/195
  Installing       : perl-Tie-RefHash-1.40-4.el9.noarch                                                                                                                                                66/195
  Installing       : perl-User-pwent-1.03-481.1.el9_6.noarch                                                                                                                                           67/195
  Installing       : perl-autouse-1.11-481.1.el9_6.noarch                                                                                                                                              68/195
  Upgrading        : perl-Errno-1.30-481.1.el9_6.x86_64                                                                                                                                                69/195
  Installing       : perl-Filter-Simple-0.96-460.el9.noarch                                                                                                                                            70/195
  Installing       : perl-Data-OptList-0.110-17.el9.noarch                                                                                                                                             71/195
  Installing       : perl-Devel-SelfStubber-1.06-481.1.el9_6.noarch                                                                                                                                    72/195
  Installing       : perl-bignum-0.51-460.el9.noarch                                                                                                                                                   73/195
  Installing       : perl-Encode-Locale-1.05-21.el9.noarch                                                                                                                                             74/195
  Installing       : perl-File-Fetch-1.00-4.el9.noarch                                                                                                                                                 75/195
  Installing       : perl-fields-2.27-481.1.el9_6.noarch                                                                                                                                               76/195
  Installing       : perl-DBM_Filter-0.06-481.1.el9_6.noarch                                                                                                                                           77/195
  Installing       : perl-open-1.12-481.1.el9_6.noarch                                                                                                                                                 78/195
  Installing       : perl-debugger-1.56-481.1.el9_6.noarch                                                                                                                                             79/195
  Installing       : perl-sigtrap-1.09-481.1.el9_6.noarch                                                                                                                                              80/195
  Installing       : kernel-srpm-macros-1.0-14.0.1.el9.noarch                                                                                                                                          81/195
  Installing       : perl-Archive-Zip-1.68-6.el9.noarch                                                                                                                                                82/195
  Installing       : perl-Module-CoreList-tools-1:5.20240609-1.el9.noarch                                                                                                                              83/195
  Installing       : perl-Pod-Checker-4:1.74-4.el9.noarch                                                                                                                                              84/195
  Installing       : perl-diagnostics-1.37-481.1.el9_6.noarch                                                                                                                                          85/195
  Installing       : perl-macros-4:5.32.1-481.1.el9_6.noarch                                                                                                                                           86/195
  Installing       : perl-utils-5.32.1-481.1.el9_6.noarch                                                                                                                                              87/195
  Installing       : perl-Unicode-Collate-1.29-4.el9.x86_64                                                                                                                                            88/195
  Installing       : perl-Unicode-UCD-0.75-481.1.el9_6.noarch                                                                                                                                          89/195
  Installing       : perl-Env-1.04-460.el9.noarch                                                                                                                                                      90/195
  Installing       : perl-Thread-3.05-481.1.el9_6.noarch                                                                                                                                               91/195
  Installing       : perl-Thread-Queue-3.14-460.el9.noarch                                                                                                                                             92/195
  Installing       : perl-Thread-Semaphore-2.13-481.1.el9_6.noarch                                                                                                                                     93/195
  Installing       : perl-experimental-0.022-6.el9.noarch                                                                                                                                              94/195
  Installing       : perl-Algorithm-Diff-1.2010-4.el9.noarch                                                                                                                                           95/195
  Installing       : perl-Text-Diff-1.45-13.el9.noarch                                                                                                                                                 96/195
  Installing       : perl-Attribute-Handlers-1.01-481.1.el9_6.noarch                                                                                                                                   97/195
  Installing       : perl-CPAN-DistnameInfo-0.12-23.el9.noarch                                                                                                                                         98/195
  Installing       : perl-Compress-Bzip2-2.28-5.el9.x86_64                                                                                                                                             99/195
  Installing       : perl-Compress-Raw-Lzma-2.101-3.el9.x86_64                                                                                                                                        100/195
  Installing       : perl-IO-Compress-Lzma-2.101-4.el9.noarch                                                                                                                                         101/195
  Installing       : perl-Archive-Tar-2.38-6.el9.noarch                                                                                                                                               102/195
  Installing       : perl-Config-Extensions-0.03-481.1.el9_6.noarch                                                                                                                                   103/195
  Installing       : perl-Config-Perl-V-0.33-4.el9.noarch                                                                                                                                             104/195
  Installing       : perl-Devel-Size-0.83-10.el9.x86_64                                                                                                                                               105/195
  Installing       : perl-Digest-SHA1-2.13-34.el9.x86_64                                                                                                                                              106/195
  Installing       : perl-Module-Signature-0.88-1.el9.noarch                                                                                                                                          107/195
  Installing       : perl-English-1.11-481.1.el9_6.noarch                                                                                                                                             108/195
  Installing       : perl-File-DosGlob-1.12-481.1.el9_6.x86_64                                                                                                                                        109/195
  Installing       : perl-File-Which-1.23-10.el9.noarch                                                                                                                                               110/195
  Installing       : perl-File-HomeDir-1.006-4.el9.noarch                                                                                                                                             111/195
  Installing       : perl-FileCache-1.10-481.1.el9_6.noarch                                                                                                                                           112/195
  Installing       : perl-FindBin-1.51-481.1.el9_6.noarch                                                                                                                                             113/195
  Installing       : perl-I18N-Collate-1.02-481.1.el9_6.noarch                                                                                                                                        114/195
  Installing       : perl-IPC-SysV-2.09-4.el9.x86_64                                                                                                                                                  115/195
  Installing       : perl-IPC-System-Simple-1.30-6.el9.noarch                                                                                                                                         116/195
  Installing       : perl-autodie-2.34-4.el9.noarch                                                                                                                                                   117/195
  Installing       : perl-Importer-0.026-4.el9.noarch                                                                                                                                                 118/195
  Installing       : perl-MIME-Charset-1.012.2-15.el9.noarch                                                                                                                                          119/195
  Installing       : perl-MRO-Compat-0.13-15.el9.noarch                                                                                                                                               120/195
  Installing       : perl-Math-BigInt-FastCalc-0.500.900-460.el9.x86_64                                                                                                                               121/195
  Installing       : perl-Memoize-1.03-481.1.el9_6.noarch                                                                                                                                             122/195
  Installing       : perl-Module-Loaded-1:0.08-481.1.el9_6.noarch                                                                                                                                     123/195
  Installing       : perl-NEXT-0.67-481.1.el9_6.noarch                                                                                                                                                124/195
  Installing       : perl-Net-1.02-481.1.el9_6.noarch                                                                                                                                                 125/195
  Installing       : perl-Object-HashBase-0.009-7.el9.noarch                                                                                                                                          126/195
  Installing       : perl-Package-Generator-1.106-23.el9.noarch                                                                                                                                       127/195
  Installing       : perl-Sub-Exporter-0.987-27.el9.noarch                                                                                                                                            128/195
  Installing       : perl-Data-Section-0.200007-14.el9.noarch                                                                                                                                         129/195
  Installing       : perl-PerlIO-via-QuotedPrint-0.09-4.el9.noarch                                                                                                                                    130/195
  Installing       : perl-Pod-Functions-1.13-481.1.el9_6.noarch                                                                                                                                       131/195
  Installing       : perl-Search-Dict-1.07-481.1.el9_6.noarch                                                                                                                                         132/195
  Installing       : perl-Sys-Syslog-0.36-461.el9.x86_64                                                                                                                                              133/195
  Installing       : perl-Term-Complete-1.403-481.1.el9_6.noarch                                                                                                                                      134/195
  Installing       : perl-Term-Size-Perl-0.031-12.el9.x86_64                                                                                                                                          135/195
  Installing       : perl-Term-Size-Any-0.002-35.el9.noarch                                                                                                                                           136/195
  Installing       : perl-Test-1.31-481.1.el9_6.noarch                                                                                                                                                137/195
  Installing       : perl-Text-Abbrev-1.02-481.1.el9_6.noarch                                                                                                                                         138/195
  Installing       : perl-Text-Glob-0.11-15.el9.noarch                                                                                                                                                139/195
  Installing       : perl-Text-Template-1.59-5.el9.noarch                                                                                                                                             140/195
  Installing       : perl-Software-License-0.103014-12.el9.noarch                                                                                                                                     141/195
  Installing       : perl-Tie-File-1.06-481.1.el9_6.noarch                                                                                                                                            142/195
  Installing       : perl-Tie-Memoize-1.1-481.1.el9_6.noarch                                                                                                                                          143/195
  Installing       : perl-Time-1.03-481.1.el9_6.noarch                                                                                                                                                144/195
  Installing       : perl-Time-Piece-1.3401-481.1.el9_6.x86_64                                                                                                                                        145/195
  Installing       : perl-blib-1.07-481.1.el9_6.noarch                                                                                                                                                146/195
  Installing       : perl-deprecate-0.04-481.1.el9_6.noarch                                                                                                                                           147/195
  Installing       : perl-encoding-warnings-0.13-481.1.el9_6.noarch                                                                                                                                   148/195
  Installing       : perl-filetest-1.03-481.1.el9_6.noarch                                                                                                                                            149/195
  Installing       : perl-less-0.03-481.1.el9_6.noarch                                                                                                                                                150/195
  Installing       : perl-local-lib-2.000024-13.el9.noarch                                                                                                                                            151/195
  Installing       : perl-perlfaq-5.20210520-1.el9.noarch                                                                                                                                             152/195
  Installing       : perl-ph-5.32.1-481.1.el9_6.x86_64                                                                                                                                                153/195
  Installing       : perl-sort-2.04-481.1.el9_6.noarch                                                                                                                                                154/195
  Installing       : perl-vmsish-1.04-481.1.el9_6.noarch                                                                                                                                              155/195
  Installing       : annobin-12.92-1.el9.x86_64                                                                                                                                                       156/195
  Installing       : gcc-plugin-annobin-11.5.0-11.0.2.el9.x86_64                                                                                                                                      157/195
  Installing       : libstdc++-devel-11.5.0-11.0.2.el9.x86_64                                                                                                                                         158/195
  Installing       : gcc-c++-11.5.0-11.0.2.el9.x86_64                                                                                                                                                 159/195
  Installing       : systemtap-sdt-dtrace-5.3-3.0.1.el9.x86_64                                                                                                                                        160/195
  Installing       : systemtap-sdt-devel-5.3-3.0.1.el9.x86_64                                                                                                                                         161/195
  Installing       : sombok-2.4.0-16.el9.x86_64                                                                                                                                                       162/195
  Installing       : perl-Unicode-LineBreak-2019.001-11.el9.x86_64                                                                                                                                    163/195
  Installing       : perl-Term-Table-0.015-8.el9.noarch                                                                                                                                               164/195
  Installing       : perl-Test-Simple-3:1.302183-4.el9.noarch                                                                                                                                         165/195
  Installing       : rust-srpm-macros-17-4.el9.noarch                                                                                                                                                 166/195
  Installing       : qt5-srpm-macros-5.15.9-1.el9.noarch                                                                                                                                              167/195
  Installing       : pyproject-srpm-macros-1.16.2-1.el9.noarch                                                                                                                                        168/195
  Installing       : perl-srpm-macros-1-41.el9.noarch                                                                                                                                                 169/195
  Installing       : openblas-srpm-macros-2-11.el9.noarch                                                                                                                                             170/195
  Installing       : ocaml-srpm-macros-6-6.el9.noarch                                                                                                                                                 171/195
  Installing       : lua-srpm-macros-1-6.el9.noarch                                                                                                                                                   172/195
  Installing       : ghc-srpm-macros-1.5.0-6.el9.noarch                                                                                                                                               173/195
  Installing       : efi-srpm-macros-6-4.0.1.el9.noarch                                                                                                                                               174/195
  Installing       : dwz-0.16-1.el9.x86_64                                                                                                                                                            175/195
  Installing       : fonts-srpm-macros-1:2.0.5-7.el9.1.noarch                                                                                                                                         176/195
  Installing       : go-srpm-macros-3.6.0-14.el9_7.noarch                                                                                                                                             177/195
  Installing       : python-srpm-macros-3.9-54.el9.noarch                                                                                                                                             178/195
  Installing       : redhat-rpm-config-210-1.0.1.el9.noarch                                                                                                                                           179/195
  Running scriptlet: redhat-rpm-config-210-1.0.1.el9.noarch                                                                                                                                           179/195
  Installing       : perl-ExtUtils-Install-2.20-4.el9.noarch                                                                                                                                          180/195
  Installing       : perl-devel-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                           181/195
  Installing       : perl-ExtUtils-MakeMaker-2:7.60-3.el9.noarch                                                                                                                                      182/195
  Installing       : perl-ExtUtils-CBuilder-1:0.280236-4.el9.noarch                                                                                                                                   183/195
  Installing       : perl-ExtUtils-Embed-1.35-481.1.el9_6.noarch                                                                                                                                      184/195
  Installing       : perl-ExtUtils-Miniperl-1.09-481.1.el9_6.noarch                                                                                                                                   185/195
  Installing       : perl-libnetcfg-4:5.32.1-481.1.el9_6.noarch                                                                                                                                       186/195
  Installing       : perl-Encode-devel-4:3.08-462.el9.x86_64                                                                                                                                          187/195
  Installing       : perl-inc-latest-2:0.500-20.el9.noarch                                                                                                                                            188/195
  Installing       : perl-Module-Build-2:0.42.31-9.el9.noarch                                                                                                                                         189/195
  Installing       : perl-CPAN-2.29-5.el9_6.noarch                                                                                                                                                    190/195
  Installing       : perl-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                                 191/195
  Cleanup          : perl-Errno-1.30-481.el9.x86_64                                                                                                                                                   192/195
  Cleanup          : perl-interpreter-4:5.32.1-481.el9.x86_64                                                                                                                                         193/195
  Cleanup          : perl-libs-4:5.32.1-481.el9.x86_64                                                                                                                                                194/195
  Cleanup          : libstdc++-11.5.0-5.0.1.el9.x86_64                                                                                                                                                195/195
  Running scriptlet: libstdc++-11.5.0-5.0.1.el9.x86_64                                                                                                                                                195/195
  Verifying        : annobin-12.92-1.el9.x86_64                                                                                                                                                         1/195
  Verifying        : dwz-0.16-1.el9.x86_64                                                                                                                                                              2/195
  Verifying        : efi-srpm-macros-6-4.0.1.el9.noarch                                                                                                                                                 3/195
  Verifying        : fonts-srpm-macros-1:2.0.5-7.el9.1.noarch                                                                                                                                           4/195
  Verifying        : gcc-c++-11.5.0-11.0.2.el9.x86_64                                                                                                                                                   5/195
  Verifying        : gcc-plugin-annobin-11.5.0-11.0.2.el9.x86_64                                                                                                                                        6/195
  Verifying        : ghc-srpm-macros-1.5.0-6.el9.noarch                                                                                                                                                 7/195
  Verifying        : go-srpm-macros-3.6.0-14.el9_7.noarch                                                                                                                                               8/195
  Verifying        : kernel-srpm-macros-1.0-14.0.1.el9.noarch                                                                                                                                           9/195
  Verifying        : libstdc++-devel-11.5.0-11.0.2.el9.x86_64                                                                                                                                          10/195
  Verifying        : lua-srpm-macros-1-6.el9.noarch                                                                                                                                                    11/195
  Verifying        : ocaml-srpm-macros-6-6.el9.noarch                                                                                                                                                  12/195
  Verifying        : openblas-srpm-macros-2-11.el9.noarch                                                                                                                                              13/195
  Verifying        : perl-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                                  14/195
  Verifying        : perl-Algorithm-Diff-1.2010-4.el9.noarch                                                                                                                                           15/195
  Verifying        : perl-Archive-Tar-2.38-6.el9.noarch                                                                                                                                                16/195
  Verifying        : perl-Archive-Zip-1.68-6.el9.noarch                                                                                                                                                17/195
  Verifying        : perl-Attribute-Handlers-1.01-481.1.el9_6.noarch                                                                                                                                   18/195
  Verifying        : perl-AutoSplit-5.74-481.1.el9_6.noarch                                                                                                                                            19/195
  Verifying        : perl-Benchmark-1.23-481.1.el9_6.noarch                                                                                                                                            20/195
  Verifying        : perl-CPAN-2.29-5.el9_6.noarch                                                                                                                                                     21/195
  Verifying        : perl-CPAN-DistnameInfo-0.12-23.el9.noarch                                                                                                                                         22/195
  Verifying        : perl-CPAN-Meta-2.150010-460.el9.noarch                                                                                                                                            23/195
  Verifying        : perl-CPAN-Meta-Requirements-2.140-461.el9.noarch                                                                                                                                  24/195
  Verifying        : perl-CPAN-Meta-YAML-0.018-461.el9.noarch                                                                                                                                          25/195
  Verifying        : perl-Compress-Bzip2-2.28-5.el9.x86_64                                                                                                                                             26/195
  Verifying        : perl-Compress-Raw-Bzip2-2.101-5.el9.x86_64                                                                                                                                        27/195
  Verifying        : perl-Compress-Raw-Lzma-2.101-3.el9.x86_64                                                                                                                                         28/195
  Verifying        : perl-Compress-Raw-Zlib-2.101-5.el9.x86_64                                                                                                                                         29/195
  Verifying        : perl-Config-Extensions-0.03-481.1.el9_6.noarch                                                                                                                                    30/195
  Verifying        : perl-Config-Perl-V-0.33-4.el9.noarch                                                                                                                                              31/195
  Verifying        : perl-DBM_Filter-0.06-481.1.el9_6.noarch                                                                                                                                           32/195
  Verifying        : perl-DB_File-1.855-4.el9.x86_64                                                                                                                                                   33/195
  Verifying        : perl-Data-OptList-0.110-17.el9.noarch                                                                                                                                             34/195
  Verifying        : perl-Data-Section-0.200007-14.el9.noarch                                                                                                                                          35/195
  Verifying        : perl-Devel-PPPort-3.62-4.el9.x86_64                                                                                                                                               36/195
  Verifying        : perl-Devel-Peek-1.28-481.1.el9_6.x86_64                                                                                                                                           37/195
  Verifying        : perl-Devel-SelfStubber-1.06-481.1.el9_6.noarch                                                                                                                                    38/195
  Verifying        : perl-Devel-Size-0.83-10.el9.x86_64                                                                                                                                                39/195
  Verifying        : perl-Digest-SHA-1:6.02-461.el9.x86_64                                                                                                                                             40/195
  Verifying        : perl-Digest-SHA1-2.13-34.el9.x86_64                                                                                                                                               41/195
  Verifying        : perl-DirHandle-1.05-481.1.el9_6.noarch                                                                                                                                            42/195
  Verifying        : perl-Dumpvalue-2.27-481.1.el9_6.noarch                                                                                                                                            43/195
  Verifying        : perl-Encode-Locale-1.05-21.el9.noarch                                                                                                                                             44/195
  Verifying        : perl-Encode-devel-4:3.08-462.el9.x86_64                                                                                                                                           45/195
  Verifying        : perl-English-1.11-481.1.el9_6.noarch                                                                                                                                              46/195
  Verifying        : perl-Env-1.04-460.el9.noarch                                                                                                                                                      47/195
  Verifying        : perl-ExtUtils-CBuilder-1:0.280236-4.el9.noarch                                                                                                                                    48/195
  Verifying        : perl-ExtUtils-Command-2:7.60-3.el9.noarch                                                                                                                                         49/195
  Verifying        : perl-ExtUtils-Constant-0.25-481.1.el9_6.noarch                                                                                                                                    50/195
  Verifying        : perl-ExtUtils-Embed-1.35-481.1.el9_6.noarch                                                                                                                                       51/195
  Verifying        : perl-ExtUtils-Install-2.20-4.el9.noarch                                                                                                                                           52/195
  Verifying        : perl-ExtUtils-MM-Utils-2:7.60-3.el9.noarch                                                                                                                                        53/195
  Verifying        : perl-ExtUtils-MakeMaker-2:7.60-3.el9.noarch                                                                                                                                       54/195
  Verifying        : perl-ExtUtils-Manifest-1:1.73-4.el9.noarch                                                                                                                                        55/195
  Verifying        : perl-ExtUtils-Miniperl-1.09-481.1.el9_6.noarch                                                                                                                                    56/195
  Verifying        : perl-ExtUtils-ParseXS-1:3.40-460.el9.noarch                                                                                                                                       57/195
  Verifying        : perl-File-Compare-1.100.600-481.1.el9_6.noarch                                                                                                                                    58/195
  Verifying        : perl-File-Copy-2.34-481.1.el9_6.noarch                                                                                                                                            59/195
  Verifying        : perl-File-DosGlob-1.12-481.1.el9_6.x86_64                                                                                                                                         60/195
  Verifying        : perl-File-Fetch-1.00-4.el9.noarch                                                                                                                                                 61/195
  Verifying        : perl-File-HomeDir-1.006-4.el9.noarch                                                                                                                                              62/195
  Verifying        : perl-File-Which-1.23-10.el9.noarch                                                                                                                                                63/195
  Verifying        : perl-FileCache-1.10-481.1.el9_6.noarch                                                                                                                                            64/195
  Verifying        : perl-Filter-2:1.60-4.el9.x86_64                                                                                                                                                   65/195
  Verifying        : perl-Filter-Simple-0.96-460.el9.noarch                                                                                                                                            66/195
  Verifying        : perl-FindBin-1.51-481.1.el9_6.noarch                                                                                                                                              67/195
  Verifying        : perl-GDBM_File-1.18-481.1.el9_6.x86_64                                                                                                                                            68/195
  Verifying        : perl-Hash-Util-0.23-481.1.el9_6.x86_64                                                                                                                                            69/195
  Verifying        : perl-Hash-Util-FieldHash-1.20-481.1.el9_6.x86_64                                                                                                                                  70/195
  Verifying        : perl-I18N-Collate-1.02-481.1.el9_6.noarch                                                                                                                                         71/195
  Verifying        : perl-I18N-LangTags-0.44-481.1.el9_6.noarch                                                                                                                                        72/195
  Verifying        : perl-I18N-Langinfo-0.19-481.1.el9_6.x86_64                                                                                                                                        73/195
  Verifying        : perl-IO-Compress-2.102-4.el9.noarch                                                                                                                                               74/195
  Verifying        : perl-IO-Compress-Lzma-2.101-4.el9.noarch                                                                                                                                          75/195
  Verifying        : perl-IO-Zlib-1:1.11-4.el9.noarch                                                                                                                                                  76/195
  Verifying        : perl-IPC-Cmd-2:1.04-461.el9.noarch                                                                                                                                                77/195
  Verifying        : perl-IPC-SysV-2.09-4.el9.x86_64                                                                                                                                                   78/195
  Verifying        : perl-IPC-System-Simple-1.30-6.el9.noarch                                                                                                                                          79/195
  Verifying        : perl-Importer-0.026-4.el9.noarch                                                                                                                                                  80/195
  Verifying        : perl-JSON-PP-1:4.06-4.el9.noarch                                                                                                                                                  81/195
  Verifying        : perl-Locale-Maketext-1.29-461.el9.noarch                                                                                                                                          82/195
  Verifying        : perl-Locale-Maketext-Simple-1:0.21-481.1.el9_6.noarch                                                                                                                             83/195
  Verifying        : perl-MIME-Charset-1.012.2-15.el9.noarch                                                                                                                                           84/195
  Verifying        : perl-MRO-Compat-0.13-15.el9.noarch                                                                                                                                                85/195
  Verifying        : perl-Math-BigInt-FastCalc-0.500.900-460.el9.x86_64                                                                                                                                86/195
  Verifying        : perl-Math-BigRat-0.2614-460.el9.noarch                                                                                                                                            87/195
  Verifying        : perl-Memoize-1.03-481.1.el9_6.noarch                                                                                                                                              88/195
  Verifying        : perl-Module-Build-2:0.42.31-9.el9.noarch                                                                                                                                          89/195
  Verifying        : perl-Module-CoreList-1:5.20240609-1.el9.noarch                                                                                                                                    90/195
  Verifying        : perl-Module-CoreList-tools-1:5.20240609-1.el9.noarch                                                                                                                              91/195
  Verifying        : perl-Module-Load-1:0.36-4.el9.noarch                                                                                                                                              92/195
  Verifying        : perl-Module-Load-Conditional-0.74-4.el9.noarch                                                                                                                                    93/195
  Verifying        : perl-Module-Loaded-1:0.08-481.1.el9_6.noarch                                                                                                                                      94/195
  Verifying        : perl-Module-Metadata-1.000037-460.el9.noarch                                                                                                                                      95/195
  Verifying        : perl-Module-Signature-0.88-1.el9.noarch                                                                                                                                           96/195
  Verifying        : perl-NEXT-0.67-481.1.el9_6.noarch                                                                                                                                                 97/195
  Verifying        : perl-Net-1.02-481.1.el9_6.noarch                                                                                                                                                  98/195
  Verifying        : perl-Net-Ping-2.74-5.el9.noarch                                                                                                                                                   99/195
  Verifying        : perl-ODBM_File-1.16-481.1.el9_6.x86_64                                                                                                                                           100/195
  Verifying        : perl-Object-HashBase-0.009-7.el9.noarch                                                                                                                                          101/195
  Verifying        : perl-Opcode-1.48-481.1.el9_6.x86_64                                                                                                                                              102/195
  Verifying        : perl-Package-Generator-1.106-23.el9.noarch                                                                                                                                       103/195
  Verifying        : perl-Params-Check-1:0.38-461.el9.noarch                                                                                                                                          104/195
  Verifying        : perl-Params-Util-1.102-5.el9.x86_64                                                                                                                                              105/195
  Verifying        : perl-Perl-OSType-1.010-461.el9.noarch                                                                                                                                            106/195
  Verifying        : perl-PerlIO-via-QuotedPrint-0.09-4.el9.noarch                                                                                                                                    107/195
  Verifying        : perl-Pod-Checker-4:1.74-4.el9.noarch                                                                                                                                             108/195
  Verifying        : perl-Pod-Functions-1.13-481.1.el9_6.noarch                                                                                                                                       109/195
  Verifying        : perl-Pod-Html-1.25-481.1.el9_6.noarch                                                                                                                                            110/195
  Verifying        : perl-Safe-2.41-481.1.el9_6.noarch                                                                                                                                                111/195
  Verifying        : perl-Search-Dict-1.07-481.1.el9_6.noarch                                                                                                                                         112/195
  Verifying        : perl-SelfLoader-1.26-481.1.el9_6.noarch                                                                                                                                          113/195
  Verifying        : perl-Software-License-0.103014-12.el9.noarch                                                                                                                                     114/195
  Verifying        : perl-Sub-Exporter-0.987-27.el9.noarch                                                                                                                                            115/195
  Verifying        : perl-Sub-Install-0.928-28.el9.noarch                                                                                                                                             116/195
  Verifying        : perl-Sys-Hostname-1.23-481.1.el9_6.x86_64                                                                                                                                        117/195
  Verifying        : perl-Sys-Syslog-0.36-461.el9.x86_64                                                                                                                                              118/195
  Verifying        : perl-Term-Complete-1.403-481.1.el9_6.noarch                                                                                                                                      119/195
  Verifying        : perl-Term-ReadLine-1.17-481.1.el9_6.noarch                                                                                                                                       120/195
  Verifying        : perl-Term-Size-Any-0.002-35.el9.noarch                                                                                                                                           121/195
  Verifying        : perl-Term-Size-Perl-0.031-12.el9.x86_64                                                                                                                                          122/195
  Verifying        : perl-Term-Table-0.015-8.el9.noarch                                                                                                                                               123/195
  Verifying        : perl-TermReadKey-2.38-11.el9.x86_64                                                                                                                                              124/195
  Verifying        : perl-Test-1.31-481.1.el9_6.noarch                                                                                                                                                125/195
  Verifying        : perl-Test-Harness-1:3.42-461.el9.noarch                                                                                                                                          126/195
  Verifying        : perl-Test-Simple-3:1.302183-4.el9.noarch                                                                                                                                         127/195
  Verifying        : perl-Text-Abbrev-1.02-481.1.el9_6.noarch                                                                                                                                         128/195
  Verifying        : perl-Text-Balanced-2.04-4.el9.noarch                                                                                                                                             129/195
  Verifying        : perl-Text-Diff-1.45-13.el9.noarch                                                                                                                                                130/195
  Verifying        : perl-Text-Glob-0.11-15.el9.noarch                                                                                                                                                131/195
  Verifying        : perl-Text-Template-1.59-5.el9.noarch                                                                                                                                             132/195
  Verifying        : perl-Thread-3.05-481.1.el9_6.noarch                                                                                                                                              133/195
  Verifying        : perl-Thread-Queue-3.14-460.el9.noarch                                                                                                                                            134/195
  Verifying        : perl-Thread-Semaphore-2.13-481.1.el9_6.noarch                                                                                                                                    135/195
  Verifying        : perl-Tie-4.6-481.1.el9_6.noarch                                                                                                                                                  136/195
  Verifying        : perl-Tie-File-1.06-481.1.el9_6.noarch                                                                                                                                            137/195
  Verifying        : perl-Tie-Memoize-1.1-481.1.el9_6.noarch                                                                                                                                          138/195
  Verifying        : perl-Tie-RefHash-1.40-4.el9.noarch                                                                                                                                               139/195
  Verifying        : perl-Time-1.03-481.1.el9_6.noarch                                                                                                                                                140/195
  Verifying        : perl-Time-HiRes-4:1.9764-462.el9.x86_64                                                                                                                                          141/195
  Verifying        : perl-Time-Piece-1.3401-481.1.el9_6.x86_64                                                                                                                                        142/195
  Verifying        : perl-Unicode-Collate-1.29-4.el9.x86_64                                                                                                                                           143/195
  Verifying        : perl-Unicode-LineBreak-2019.001-11.el9.x86_64                                                                                                                                    144/195
  Verifying        : perl-Unicode-Normalize-1.27-461.el9.x86_64                                                                                                                                       145/195
  Verifying        : perl-Unicode-UCD-0.75-481.1.el9_6.noarch                                                                                                                                         146/195
  Verifying        : perl-User-pwent-1.03-481.1.el9_6.noarch                                                                                                                                          147/195
  Verifying        : perl-autodie-2.34-4.el9.noarch                                                                                                                                                   148/195
  Verifying        : perl-autouse-1.11-481.1.el9_6.noarch                                                                                                                                             149/195
  Verifying        : perl-bignum-0.51-460.el9.noarch                                                                                                                                                  150/195
  Verifying        : perl-blib-1.07-481.1.el9_6.noarch                                                                                                                                                151/195
  Verifying        : perl-debugger-1.56-481.1.el9_6.noarch                                                                                                                                            152/195
  Verifying        : perl-deprecate-0.04-481.1.el9_6.noarch                                                                                                                                           153/195
  Verifying        : perl-devel-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                           154/195
  Verifying        : perl-diagnostics-1.37-481.1.el9_6.noarch                                                                                                                                         155/195
  Verifying        : perl-doc-5.32.1-481.1.el9_6.noarch                                                                                                                                               156/195
  Verifying        : perl-encoding-4:3.00-462.el9.x86_64                                                                                                                                              157/195
  Verifying        : perl-encoding-warnings-0.13-481.1.el9_6.noarch                                                                                                                                   158/195
  Verifying        : perl-experimental-0.022-6.el9.noarch                                                                                                                                             159/195
  Verifying        : perl-fields-2.27-481.1.el9_6.noarch                                                                                                                                              160/195
  Verifying        : perl-filetest-1.03-481.1.el9_6.noarch                                                                                                                                            161/195
  Verifying        : perl-inc-latest-2:0.500-20.el9.noarch                                                                                                                                            162/195
  Verifying        : perl-less-0.03-481.1.el9_6.noarch                                                                                                                                                163/195
  Verifying        : perl-lib-0.65-481.1.el9_6.x86_64                                                                                                                                                 164/195
  Verifying        : perl-libnetcfg-4:5.32.1-481.1.el9_6.noarch                                                                                                                                       165/195
  Verifying        : perl-local-lib-2.000024-13.el9.noarch                                                                                                                                            166/195
  Verifying        : perl-macros-4:5.32.1-481.1.el9_6.noarch                                                                                                                                          167/195
  Verifying        : perl-meta-notation-5.32.1-481.1.el9_6.noarch                                                                                                                                     168/195
  Verifying        : perl-open-1.12-481.1.el9_6.noarch                                                                                                                                                169/195
  Verifying        : perl-perlfaq-5.20210520-1.el9.noarch                                                                                                                                             170/195
  Verifying        : perl-ph-5.32.1-481.1.el9_6.x86_64                                                                                                                                                171/195
  Verifying        : perl-sigtrap-1.09-481.1.el9_6.noarch                                                                                                                                             172/195
  Verifying        : perl-sort-2.04-481.1.el9_6.noarch                                                                                                                                                173/195
  Verifying        : perl-srpm-macros-1-41.el9.noarch                                                                                                                                                 174/195
  Verifying        : perl-threads-1:2.25-460.el9.x86_64                                                                                                                                               175/195
  Verifying        : perl-threads-shared-1.61-460.el9.x86_64                                                                                                                                          176/195
  Verifying        : perl-utils-5.32.1-481.1.el9_6.noarch                                                                                                                                             177/195
  Verifying        : perl-version-7:0.99.28-4.el9.x86_64                                                                                                                                              178/195
  Verifying        : perl-vmsish-1.04-481.1.el9_6.noarch                                                                                                                                              179/195
  Verifying        : pyproject-srpm-macros-1.16.2-1.el9.noarch                                                                                                                                        180/195
  Verifying        : python-srpm-macros-3.9-54.el9.noarch                                                                                                                                             181/195
  Verifying        : qt5-srpm-macros-5.15.9-1.el9.noarch                                                                                                                                              182/195
  Verifying        : redhat-rpm-config-210-1.0.1.el9.noarch                                                                                                                                           183/195
  Verifying        : rust-srpm-macros-17-4.el9.noarch                                                                                                                                                 184/195
  Verifying        : sombok-2.4.0-16.el9.x86_64                                                                                                                                                       185/195
  Verifying        : systemtap-sdt-devel-5.3-3.0.1.el9.x86_64                                                                                                                                         186/195
  Verifying        : systemtap-sdt-dtrace-5.3-3.0.1.el9.x86_64                                                                                                                                        187/195
  Verifying        : libstdc++-11.5.0-11.0.2.el9.x86_64                                                                                                                                               188/195
  Verifying        : libstdc++-11.5.0-5.0.1.el9.x86_64                                                                                                                                                189/195
  Verifying        : perl-Errno-1.30-481.1.el9_6.x86_64                                                                                                                                               190/195
  Verifying        : perl-Errno-1.30-481.el9.x86_64                                                                                                                                                   191/195
  Verifying        : perl-interpreter-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                     192/195
  Verifying        : perl-interpreter-4:5.32.1-481.el9.x86_64                                                                                                                                         193/195
  Verifying        : perl-libs-4:5.32.1-481.1.el9_6.x86_64                                                                                                                                            194/195
  Verifying        : perl-libs-4:5.32.1-481.el9.x86_64                                                                                                                                                195/195

Upgraded:
  libstdc++-11.5.0-11.0.2.el9.x86_64              perl-Errno-1.30-481.1.el9_6.x86_64              perl-interpreter-4:5.32.1-481.1.el9_6.x86_64              perl-libs-4:5.32.1-481.1.el9_6.x86_64
Installed:
  annobin-12.92-1.el9.x86_64                      dwz-0.16-1.el9.x86_64                               efi-srpm-macros-6-4.0.1.el9.noarch                     fonts-srpm-macros-1:2.0.5-7.el9.1.noarch
  gcc-c++-11.5.0-11.0.2.el9.x86_64                gcc-plugin-annobin-11.5.0-11.0.2.el9.x86_64         ghc-srpm-macros-1.5.0-6.el9.noarch                     go-srpm-macros-3.6.0-14.el9_7.noarch
  kernel-srpm-macros-1.0-14.0.1.el9.noarch        libstdc++-devel-11.5.0-11.0.2.el9.x86_64            lua-srpm-macros-1-6.el9.noarch                         ocaml-srpm-macros-6-6.el9.noarch
  openblas-srpm-macros-2-11.el9.noarch            perl-4:5.32.1-481.1.el9_6.x86_64                    perl-Algorithm-Diff-1.2010-4.el9.noarch                perl-Archive-Tar-2.38-6.el9.noarch
  perl-Archive-Zip-1.68-6.el9.noarch              perl-Attribute-Handlers-1.01-481.1.el9_6.noarch     perl-AutoSplit-5.74-481.1.el9_6.noarch                 perl-Benchmark-1.23-481.1.el9_6.noarch
  perl-CPAN-2.29-5.el9_6.noarch                   perl-CPAN-DistnameInfo-0.12-23.el9.noarch           perl-CPAN-Meta-2.150010-460.el9.noarch                 perl-CPAN-Meta-Requirements-2.140-461.el9.noarch
  perl-CPAN-Meta-YAML-0.018-461.el9.noarch        perl-Compress-Bzip2-2.28-5.el9.x86_64               perl-Compress-Raw-Bzip2-2.101-5.el9.x86_64             perl-Compress-Raw-Lzma-2.101-3.el9.x86_64
  perl-Compress-Raw-Zlib-2.101-5.el9.x86_64       perl-Config-Extensions-0.03-481.1.el9_6.noarch      perl-Config-Perl-V-0.33-4.el9.noarch                   perl-DBM_Filter-0.06-481.1.el9_6.noarch
  perl-DB_File-1.855-4.el9.x86_64                 perl-Data-OptList-0.110-17.el9.noarch               perl-Data-Section-0.200007-14.el9.noarch               perl-Devel-PPPort-3.62-4.el9.x86_64
  perl-Devel-Peek-1.28-481.1.el9_6.x86_64         perl-Devel-SelfStubber-1.06-481.1.el9_6.noarch      perl-Devel-Size-0.83-10.el9.x86_64                     perl-Digest-SHA-1:6.02-461.el9.x86_64
  perl-Digest-SHA1-2.13-34.el9.x86_64             perl-DirHandle-1.05-481.1.el9_6.noarch              perl-Dumpvalue-2.27-481.1.el9_6.noarch                 perl-Encode-Locale-1.05-21.el9.noarch
  perl-Encode-devel-4:3.08-462.el9.x86_64         perl-English-1.11-481.1.el9_6.noarch                perl-Env-1.04-460.el9.noarch                           perl-ExtUtils-CBuilder-1:0.280236-4.el9.noarch
  perl-ExtUtils-Command-2:7.60-3.el9.noarch       perl-ExtUtils-Constant-0.25-481.1.el9_6.noarch      perl-ExtUtils-Embed-1.35-481.1.el9_6.noarch            perl-ExtUtils-Install-2.20-4.el9.noarch
  perl-ExtUtils-MM-Utils-2:7.60-3.el9.noarch      perl-ExtUtils-MakeMaker-2:7.60-3.el9.noarch         perl-ExtUtils-Manifest-1:1.73-4.el9.noarch             perl-ExtUtils-Miniperl-1.09-481.1.el9_6.noarch
  perl-ExtUtils-ParseXS-1:3.40-460.el9.noarch     perl-File-Compare-1.100.600-481.1.el9_6.noarch      perl-File-Copy-2.34-481.1.el9_6.noarch                 perl-File-DosGlob-1.12-481.1.el9_6.x86_64
  perl-File-Fetch-1.00-4.el9.noarch               perl-File-HomeDir-1.006-4.el9.noarch                perl-File-Which-1.23-10.el9.noarch                     perl-FileCache-1.10-481.1.el9_6.noarch
  perl-Filter-2:1.60-4.el9.x86_64                 perl-Filter-Simple-0.96-460.el9.noarch              perl-FindBin-1.51-481.1.el9_6.noarch                   perl-GDBM_File-1.18-481.1.el9_6.x86_64
  perl-Hash-Util-0.23-481.1.el9_6.x86_64          perl-Hash-Util-FieldHash-1.20-481.1.el9_6.x86_64    perl-I18N-Collate-1.02-481.1.el9_6.noarch              perl-I18N-LangTags-0.44-481.1.el9_6.noarch
  perl-I18N-Langinfo-0.19-481.1.el9_6.x86_64      perl-IO-Compress-2.102-4.el9.noarch                 perl-IO-Compress-Lzma-2.101-4.el9.noarch               perl-IO-Zlib-1:1.11-4.el9.noarch
  perl-IPC-Cmd-2:1.04-461.el9.noarch              perl-IPC-SysV-2.09-4.el9.x86_64                     perl-IPC-System-Simple-1.30-6.el9.noarch               perl-Importer-0.026-4.el9.noarch
  perl-JSON-PP-1:4.06-4.el9.noarch                perl-Locale-Maketext-1.29-461.el9.noarch            perl-Locale-Maketext-Simple-1:0.21-481.1.el9_6.noarch  perl-MIME-Charset-1.012.2-15.el9.noarch
  perl-MRO-Compat-0.13-15.el9.noarch              perl-Math-BigInt-FastCalc-0.500.900-460.el9.x86_64  perl-Math-BigRat-0.2614-460.el9.noarch                 perl-Memoize-1.03-481.1.el9_6.noarch
  perl-Module-Build-2:0.42.31-9.el9.noarch        perl-Module-CoreList-1:5.20240609-1.el9.noarch      perl-Module-CoreList-tools-1:5.20240609-1.el9.noarch   perl-Module-Load-1:0.36-4.el9.noarch
  perl-Module-Load-Conditional-0.74-4.el9.noarch  perl-Module-Loaded-1:0.08-481.1.el9_6.noarch        perl-Module-Metadata-1.000037-460.el9.noarch           perl-Module-Signature-0.88-1.el9.noarch
  perl-NEXT-0.67-481.1.el9_6.noarch               perl-Net-1.02-481.1.el9_6.noarch                    perl-Net-Ping-2.74-5.el9.noarch                        perl-ODBM_File-1.16-481.1.el9_6.x86_64
  perl-Object-HashBase-0.009-7.el9.noarch         perl-Opcode-1.48-481.1.el9_6.x86_64                 perl-Package-Generator-1.106-23.el9.noarch             perl-Params-Check-1:0.38-461.el9.noarch
  perl-Params-Util-1.102-5.el9.x86_64             perl-Perl-OSType-1.010-461.el9.noarch               perl-PerlIO-via-QuotedPrint-0.09-4.el9.noarch          perl-Pod-Checker-4:1.74-4.el9.noarch
  perl-Pod-Functions-1.13-481.1.el9_6.noarch      perl-Pod-Html-1.25-481.1.el9_6.noarch               perl-Safe-2.41-481.1.el9_6.noarch                      perl-Search-Dict-1.07-481.1.el9_6.noarch
  perl-SelfLoader-1.26-481.1.el9_6.noarch         perl-Software-License-0.103014-12.el9.noarch        perl-Sub-Exporter-0.987-27.el9.noarch                  perl-Sub-Install-0.928-28.el9.noarch
  perl-Sys-Hostname-1.23-481.1.el9_6.x86_64       perl-Sys-Syslog-0.36-461.el9.x86_64                 perl-Term-Complete-1.403-481.1.el9_6.noarch            perl-Term-ReadLine-1.17-481.1.el9_6.noarch
  perl-Term-Size-Any-0.002-35.el9.noarch          perl-Term-Size-Perl-0.031-12.el9.x86_64             perl-Term-Table-0.015-8.el9.noarch                     perl-TermReadKey-2.38-11.el9.x86_64
  perl-Test-1.31-481.1.el9_6.noarch               perl-Test-Harness-1:3.42-461.el9.noarch             perl-Test-Simple-3:1.302183-4.el9.noarch               perl-Text-Abbrev-1.02-481.1.el9_6.noarch
  perl-Text-Balanced-2.04-4.el9.noarch            perl-Text-Diff-1.45-13.el9.noarch                   perl-Text-Glob-0.11-15.el9.noarch                      perl-Text-Template-1.59-5.el9.noarch
  perl-Thread-3.05-481.1.el9_6.noarch             perl-Thread-Queue-3.14-460.el9.noarch               perl-Thread-Semaphore-2.13-481.1.el9_6.noarch          perl-Tie-4.6-481.1.el9_6.noarch
  perl-Tie-File-1.06-481.1.el9_6.noarch           perl-Tie-Memoize-1.1-481.1.el9_6.noarch             perl-Tie-RefHash-1.40-4.el9.noarch                     perl-Time-1.03-481.1.el9_6.noarch
  perl-Time-HiRes-4:1.9764-462.el9.x86_64         perl-Time-Piece-1.3401-481.1.el9_6.x86_64           perl-Unicode-Collate-1.29-4.el9.x86_64                 perl-Unicode-LineBreak-2019.001-11.el9.x86_64
  perl-Unicode-Normalize-1.27-461.el9.x86_64      perl-Unicode-UCD-0.75-481.1.el9_6.noarch            perl-User-pwent-1.03-481.1.el9_6.noarch                perl-autodie-2.34-4.el9.noarch
  perl-autouse-1.11-481.1.el9_6.noarch            perl-bignum-0.51-460.el9.noarch                     perl-blib-1.07-481.1.el9_6.noarch                      perl-debugger-1.56-481.1.el9_6.noarch
  perl-deprecate-0.04-481.1.el9_6.noarch          perl-devel-4:5.32.1-481.1.el9_6.x86_64              perl-diagnostics-1.37-481.1.el9_6.noarch               perl-doc-5.32.1-481.1.el9_6.noarch
  perl-encoding-4:3.00-462.el9.x86_64             perl-encoding-warnings-0.13-481.1.el9_6.noarch      perl-experimental-0.022-6.el9.noarch                   perl-fields-2.27-481.1.el9_6.noarch
  perl-filetest-1.03-481.1.el9_6.noarch           perl-inc-latest-2:0.500-20.el9.noarch               perl-less-0.03-481.1.el9_6.noarch                      perl-lib-0.65-481.1.el9_6.x86_64
  perl-libnetcfg-4:5.32.1-481.1.el9_6.noarch      perl-local-lib-2.000024-13.el9.noarch               perl-macros-4:5.32.1-481.1.el9_6.noarch                perl-meta-notation-5.32.1-481.1.el9_6.noarch
  perl-open-1.12-481.1.el9_6.noarch               perl-perlfaq-5.20210520-1.el9.noarch                perl-ph-5.32.1-481.1.el9_6.x86_64                      perl-sigtrap-1.09-481.1.el9_6.noarch
  perl-sort-2.04-481.1.el9_6.noarch               perl-srpm-macros-1-41.el9.noarch                    perl-threads-1:2.25-460.el9.x86_64                     perl-threads-shared-1.61-460.el9.x86_64
  perl-utils-5.32.1-481.1.el9_6.noarch            perl-version-7:0.99.28-4.el9.x86_64                 perl-vmsish-1.04-481.1.el9_6.noarch                    pyproject-srpm-macros-1.16.2-1.el9.noarch
  python-srpm-macros-3.9-54.el9.noarch            qt5-srpm-macros-5.15.9-1.el9.noarch                 redhat-rpm-config-210-1.0.1.el9.noarch                 rust-srpm-macros-17-4.el9.noarch
  sombok-2.4.0-16.el9.x86_64                      systemtap-sdt-devel-5.3-3.0.1.el9.x86_64            systemtap-sdt-dtrace-5.3-3.0.1.el9.x86_64

Complete!
[root@pgdb01 postgresql-17.4]#

[root@pgdb01 postgresql-17.4]# make clean   <--- Cleanup due to error out
make -C doc clean
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/doc'
make -C src clean
..
..
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
make[1]: Nothing to be done for 'clean'.
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
rm -rf tmp_install/ portlock/
[root@pgdb01 postgresql-17.4]#

# Rerun make command
[root@pgdb01 postgresql-17.4]# make
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/include/catalog'
..
..
port -L../../../src/common   -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags  -lpgcommon -lpgport -lz -lreadline -lm  -o pg_isolation_regress
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/test/isolation'
make -C test/perl all
make[2]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/test/perl'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src/test/perl'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/src'
make -C config all
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
[root@pgdb01 postgresql-17.4]#

8. Install PostgreSQL

# Bin directory /pgbin/pgsql/17.4/ will get created by make install command. 

[root@pgdb01 postgresql-17.4]# make install
make -C ./src/backend generated-headers
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/src/backend'
make -C ../include/catalog generated-headers
..
..
make -C config install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/config'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/lib/pgxs/config'
/usr/bin/install -c -m 755 ./install-sh '/pgbin/pgsql/17.4/lib/pgxs/config/install-sh'
/usr/bin/install -c -m 755 ./missing '/pgbin/pgsql/17.4/lib/pgxs/config/missing'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/config'
[root@pgdb01 postgresql-17.4]#

[root@pgdb01 postgresql-17.4]# cd /pgbin/pgsql/17.4/
[root@pgdb01 17.4]# ll
total 16
drwxr-xr-x. 2 root root 4096 Apr 21 21:06 bin
drwxr-xr-x. 6 root root 4096 Apr 21 21:06 include
drwxr-xr-x. 4 root root 4096 Apr 21 21:06 lib
drwxr-xr-x. 6 root root 4096 Apr 21 21:06 share
[root@pgdb01 17.4]#

9. Install PostgreSQL Contrib for extensions

#Install Contrib

cd /pg_Backup/stage/postgresql-17.4
make -C contrib install

--- OR ----

cd /pg_Backup/stage/postgresql-17.4/contrib
make
make install

[root@pgdb01 ~]# cd /pg_Backup/stage/postgresql-17.4/contrib
[root@pgdb01 contrib]# make
..
..
make -C vacuumlo all
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -I../../src/interfaces/libpq -I. -I. -I../../src/include  -D_GNU_SOURCE   -c -o vacuumlo.o vacuumlo.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2  vacuumlo.o -L../../src/interfaces/libpq -lpq -L../../src/port -L../../src/common   -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags   -lpgcommon -lpgport -lz -lreadline -lm  -o vacuumlo
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
[root@pgdb01 contrib]#

[root@pgdb01 contrib]# make install
..
..
make -C unaccent install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/unaccent'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/lib'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/extension'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/extension'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/share/tsearch_data'
/usr/bin/install -c -m 755  unaccent.so '/pgbin/pgsql/17.4/lib/unaccent.so'
/usr/bin/install -c -m 644 ./unaccent.control '/pgbin/pgsql/17.4/share/extension/'
/usr/bin/install -c -m 644 ./unaccent--1.1.sql ./unaccent--1.0--1.1.sql  '/pgbin/pgsql/17.4/share/extension/'
/usr/bin/install -c -m 644 ./unaccent.rules '/pgbin/pgsql/17.4/share/tsearch_data/'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/unaccent'
make -C vacuumlo install
make[1]: Entering directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
/usr/bin/mkdir -p '/pgbin/pgsql/17.4/bin'
/usr/bin/install -c  vacuumlo '/pgbin/pgsql/17.4/bin'
make[1]: Leaving directory '/pg_Backup/stage/postgresql-17.4/contrib/vacuumlo'
[root@pgdb01 contrib]#

[root@pgdb01 contrib]# ls /pgbin/pgsql/17.4/share/extension
amcheck--1.0--1.1.sql     citext.control               hstore--1.5--1.6.sql       pageinspect--1.10--1.11.sql    pgrowlocks.control                  pg_visibility--1.0--1.1.sql
amcheck--1.0.sql          cube--1.0--1.1.sql           hstore--1.6--1.7.sql       pageinspect--1.11--1.12.sql    pg_stat_statements--1.0--1.1.sql    pg_visibility--1.1--1.2.sql
amcheck--1.1--1.2.sql     cube--1.1--1.2.sql           hstore--1.7--1.8.sql       pageinspect--1.1--1.2.sql      pg_stat_statements--1.10--1.11.sql  pg_visibility--1.1.sql
amcheck--1.2--1.3.sql     cube--1.2--1.3.sql           hstore.control             pageinspect--1.2--1.3.sql      pg_stat_statements--1.1--1.2.sql    pg_visibility.control
amcheck--1.3--1.4.sql     cube--1.2.sql                insert_username--1.0.sql   pageinspect--1.3--1.4.sql      pg_stat_statements--1.2--1.3.sql    pg_walinspect--1.0--1.1.sql
amcheck.control           cube--1.3--1.4.sql           insert_username.control    pageinspect--1.4--1.5.sql      pg_stat_statements--1.3--1.4.sql    pg_walinspect--1.0.sql
autoinc--1.0.sql          cube--1.4--1.5.sql           intagg--1.0--1.1.sql       pageinspect--1.5--1.6.sql      pg_stat_statements--1.4--1.5.sql    pg_walinspect.control
autoinc.control           cube.control                 intagg--1.1.sql            pageinspect--1.5.sql           pg_stat_statements--1.4.sql         plpgsql--1.0.sql
bloom--1.0.sql            dblink--1.0--1.1.sql         intagg.control             pageinspect--1.6--1.7.sql      pg_stat_statements--1.5--1.6.sql    plpgsql.control
bloom.control             dblink--1.1--1.2.sql         intarray--1.0--1.1.sql     pageinspect--1.7--1.8.sql      pg_stat_statements--1.6--1.7.sql    postgres_fdw--1.0--1.1.sql
btree_gin--1.0--1.1.sql   dblink--1.2.sql              intarray--1.1--1.2.sql     pageinspect--1.8--1.9.sql      pg_stat_statements--1.7--1.8.sql    postgres_fdw--1.0.sql
btree_gin--1.0.sql        dblink.control               intarray--1.2--1.3.sql     pageinspect--1.9--1.10.sql     pg_stat_statements--1.8--1.9.sql    postgres_fdw.control
btree_gin--1.1--1.2.sql   dict_int--1.0.sql            intarray--1.2.sql          pageinspect.control            pg_stat_statements--1.9--1.10.sql   refint--1.0.sql
btree_gin--1.2--1.3.sql   dict_int.control             intarray--1.3--1.4.sql     pg_buffercache--1.0--1.1.sql   pg_stat_statements.control          refint.control
btree_gin.control         dict_xsyn--1.0.sql           intarray--1.4--1.5.sql     pg_buffercache--1.1--1.2.sql   pgstattuple--1.0--1.1.sql           seg--1.0--1.1.sql
btree_gist--1.0--1.1.sql  dict_xsyn.control            intarray.control           pg_buffercache--1.2--1.3.sql   pgstattuple--1.1--1.2.sql           seg--1.1--1.2.sql
btree_gist--1.1--1.2.sql  earthdistance--1.0--1.1.sql  isn--1.0--1.1.sql          pg_buffercache--1.2.sql        pgstattuple--1.2--1.3.sql           seg--1.1.sql
btree_gist--1.2--1.3.sql  earthdistance--1.1--1.2.sql  isn--1.1--1.2.sql          pg_buffercache--1.3--1.4.sql   pgstattuple--1.3--1.4.sql           seg--1.2--1.3.sql
btree_gist--1.2.sql       earthdistance--1.1.sql       isn--1.1.sql               pg_buffercache--1.4--1.5.sql   pgstattuple--1.4--1.5.sql           seg--1.3--1.4.sql
btree_gist--1.3--1.4.sql  earthdistance.control        isn.control                pg_buffercache.control         pgstattuple--1.4.sql                seg.control
btree_gist--1.4--1.5.sql  file_fdw--1.0.sql            lo--1.0--1.1.sql           pg_freespacemap--1.0--1.1.sql  pgstattuple.control                 tablefunc--1.0.sql
btree_gist--1.5--1.6.sql  file_fdw.control             lo--1.1.sql                pg_freespacemap--1.1--1.2.sql  pg_surgery--1.0.sql                 tablefunc.control
btree_gist--1.6--1.7.sql  fuzzystrmatch--1.0--1.1.sql  lo.control                 pg_freespacemap--1.1.sql       pg_surgery.control                  tcn--1.0.sql
btree_gist.control        fuzzystrmatch--1.1--1.2.sql  ltree--1.0--1.1.sql        pg_freespacemap.control        pg_trgm--1.0--1.1.sql               tcn.control
citext--1.0--1.1.sql      fuzzystrmatch--1.1.sql       ltree--1.1--1.2.sql        pg_prewarm--1.0--1.1.sql       pg_trgm--1.1--1.2.sql               tsm_system_rows--1.0.sql
citext--1.1--1.2.sql      fuzzystrmatch.control        ltree--1.1.sql             pg_prewarm--1.1--1.2.sql       pg_trgm--1.2--1.3.sql               tsm_system_rows.control
citext--1.2--1.3.sql      hstore--1.1--1.2.sql         ltree--1.2--1.3.sql        pg_prewarm--1.1.sql            pg_trgm--1.3--1.4.sql               tsm_system_time--1.0.sql
citext--1.3--1.4.sql      hstore--1.2--1.3.sql         ltree.control              pg_prewarm.control             pg_trgm--1.3.sql                    tsm_system_time.control
citext--1.4--1.5.sql      hstore--1.3--1.4.sql         moddatetime--1.0.sql       pgrowlocks--1.0--1.1.sql       pg_trgm--1.4--1.5.sql               unaccent--1.0--1.1.sql
citext--1.4.sql           hstore--1.4--1.5.sql         moddatetime.control        pgrowlocks--1.1--1.2.sql       pg_trgm--1.5--1.6.sql               unaccent--1.1.sql
citext--1.5--1.6.sql      hstore--1.4.sql              pageinspect--1.0--1.1.sql  pgrowlocks--1.2.sql            pg_trgm.control                     unaccent.control
[root@pgdb01 contrib]# 

[root@pgdb01 contrib]# cd
[root@pgdb01 ~]# chown -R postgres:postgres /pgbin /pgData /pgWal /pgArch /pg_Backup
[root@pgdb01 ~]# chmod 700 /pgbin /pgData /pgWal /pgArch /pg_Backup
[root@pgdb01 ~]#

10. Set Environment Variables (As Postgres user)

# Switch to postgres user:

[root@pgdb01 17.4]# su - postgres
[postgres@pgdb01 ~]$

# Add below lines to .bash_profile and reload profile

export PGHOME=/pgbin/pgsql/17.4
export PATH=$PGHOME/bin:$PATH
export PGDATA=/pgData/pgsql/17.4

[postgres@pgdb01 ~]$ . .bash_profile
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ which psql
/pgbin/pgsql/17.4/bin/psql
[postgres@pgdb01 ~]$

11. Validation 1 (As Postgres user)

[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/pg_config
BINDIR = /pgbin/pgsql/17.4/bin
DOCDIR = /pgbin/pgsql/17.4/share/doc
HTMLDIR = /pgbin/pgsql/17.4/share/doc
INCLUDEDIR = /pgbin/pgsql/17.4/include
PKGINCLUDEDIR = /pgbin/pgsql/17.4/include
INCLUDEDIR-SERVER = /pgbin/pgsql/17.4/include/server
LIBDIR = /pgbin/pgsql/17.4/lib
PKGLIBDIR = /pgbin/pgsql/17.4/lib
LOCALEDIR = /pgbin/pgsql/17.4/share/locale
MANDIR = /pgbin/pgsql/17.4/share/man
SHAREDIR = /pgbin/pgsql/17.4/share
SYSCONFDIR = /pgbin/pgsql/17.4/etc
PGXS = /pgbin/pgsql/17.4/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE =  '--prefix=/pgbin/pgsql/17.4' '--with-pgport=5432'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,--as-needed -Wl,-rpath,'/pgbin/pgsql/17.4/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lz -lreadline -lm
VERSION = PostgreSQL 17.4
[postgres@pgdb01 ~]$

12. Initialize Database (As Postgres user)

# Read more about initdb
https://www.br8dba.com/initdb-postgresql-cluster-initialization/

[postgres@pgdb01 ~]$ mkdir -p /pgData/pgsql/17.4 /pgWal/pgsql/17.4
[postgres@pgdb01 ~]$

[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/initdb --pgdata=/pgData/pgsql/17.4 --waldir=/pgWal/pgsql/17.4 --wal-segsize=128
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_SG.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /pgData/pgsql/17.4 ... ok
fixing permissions on existing directory /pgWal/pgsql/17.4 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default "max_connections" ... 100
selecting default "shared_buffers" ... 128MB
selecting default time zone ... Asia/Singapore
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /pgbin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4 -l logfile start

[postgres@pgdb01 ~]$

13. Start Postgres Instance(As Postgres user)

[postgres@pgdb01 ~]$ /pgbin/pgsql/17.4/bin/pg_ctl -D /pgData/pgsql/17.4 -l logfile start
waiting for server to start.... done
server started
[postgres@pgdb01 ~]$

14. Validation (As Postgres user)

[postgres@pgdb01 ~]$ ps -ef | grep postgres
root       62627    3156  0 21:40 pts/0    00:00:00 su - postgres
postgres   62628   62627  0 21:40 pts/0    00:00:00 -bash
postgres 62707 1 0 21:50 ? 00:00:00 /pgbin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
postgres   62708   62707 0 21:50 ?        00:00:00 postgres: checkpointer
postgres   62709   62707 0 21:50 ?        00:00:00 postgres: background writer
postgres   62711   62707 0 21:50 ?        00:00:00 postgres: walwriter
postgres   62712   62707 0 21:50 ?        00:00:00 postgres: autovacuum launcher
postgres   62713   62707 0 21:50 ?        00:00:00 postgres: logical replication launcher
postgres   62715   62628 99 21:52 pts/0    00:00:00 ps -ef
postgres   62716   62628  0 21:52 pts/0    00:00:00 grep --color=auto postgres
[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ psql -c "SELECT VERSION();"
                                                    version
---------------------------------------------------------------------------------------------------------------
 PostgreSQL 17.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-11.0.2), 64-bit
(1 row)

[postgres@pgdb01 ~]$
[postgres@pgdb01 ~]$ psql
psql (17.4)
Type "help" for help.

postgres=# \l
                                                     List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------
 postgres | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |
 template0 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |             |             |        |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |             |             |        |           | postgres=CTc/postgres
(3 rows)

postgres=# \du
                             List of roles
 Role name |                         Attributes
-----------+------------------------------------------------------------
 postgres | Superuser, Create role, Create DB, Replication, Bypass RLS

postgres=#
postgres=# \q
[postgres@pgdb01 ~]$

15. Create systemctl service for PostgreSQL (as root user) - Optional 

# As root user

cat > /etc/systemd/system/postgresql-17.service <<'EOF'
[Unit]
Description=PostgreSQL 17 Database Server
Documentation=https://www.postgresql.org/docs/17/
After=network.target

[Service]
Type=forking

User=postgres
Group=postgres

# PostgreSQL Data Directory
Environment=PGDATA=/pgData/pgsql/17.4

# Start PostgreSQL
ExecStart=/pgbin/pgsql/17.4/bin/pg_ctl start -D ${PGDATA} -l ${PGDATA}/logfile

# Stop PostgreSQL
ExecStop=/pgbin/pgsql/17.4/bin/pg_ctl stop -D ${PGDATA} -m fast

# Reload PostgreSQL
ExecReload=/pgbin/pgsql/17.4/bin/pg_ctl reload -D ${PGDATA}

Restart=always
RestartSec=5

TimeoutSec=300

[Install]
WantedBy=multi-user.target
EOF
# Stop PostgreSQL as Postgres user using pg_ctl if running
# As postgres user
[postgres@pgdb02 ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@pgdb02 ~]$

# As root user 
# Enable PostgreSQL service at boot
[root@pgdb02 ~]# systemctl enable postgresql-17
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-17.service → /etc/systemd/system/postgresql-17.service.
[root@pgdb02 ~]#

# As root user
# Start PostgreSQL service
[root@pgdb02 ~]# systemctl start postgresql-17
[root@pgdb02 ~]#

# As root user
# Verify Status
[root@pgdb02 ~]# systemctl status postgresql-17
● postgresql-17.service - PostgreSQL 17 Database Server
     Loaded: loaded (/etc/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Sat 2026-06-20 16:08:44 +08; 16s ago
       Docs: https://www.postgresql.org/docs/17/
    Process: 3302 ExecStart=/pgbin/pgsql/17.4/bin/pg_ctl start -D ${PGDATA} -l ${PGDATA}/logfile (code=exited, status=0/SUCCESS)
   Main PID: 3305 (postgres)
      Tasks: 6 (limit: 15700)
     Memory: 21.4M
        CPU: 77ms
     CGroup: /system.slice/postgresql-17.service
             ├─3305 /pgbin/pgsql/17.4/bin/postgres -D /pgData/pgsql/17.4
             ├─3306 "postgres: checkpointer "
             ├─3307 "postgres: background writer "
             ├─3310 "postgres: walwriter "
             ├─3311 "postgres: autovacuum launcher "
             └─3312 "postgres: logical replication launcher "

Jun 20 16:08:43 pgdb02 systemd[1]: Starting PostgreSQL 17 Database Server...
Jun 20 16:08:44 pgdb02 pg_ctl[3302]: waiting for server to start.... done
Jun 20 16:08:44 pgdb02 pg_ctl[3302]: server started
Jun 20 16:08:44 pgdb02 systemd[1]: Started PostgreSQL 17 Database Server.
[root@pgdb02 ~]#
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.Thank you, Rajasekhar Amudala Email: br8dba@gmail.com Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL

PostgreSQL DBA Step by Step Learning

#PostgreSQL DBA Topics
1How to Install PostgreSQL ON Linux?
2How to Install PostgreSQL on Linux 7 using source code?
3How to START/STOP PostgreSQL ON Linux?
4How to Create Database in PostgreSQL?
5PostgreSQL User Management
6PostgreSQL pg_hba.conf Guide
7PostgreSQL Change Data Directory
8Understanding WAL Files in PostgreSQL – For Oracle DBAs
9Change PostgreSQL WAL Directory Path (pg_wal)
10Enable Archive Mode in PostgreSQL 17
11How to Disable ARCHIVELOG Mode
12PostgreSQL Tablespace Management
13PostgreSQL pg_dump and pg_restore Guide
14PostgreSQL Backup and Restore Using pg_dumpall and psql
15pg_basebackup – Backup, Restore, and Recovery
16Backup & Restore PostgreSQL DB Cluster to Another Host (No Archive Mode)
17Backup & Restore PostgreSQL DB Cluster on Same Host
18Restore PostgreSQL to New Host using pg_basebackup + WAL Archives
19PostgreSQL PITR – Point in Time Recovery
20Configure Streaming Replication in PostgreSQL
21Manual Failover in PostgreSQL Streaming Replication
22Convert Asynchronous Replication to Synchronous Replication

 

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL Versions & Features

PostgreSQL Versions & Key Features (as of April 2026)

VersionInitial ReleaseLatest MinorEnd of SupportKey New Features
18Sep 25, 202518.3 (Feb 2026)Nov 2030
  • Asynchronous I/O (AIO) subsystem
  • pg_upgrade preserves statistics
  • B-tree Skip Scan
  • UUIDv7 support
  • Virtual generated columns
  • OAuth 2.0 authentication
  • JSON_TABLE support
  • Better logical replication (DDL)
17Sep 26, 202417.9Nov 2029
  • Enhanced logical replication
  • Improved vacuum performance
  • Better monitoring
  • Incremental backup improvements
16Sep 14, 202316.13Nov 2028
  • Logical replication from standbys
  • Parallel VACUUM improvements
  • Improved query planner
15Oct 13, 202215.17Nov 2027
  • MERGE command
  • Compression (lz4, zstd)
  • Row-level security enhancements
14Sep 30, 202114.22Nov 2026
  • Schema-level privileges
  • Parallel query enhancements
  • JSON improvements
13Sep 24, 202013.23Nov 2025
  • Parallel vacuum
  • Incremental sorting
  • Logical replication enhancements

 

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

Backup and Restore on Same Host Using pg_basebackup

How to Backup and Restore PostgreSQL DB Cluster on the Same Host Using pg_basebackup

Table of Contents


1. Environment
2. Verify Existing DB Setup
3. Pre-requisites
4. Take Backup
5. Prepare & Restore
     5.1 Stop PostgreSQL and Clean Directories
     5.2 Remove all from Data & WAL directories
     5.3 Restore Data and WAL
         A. Copy Backup files to $PGDATA
         B. Copy WAL files from $PGDATA/pg_wal to /pgWal/pgsql17/wal/
         C. Remove the existing $PGDATA/pg_wal directory
         D. Create a symbolic link pointing $PGDATA/pg_wal to a separate WAL directory
         E. Set Permissions
6. Start PostgreSQL
7. Final Verification


1. Environment

ASPECTEnv
Hostnamelxicbpgdsgv01
IP Address192.168.2.51
OSRHEL 9
DB VersionPostgreSQL v17.6
Archive modearchive_mode=off
pgData/pgData/pgsql17/data
WAL Directory/pgWal/pgsql17/wal
Tablespacepg_default
DatabasesDELL, ORCL

2. Verify Existing DB Setup

[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# \l+
                                                                                       List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------+---------+------------+--------------------------------------------
 dell      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7763 kB | pg_default |
 orcl      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7907 kB | pg_default |
 postgres  | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 492 MB  | pg_default | default administrative connection database
 template0 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7545 kB | pg_default | unmodifiable empty database
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
 template1 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7723 kB | pg_default | default template for new databases
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
(5 rows)

postgres=# \db
       List of tablespaces
    Name    |  Owner   | Location
------------+----------+----------
 pg_default | postgres |
 pg_global  | postgres |
(2 rows)

postgres=# \c dell
You are now connected to database "dell" as user "postgres".
dell=# select * from test.emp;
 name | designation | project | company
------+-------------+---------+---------
 Sugi | DBA         | Jetstar | iGATE
 Teja | DBA         | RCM     | iGATE
 RAJ  | DBA         | RCM     | iGATE
(3 rows)

dell=#

3. Pre-requisites

  • Verify postgresql.conf
postgres=# SHOW wal_level;
 wal_level
-----------
 replica <----
(1 row)

postgres=#
postgres=# SHOW max_wal_senders;
 max_wal_senders
-----------------
 10
(1 row)

postgres=# SHOW archive_mode;
 archive_mode
--------------
 off
(1 row)

postgres=# 
  • Verify pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS             METHOD
# Local connections for replication (for pg_basebackup run locally)
local   replication     all                                 trust

# Remote connections for replication (for pg_basebackup run remotely)
#host    replication     repl_user       192.168.2.52/32     scram-sha-256

  • Verify user permissions:REPLICATION or SUPERUSER required
postgres=# \du
                             List of roles
 Role name |                         Attributes
-----------+------------------------------------------------------------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS

postgres=#
  • Verify free space for backup
[postgres@lxicbpgdsgv01 ~]$ du -sh /pgData/pgsql17/data/
524M    /pgData/pgsql17/data/
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ du -sh /pgWal/pgsql17/wal/
801M    /pgWal/pgsql17/wal/
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ df -h /pgBackup/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdd1       100G  746M  100G   1% /pgBackup <----
[postgres@lxicbpgdsgv01 ~]$ mkdir -p /pgBackup/pgsql17/backup/basebackup_10OCT2025
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ mkdir -p /pgBackup/pgsql17/backup/log/
[postgres@lxicbpgdsgv01 ~]$

4. Take Backup

[postgres@lxicbpgdsgv01 ~]$ ls -ltrh /pgWal/pgsql17/wal | wc -l
53 <---- 
[postgres@lxicbpgdsgv01 ~]$

pg_basebackup does not include all files from the pg_wal directory in the backup. Instead, it selectively includes only the WAL files required to make the base backup consistent at the point in time the backup was taken.

-- If you want to store the base backup and WAL files in separate backup directories. 

nohup pg_basebackup -U postgres -D /pgBackup/pgsql17/backup/basebackup_10OCT2025 --waldir=/pgBackup/pgsql17/backup/wal_backup -Fp -Xs -P -v > /pgBackup/pgsql17/backup/log/basebackup_10OCT2025.log 2>&1 &

The --waldir option in pg_basebackup is supported only when using the plain format (-Fp), not with the tar format (-Ft).

If we want symlinks preserved → use (both -Fp & --waldir use together) -Fp --waldir=/pgWal/pgsql17/wal

-- OR --

The directory mush be empty: /pgBackup/pgsql17/backup/basebackup_10OCT2025

[postgres@lxicbpgdsgv01 ~]$ nohup pg_basebackup -U postgres -D /pgBackup/pgsql17/backup/basebackup_10OCT2025 -Fp -Xs -P -v > /pgBackup/pgsql17/backup/log/basebackup_10OCT2025.log 2>&1 &
[1] 4973
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ cat /pgBackup/pgsql17/backup/log/basebackup_10OCT2025.log
nohup: ignoring input
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/85000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: created temporary replication slot "pg_basebackup_4975"
279413/536037 kB (52%), 0/1 tablespace (...asebackup_10OCT2025/base/5/16533)
536047/536047 kB (100%), 0/1 tablespace (...ckup_10OCT2025/global/pg_control)
536047/536047 kB (100%), 1/1 tablespace
pg_basebackup: write-ahead log end point: 0/85000158
pg_basebackup: waiting for background process to finish streaming ...
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed  <-----
[postgres@lxicbpgdsgv01 ~]$

5. Prepare & Restore

5.1 Stop PostgreSQL and Clean Directories

[root@lxicbpgdsgv01 ~]# systemctl stop postgresql-17.service
[root@lxicbpgdsgv01 ~]# 
[root@lxicbpgdsgv01 ~]# ps -ef | grep postgres
root        5057    3151  0 18:57 pts/0    00:00:00 grep --color=auto postgres
[root@lxicbpgdsgv01 ~]#

5.2 Remove all from Data & WAL directories

-- Remove all from PGDATA directory

[root@lxicbpgdsgv01 ~]# rm -rf /pgData/pgsql17/data/*
[root@lxicbpgdsgv01 ~]# ls -ltr /pgData/pgsql17/data/
total 0
[root@lxicbpgdsgv01 ~]#

-- Remove all from WAL directory 

[root@lxicbpgdsgv01 ~]# rm -rf /pgWal/pgsql17/wal/*
[root@lxicbpgdsgv01 ~]# ls -ltr /pgWal/pgsql17/wal/
total 0
[root@lxicbpgdsgv01 ~]#

5.3 Restore Data and WAL

A. Copy Backup files to $PGDATA
Since we did not use the -Fp format with the --waldir option, all required WAL files will be included in the backup under the default path: PGDATA/pg_wal.

[postgres@lxicbpgdsgv01 ~]$ ls -ltr /pgData/pgsql17/data/
total 0
[postgres@lxicbpgdsgv01 ~]$ cd /pgBackup/pgsql17/backup/basebackup_10OCT2025/
[postgres@lxicbpgdsgv01 basebackup_10OCT2025]$ cp -Rp * /pgData/pgsql17/data/
[postgres@lxicbpgdsgv01 basebackup_10OCT2025]$
[postgres@lxicbpgdsgv01 basebackup_10OCT2025]$ ls -ltr /pgData/pgsql17/data/
total 296
-rw-------. 1 postgres postgres    227 Oct 10 18:41 backup_label
drwx------. 4 postgres postgres     77 Oct 10 18:41 pg_wal
drwx------. 7 postgres postgres     59 Oct 10 18:41 base
drwx------. 4 postgres postgres     68 Oct 10 18:41 pg_logical
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_dynshmem
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_commit_ts
drwx------. 2 postgres postgres    110 Oct 10 18:41 log
-rw-------. 1 postgres postgres   1169 Oct 10 18:41 postgresql.conf.bkp_10sep2025
-rw-------. 1 postgres postgres  30702 Oct 10 18:41 postgresql.conf.bkp
-rw-------. 1 postgres postgres     88 Oct 10 18:41 postgresql.auto.conf
drwx------. 2 postgres postgres     18 Oct 10 18:41 pg_xact
-rw-------. 1 postgres postgres      3 Oct 10 18:41 PG_VERSION
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_twophase
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_tblspc
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_subtrans
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_stat_tmp
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_stat
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_snapshots
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_serial
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_replslot
drwx------. 2 postgres postgres      6 Oct 10 18:41 pg_notify
drwx------. 4 postgres postgres     36 Oct 10 18:41 pg_multixact
-rw-------. 1 postgres postgres   2640 Oct 10 18:41 pg_ident.conf
-rw-------. 1 postgres postgres   5600 Oct 10 18:41 pg_hba.conf
-rw-------. 1 postgres postgres   1171 Oct 10 18:41 postgresql.conf
drwx------. 2 postgres postgres   4096 Oct 10 18:41 global
-rw-------. 1 postgres postgres     30 Oct 10 18:41 current_logfiles
-rw-------. 1 postgres postgres 227736 Oct 10 18:41 backup_manifest
[postgres@lxicbpgdsgv01 basebackup_10OCT2025]$
B. Copy WAL files from $PGDATA/pg_wal to /pgWal/pgsql17/wal/
[postgres@lxicbpgdsgv01 ~]$ ls -ltr /pgWal/pgsql17/wal/
total 0
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ cd /pgData/pgsql17/data/pg_wal/
[postgres@lxicbpgdsgv01 pg_wal]$ cp -Rp * /pgWal/pgsql17/wal
[postgres@lxicbpgdsgv01 pg_wal]$
[postgres@lxicbpgdsgv01 pg_wal]$ ls -ltr /pgWal/pgsql17/wal
total 16384
drwx------. 2 postgres postgres        6 Oct 10 18:41 summaries
drwx------. 2 postgres postgres        6 Oct 10 18:41 archive_status
-rw-------. 1 postgres postgres 16777216 Oct 10 18:41 000000010000000000000085
[postgres@lxicbpgdsgv01 pg_wal]$ cd
[postgres@lxicbpgdsgv01 ~]$
C. Remove the existing $PGDATA/pg_wal directory
[postgres@lxicbpgdsgv01 ~]$ rm -rf /pgData/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv01 ~]$
D. Create a symbolic link pointing $PGDATA/pg_wal to a separate WAL directory
[postgres@lxicbpgdsgv01 ~]$ ln -s /pgWal/pgsql17/wal /pgData/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ ls -ld /pgData/pgsql17/data/pg_wal
lrwxrwxrwx. 1 postgres postgres 18 Oct 10 19:43 /pgData/pgsql17/data/pg_wal -> /pgWal/pgsql17/wal
[postgres@lxicbpgdsgv01 ~]$
E. Set Permissions
[postgres@lxicbpgdsgv01 ~]$ chown -R postgres:postgres /pgData/pgsql17/data
[postgres@lxicbpgdsgv01 ~]$ chmod 700 /pgData/pgsql17/data
[postgres@lxicbpgdsgv01 ~]$ chown -R postgres:postgres /pgWal/pgsql17/wal
[postgres@lxicbpgdsgv01 ~]$ chmod 700 /pgWal/pgsql17/wal

6. Start PostgreSQL

[root@lxicbpgdsgv01 ~]# systemctl start postgresql-17.service
[root@lxicbpgdsgv01 ~]# systemctl status postgresql-17.service
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-10-10 19:45:21 +08; 5s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 5230 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 5235 (postgres)
      Tasks: 7 (limit: 15835)
     Memory: 34.2M
        CPU: 94ms
     CGroup: /system.slice/postgresql-17.service
             ├─5235 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─5236 "postgres: logger "
             ├─5237 "postgres: checkpointer "
             ├─5238 "postgres: background writer "
             ├─5240 "postgres: walwriter "
             ├─5241 "postgres: autovacuum launcher "
             └─5242 "postgres: logical replication launcher "

Oct 10 19:45:21 lxicbpgdsgv01.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 10 19:45:21 lxicbpgdsgv01.rajasekhar.com postgres[5235]: 2025-10-10 19:45:21.177 +08 [5235] LOG:  redirecting log output to logging collector process
Oct 10 19:45:21 lxicbpgdsgv01.rajasekhar.com postgres[5235]: 2025-10-10 19:45:21.177 +08 [5235] HINT:  Future log output will appear in directory "log".
Oct 10 19:45:21 lxicbpgdsgv01.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv01 ~]#

7. Final Verification

[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# \l+
                                                                                       List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------+---------+------------+--------------------------------------------
 dell      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7609 kB | pg_default |
 orcl      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7753 kB | pg_default |
 postgres  | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 492 MB  | pg_default | default administrative connection database
 template0 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7545 kB | pg_default | unmodifiable empty database
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
 template1 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7569 kB | pg_default | default template for new databases
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
(5 rows)

postgres=# \db
       List of tablespaces
    Name    |  Owner   | Location
------------+----------+----------
 pg_default | postgres |
 pg_global  | postgres |
(2 rows)

postgres=# \c dell
You are now connected to database "dell" as user "postgres".
dell=# select * from test.emp;
 name | designation | project | company
------+-------------+---------+---------
 Sugi | DBA         | Jetstar | iGATE
 Teja | DBA         | RCM     | iGATE
 RAJ  | DBA         | RCM     | iGATE
(3 rows)

dell=#

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

Clone PostgreSQL Cluster from One Host to Another Using pg_basebackup (No Archive Mode)

How To Backup and Restore PostgreSQL DB Cluster from One Host to Another Using pg_basebackup (No Archive Mode)

Table of Contents


1. Goal
2. Environment (Source / Target)
3. Verify Existing Setup
4. Verify postgresql.conf
5. Verify pg_hba.conf
6. Verify Users
7. Directory Permissions
8. Take Backup
9. Verify Backup
10. Transfer Backup to Target
11. Prepare Target & Restore

                  11.1 Backup Target (Optional)
                  11.2 Stop PostgreSQL and Clean Directories
                  11.3 Restore Data and WAL
                  11.4 Set Permissions
                  11.5 Verify Restored Files
                  11.6 Create Symbolic Link for WAL

12. Start PostgreSQL on Target
13. Final Verification


In PostgreSQL, a cluster is a group of databases managed by one PostgreSQL server. This is just a standalone server, not like an Oracle RAC cluster.

1. Goal

1. Perform a consistent backup using pg_basebackup from lxicbpgdsgv01.
2. Restore the backup on lxicbpgdsgv02 without applying archived WALs.

2. Environment (Source / Target)

AspectSourceTargetDifference
Hostnamelxicbpgdsgv01lxicbpgdsgv02Different hostnames
IP Address192.168.2.51192.168.2.52Different IPs
OSRHEL 9RHEL 9Same
DB VersionPostgreSQL v17.6PostgreSQL v17.6Same
Archive modeNo ArchivelogNo ArchivelogSame
PGDATA/pgData/pgsql17/data/pgdata/pgsql17/dataDifferent path case (D vs d)
WAL Directory/pgWal/pgsql17/wal/pgwal/pgsql17/walDifferent path case (W vs w)
Tablespacepg_defaultpg_defaultSame
DatabasesDELL, ORCLNo DatabasesNeed to clone

 3. Verify Existing Setup

[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# \l+
                                                                                       List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------+---------+------------+--------------------------------------------
 dell      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7763 kB | pg_default |
 orcl      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7907 kB | pg_default |
 postgres  | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 492 MB  | pg_default | default administrative connection database
 template0 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7545 kB | pg_default | unmodifiable empty database
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
 template1 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7723 kB | pg_default | default template for new databases
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
(5 rows)

postgres=#

postgres=# \c dell
You are now connected to database "dell" as user "postgres".
dell=#

dell=# \db
       List of tablespaces
    Name    |  Owner   | Location
------------+----------+----------
 pg_default | postgres |
 pg_global  | postgres |
(2 rows)

dell=# 
dell=# \dn test
 List of schemas
 Name |  Owner
------+----------
 test | postgres
(1 row)

dell=#
dell=# \echo :AUTOCOMMIT
on
dell=#

dell=# CREATE TABLE test.emp ( name TEXT, designation TEXT, project TEXT, company TEXT);
CREATE TABLE
dell=# INSERT INTO test.emp VALUES ('Sugi', 'DBA', 'Jetstar', 'iGATE');
INSERT 0 1
dell=# INSERT INTO test.emp VALUES ('Teja', 'DBA', 'RCM', 'iGATE');
INSERT 0 1
dell=# INSERT INTO test.emp VALUES ('RAJ', 'DBA', 'RCM', 'iGATE');
INSERT 0 1
dell=#
dell=# select * from test.emp;
 name | designation | project | company
------+-------------+---------+---------
 Sugi | DBA         | Jetstar | iGATE
 Teja | DBA         | RCM     | iGATE
 RAJ  | DBA         | RCM     | iGATE
(3 rows)

dell=#

dell=# \c orcl
You are now connected to database "orcl" as user "postgres".
orcl=#
orcl=# \dt
            List of relations
 Schema |    Name     | Type  |  Owner
--------+-------------+-------+----------
 public | sample_data | table | postgres
(1 row)

orcl=#
orcl=# select count(*) from sample_data;
 count
-------
  1000  <----- 
(1 row)

orcl=#

4. Verify postgresql.conf


postgres=# SHOW wal_level;
 wal_level
-----------
 replica  <---- Should be replica
(1 row)

postgres=#
postgres=# SHOW max_wal_senders;
 max_wal_senders
-----------------
 10 <----- 
(1 row)

postgres=# SHOW archive_mode;
 archive_mode
--------------
 off  <----- No archive log mode
(1 row)

postgres=# show archive_command;
 archive_command
-----------------
 (disabled)
(1 row)

postgres=#

5. Verify pg_hba.conf

# TYPE  DATABASE        USER            ADDRESS             METHOD
# Local connections for replication (for pg_basebackup run locally)
local   replication     all                                 trust

# Remote connections for replication (for pg_basebackup run remotely)
#host    replication     repl_user       192.168.2.52/32     scram-sha-256

6. Verify user permissions:REPLICATION or SUPERUSER required

postgres=# \du
                             List of roles
 Role name |                         Attributes
-----------+------------------------------------------------------------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS

postgres=#

7. Directory Permissions for Backup

[postgres@lxicbpgdsgv01 ~]$ ls -ld /pgBackup/pgsql17/backup/
drwx------. 2 postgres postgres 6 Oct  9 18:46 /pgBackup/pgsql17/backup/
[postgres@lxicbpgdsgv01 ~]$

8. Take Backup

  • Want symlinks preserved → use (both -Fp & –waldir)-Fp --waldir=/pgWal/pgsql17/wal
  • Want single tar archive → use -Ft, but recreate symlinks after restore, for pg_wal
  • The –waldir option in pg_basebackup is supported only when using the plain format (-Fp), not with the tar format (-Ft).
[postgres@lxicbpgdsgv01 ~]$ nohup pg_basebackup -U postgres -D /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025 -Ft -Xs -P > /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025.log 2>&1 &
[1] 4438
[postgres@lxicbpgdsgv01 ~]$

**** I have forgot use -v (verbose option to get extra output)
nohup pg_basebackup -U postgres -D /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025 -Ft -Xs -P -v > /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025.log 2>&1 &

9. Verify Backup


[postgres@lxicbpgdsgv01 ~]$ cat /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025.log
nohup: ignoring input
waiting for checkpoint
133816/536026 kB (24%), 0/1 tablespace
299960/536026 kB (55%), 0/1 tablespace
447864/536026 kB (83%), 0/1 tablespace
536037/536037 kB (100%), 0/1 tablespace
536037/536037 kB (100%), 1/1 tablespace
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ ls -lrth /pgBackup/pgsql17/backup/pg_basebackup_lxicbpgdsgv01_10sep2025
total 540M
-rw-------. 1 postgres postgres 524M Oct  9 18:56 base.tar  
-rw-------. 1 postgres postgres 223K Oct  9 18:56 backup_manifest
-rw-------. 1 postgres postgres  17M Oct  9 18:56 pg_wal.tar 
[postgres@lxicbpgdsgv01 ~]$

10. Transfer Backup to Target


[postgres@lxicbpgdsgv01 pg_basebackup_lxicbpgdsgv01_10sep2025]$ scp * 192.168.2.52:/pgbackup/pgsql17/backup/
postgres@192.168.2.52's password:  
backup_manifest                   100%  222KB  30.7MB/s   00:00
base.tar                          100%  523MB  74.0MB/s   00:07
pg_wal.tar                        100%   16MB  43.5MB/s   00:00
[postgres@lxicbpgdsgv01 pg_basebackup_lxicbpgdsgv01_10sep2025]$

11. Prepare Target & Restore

-- List Source Backup files 
[postgres@lxicbpgdsgv02 ~]$ ls -lrth /pgbackup/pgsql17/backup
total 540M
-rw-------. 1 postgres postgres 223K Oct  9 19:08 backup_manifest
-rw-------. 1 postgres postgres 524M Oct  9 19:08 base.tar
-rw-------. 1 postgres postgres  17M Oct  9 19:08 pg_wal.tar
[postgres@lxicbpgdsgv02 ~]$

11.1 Backup Target (Optional)


nohup pg_basebackup -U postgres -D /pgbackup/pgsql17/pg_basebackup_lxicbpgdsgv02_10sep2025 -Ft -Xs -P > /pgbackup/pgsql17/pg_basebackup_lxicbpgdsgv02_10sep2025.log 2>&1 &

-- Verify Tablespaces path -- It's pg_default in our case
-- Verify WAL File (Redo log files) location 

[postgres@lxicbpgdsgv02 ~]$ ls -ltr /pgdata/pgsql17/data/pg_wal
lrwxrwxrwx. 1 postgres postgres 18 Oct  9 17:37 /pgdata/pgsql17/data/pg_wal -> /pgwal/pgsql17/wal
[postgres@lxicbpgdsgv02 ~]$

11.2 Stop PostgreSQL and Clean Directories

-- Stop PostgreSQL DB Cluster
[root@lxicbpgdsgv02 ~]# systemctl stop postgresql-17.service
[root@lxicbpgdsgv02 ~]#
[root@lxicbpgdsgv02 ~]# ps -ef | grep postgres
root       10259    7832  0 19:20 pts/0    00:00:00 grep --color=auto postgres
[root@lxicbpgdsgv02 ~]#

-- Remove all from Data directory 

[postgres@lxicbpgdsgv02 ~]$ rm -rf /pgdata/pgsql17/data/*
[postgres@lxicbpgdsgv02 ~]$ ls -ltr /pgdata/pgsql17/data/
total 0
[postgres@lxicbpgdsgv02 ~]$


-- Remove all from WAL directory 

[postgres@lxicbpgdsgv02 ~]$ rm -rf /pgwal/pgsql17/wal/*
[postgres@lxicbpgdsgv02 ~]$ ls -ltr /pgwal/pgsql17/wal/
total 0
[postgres@lxicbpgdsgv02 ~]$

11.3 Restore Data and WAL

-- List source backup files

[postgres@lxicbpgdsgv02 ~]$ cd /pgbackup/pgsql17/backup/
[postgres@lxicbpgdsgv02 backup]$ ls -ltr
total 552652
-rw-------. 1 postgres postgres    227724 Oct  9 19:08 backup_manifest
-rw-------. 1 postgres postgres 548901888 Oct  9 19:08 base.tar
-rw-------. 1 postgres postgres  16778752 Oct  9 19:08 pg_wal.tar
drwxr-xr-x. 3 postgres postgres        18 Oct  9 19:32 data_lxicbpgdsgv02_old
[postgres@lxicbpgdsgv02 backup]$

# Restore DATA Directory 
[postgres@lxicbpgdsgv02 ~]$ nohup tar -xvf /pgbackup/pgsql17/backup/base.tar -C /pgdata/pgsql17/data > /pgbackup/pgsql17/backup/base_restore.log 2>&1 &
[1] 11289
[postgres@lxicbpgdsgv02 ~]$


# Restore WAL Directory 

[postgres@lxicbpgdsgv02 ~]$ nohup tar -xvf /pgbackup/pgsql17/backup/pg_wal.tar -C /pgwal/pgsql17/wal > /pgbackup/pgsql17/backup/pg_wal_restore.log 2>&1 &
[1] 11304
[postgres@lxicbpgdsgv02 ~]$

-- OR -- 

# Restore base and WAL archives sequentially in a single command

nohup bash -c "tar -xvf /pgbackup/pgsql17/backup/base.tar -C /pgdata/pgsql17/data && tar -xvf /pgbackup/pgsql17/backup/pg_wal.tar -C /pgwal/pgsql17/wal" > /pgbackup/pgsql17/backup/fulltar_restore.log 2>&1 &

11.4 Set Permissions

[postgres@lxicbpgdsgv02 ~]$ chown -R postgres:postgres /pgdata/pgsql17/data
[postgres@lxicbpgdsgv02 ~]$ chmod 700 /pgdata/pgsql17/data
[postgres@lxicbpgdsgv02 ~]$
[postgres@lxicbpgdsgv02 ~]$ chown -R postgres:postgres /pgwal/pgsql17/wal
[postgres@lxicbpgdsgv02 ~]$ chmod 700 /pgwal/pgsql17/wal
[postgres@lxicbpgdsgv02 ~]$

11.5 Verify Restored Files

[postgres@lxicbpgdsgv02 ~]$ ls -ltr /pgdata/pgsql17/data
total 72
-rw-------. 1 postgres postgres    88 Sep 30 21:50 postgresql.auto.conf
drwx------. 2 postgres postgres    18 Sep 30 21:50 pg_xact
-rw-------. 1 postgres postgres     3 Sep 30 21:50 PG_VERSION
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_twophase
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_tblspc
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_subtrans
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_stat_tmp
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_snapshots
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_serial
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_notify
drwx------. 4 postgres postgres    36 Sep 30 21:50 pg_multixact
-rw-------. 1 postgres postgres  2640 Sep 30 21:50 pg_ident.conf
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_dynshmem
drwx------. 2 postgres postgres     6 Sep 30 21:50 pg_commit_ts
-rw-------. 1 postgres postgres 30702 Oct  7 18:20 postgresql.conf.bkp
drwx------. 2 postgres postgres    84 Oct  9 00:01 log
-rw-------. 1 postgres postgres  1169 Oct  9 16:31 postgresql.conf.bkp_10sep2025
-rw-------. 1 postgres postgres  1171 Oct  9 16:32 postgresql.conf
drwx------. 7 postgres postgres    59 Oct  9 18:08 base
drwx------. 2 postgres postgres     6 Oct  9 18:44 pg_stat
-rw-------. 1 postgres postgres    30 Oct  9 18:44 current_logfiles
-rw-------. 1 postgres postgres  5600 Oct  9 18:53 pg_hba.conf
-rw-------. 1 postgres postgres     0 Oct  9 18:56 tablespace_map
drwx------. 2 postgres postgres     6 Oct  9 18:56 pg_replslot
drwx------. 4 postgres postgres    68 Oct  9 18:56 pg_logical
-rw-------. 1 postgres postgres   227 Oct  9 18:56 backup_label
drwx------. 4 postgres postgres    45 Oct  9 20:06 pg_wal <--- Created as Directory, instead of symbolic link 
drwx------. 2 postgres postgres  4096 Oct  9 20:06 global
[postgres@lxicbpgdsgv02 ~]$
[postgres@lxicbpgdsgv02 ~]$ ls -ltr /pgwal/pgsql17/wal
total 16384
-rw-------. 1 postgres postgres 16777216 Oct  9 18:56 000000010000000000000045
[postgres@lxicbpgdsgv02 ~]$

Please note:

--- Want symlinks preserved → use -Fp
--- Want single tar archive → use -Ft, but recreate symlinks after restore, for pg_wal

11.6 Create Symbolic Link for WAL

[postgres@lxicbpgdsgv02 ~]$ ls -ld /pgdata/pgsql17/data/pg_wal
drwx------. 4 postgres postgres 45 Oct  9 20:06 /pgdata/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv02 ~]$
[postgres@lxicbpgdsgv02 ~]$ rm -rf /pgdata/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv02 ~]$ ln -s /pgwal/pgsql17/wal /pgdata/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv02 ~]$
[postgres@lxicbpgdsgv02 ~]$ ls -ld /pgdata/pgsql17/data/pg_wal
lrwxrwxrwx. 1 postgres postgres 18 Oct  9 21:04 /pgdata/pgsql17/data/pg_wal -> /pgwal/pgsql17/wal
[postgres@lxicbpgdsgv02 ~]$ 
[postgres@lxicbpgdsgv02 ~]$ cd /pgwal/pgsql17/wal
[postgres@lxicbpgdsgv02 wal]$ ll
total 16384
-rw-------. 1 postgres postgres 16777216 Oct  9 18:56 000000010000000000000045
[postgres@lxicbpgdsgv02 wal]$

12. Start PostgreSQL on Target — no recovery needed.

[root@lxicbpgdsgv02 ~]# systemctl start postgresql-17.service
[root@lxicbpgdsgv02 ~]# systemctl status postgresql-17.service
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Thu 2025-10-09 21:06:08 +08; 5s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 12375 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 12380 (postgres)
      Tasks: 7 (limit: 20496)
     Memory: 33.6M
        CPU: 114ms
     CGroup: /system.slice/postgresql-17.service
             ├─12380 /usr/pgsql-17/bin/postgres -D /pgdata/pgsql17/data
             ├─12381 "postgres: logger "
             ├─12382 "postgres: checkpointer "
             ├─12383 "postgres: background writer "
             ├─12385 "postgres: walwriter "
             ├─12386 "postgres: autovacuum launcher "
             └─12387 "postgres: logical replication launcher "

Oct 09 21:06:06 lxicbpgdsgv02.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 09 21:06:06 lxicbpgdsgv02.rajasekhar.com postgres[12380]: 2025-10-09 21:06:06.781 +08 [12380] LOG:  redirecting log output to logging collector process
Oct 09 21:06:06 lxicbpgdsgv02.rajasekhar.com postgres[12380]: 2025-10-09 21:06:06.781 +08 [12380] HINT:  Future log output will appear in directory "log".
Oct 09 21:06:08 lxicbpgdsgv02.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv02 ~]#

13. Final Verification

[postgres@lxicbpgdsgv02 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# \l+
                                                                                       List of databases
   Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------+---------+------------+--------------------------------------------
 dell      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7609 kB | pg_default |
 orcl      | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 7753 kB | pg_default |
 postgres  | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           |                       | 492 MB  | pg_default | default administrative connection database
 template0 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7545 kB | pg_default | unmodifiable empty database
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
 template1 | postgres | UTF8     | libc            | en_SG.UTF-8 | en_SG.UTF-8 |        |           | =c/postgres          +| 7569 kB | pg_default | default template for new databases
           |          |          |                 |             |             |        |           | postgres=CTc/postgres |         |            |
(5 rows)

postgres=# \db
       List of tablespaces
    Name    |  Owner   | Location
------------+----------+----------
 pg_default | postgres |
 pg_global  | postgres |
(2 rows)

postgres=#
postgres=# \c dell
You are now connected to database "dell" as user "postgres".
dell=# \dt test.*
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 test   | emp  | table | postgres
(1 row)

dell=#

dell=# select * from test.emp;  <---- We can see Data 
 name | designation | project | company
------+-------------+---------+---------
 Sugi | DBA         | Jetstar | iGATE
 Teja | DBA         | RCM     | iGATE
 RAJ  | DBA         | RCM     | iGATE
(3 rows)

dell=#
dell=# \c orcl
You are now connected to database "orcl" as user "postgres".
orcl=# \dt
            List of relations
 Schema |    Name     | Type  |  Owner
--------+-------------+-------+----------
 public | sample_data | table | postgres
(1 row)

orcl=#
orcl=# select count(*) from sample_data;
 count
-------
  1000 <----
(1 row)

orcl=#

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

Disable ARCHIVELOG Mode

How to Disable ARCHIVELOG Mode

Table of Contents


1. Verify Existing Archive Mode
2. Edit the archive settings
3. Restart PostgreSQL
4. Verify Current Mode
5. Verify WAL Archiving Behavior


1. Verify Existing Archive Mode

postgres=# SHOW archive_mode;
 archive_mode
--------------
 on  <------ 
(1 row)

postgres=#

postgres=# SHOW archive_command;
        archive_command
-------------------------------
 cp %p /pgArch/pgsql17/arch/%f  <----- 
(1 row)

postgres=#

2. Edit the archive settings


[postgres@lxicbpgdsgv01 ~]$ cp /pgData/pgsql17/data/postgresql.conf /pgData/pgsql17/data/postgresql.conf.bkp_10sep2025
[postgres@lxicbpgdsgv01 ~]$ vi /pgData/pgsql17/data/postgresql.conf

#archive_mode = on
#archive_command = 'cp %p /pgArch/pgsql17/arch/%f'

3. Restart PostgreSQL

[root@lxicbpgdsgv01 ~]# systemctl stop postgresql-17.service
[root@lxicbpgdsgv01 ~]#
[root@lxicbpgdsgv01 ~]# systemctl start  postgresql-17.service
[root@lxicbpgdsgv01 ~]#
[root@lxicbpgdsgv01 ~]# systemctl status postgresql-17.service
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Thu 2025-10-09 16:34:01 +08; 3s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 3492 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 3497 (postgres)
      Tasks: 7 (limit: 15835)
     Memory: 17.6M
        CPU: 92ms
     CGroup: /system.slice/postgresql-17.service
             ├─3497 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─3498 "postgres: logger "
             ├─3499 "postgres: checkpointer "
             ├─3500 "postgres: background writer "
             ├─3502 "postgres: walwriter "
             ├─3503 "postgres: autovacuum launcher "
             └─3504 "postgres: logical replication launcher "

Oct 09 16:34:01 lxicbpgdsgv01.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 09 16:34:01 lxicbpgdsgv01.rajasekhar.com postgres[3497]: 2025-10-09 16:34:01.929 +08 [3497] LOG:  redirecting log output to logging collector process
Oct 09 16:34:01 lxicbpgdsgv01.rajasekhar.com postgres[3497]: 2025-10-09 16:34:01.929 +08 [3497] HINT:  Future log output will appear in directory "log".
Oct 09 16:34:01 lxicbpgdsgv01.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv01 ~]#

4. Verify Current Mode

[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# SHOW archive_mode;
 archive_mode
--------------
 off  <------ it's disabled
(1 row)

postgres=# SHOW archive_command;
 archive_command
-----------------
 (disabled) <-------
(1 row)

postgres=#

5. Verify WAL Archiving Behavior


postgres=# CHECKPOINT;
CHECKPOINT
postgres=#
postgres=# CHECKPOINT;
CHECKPOINT
postgres=# CHECKPOINT;
CHECKPOINT
postgres=#
postgres=# exit
postgres=# SELECT pg_switch_wal();
 pg_switch_wal
---------------
 0/44000000
(1 row)

postgres=# SELECT pg_switch_wal();
 pg_switch_wal
---------------
 0/44000000
(1 row)

postgres=# SELECT pg_switch_wal();
 pg_switch_wal
---------------
 0/44000000
(1 row)

postgres=#
[postgres@lxicbpgdsgv01 ~]$ ls -ltr /pgArch/pgsql17/arch/
total 0  <---- Archivelogs not generating
[postgres@lxicbpgdsgv01 ~]$

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

Change PostgreSQL WAL Directory Path (pg_wal)

Change WAL Directory Path (pg_wal) in PostgreSQL

Table of Contents


0. Aim
1. Verify Existing pg_wal Directory
2. Create the New Directory
3. Stop PostgreSQL Service
4. Copy WAL Files to New Location
5. Backup Old WAL Directory
6. Create Symlink
7. Fix Permissions
8. Start PostgreSQL Service
9. Verify WAL Functionality
10. Remove Old WAL Directory (Optional)


0. Aim

To change the PostgreSQL 17 WAL File directory from its default location to new mount point

From : /pgData/pgsql17/data/pg_wal

TO : /pgWal/pgsql17/wal

1. Verify Existing pg_wal directory


[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# SELECT current_setting('data_directory') || '/pg_wal' AS wal_directory;
        wal_directory
-----------------------------
 /pgData/pgsql17/data/pg_wal  <----- 
(1 row)

postgres=# exit
[postgres@lxicbpgdsgv01 ~]$ ls -lrth /pgData/pgsql17/data/pg_wal
total 48M
drwx------. 2 postgres postgres   6 Sep 30 21:50 summaries
-rw-------. 1 postgres postgres 16M Oct  8 04:24 000000010000000000000008
-rw-------. 1 postgres postgres 16M Oct  8 16:08 000000010000000000000006
-rw-------. 1 postgres postgres 16M Oct  8 16:08 000000010000000000000007
drwx------. 2 postgres postgres  43 Oct  8 16:08 archive_status
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ du -sh /pgData/pgsql17/data/pg_wal
48M     /pgData/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv01 ~]$

2. Create the New Directory on a new disk

[root@lxicbpgdsgv01 ~]# mkdir -p /pgWal/pgsql17/wal
[root@lxicbpgdsgv01 ~]# chown postgres:postgres /pgWal/pgsql17/wal
[root@lxicbpgdsgv01 ~]# chmod 700 /pgWal/pgsql17/wal
[root@lxicbpgdsgv01 ~]#

3. Stop PostgreSQL Service

[root@lxicbpgdsgv01 ~]# systemctl stop postgresql-17.service
[root@lxicbpgdsgv01 ~]#
[root@lxicbpgdsgv01 ~]# ps -ef | grep postgres
root        6887    6721  0 16:08 pts/0    00:00:00 grep --color=auto postgres
[root@lxicbpgdsgv01 ~]#

4. Copy Existing WAL Files to New Location

[postgres@lxicbpgdsgv01 ~]$ nohup rsync -avh --progress /pgData/pgsql17/data/pg_wal/ /pgWal/pgsql17/wal/ > rsync_pgwal.log 2>&1 &
[1] 6943
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$
[1]+  Done                    nohup rsync -avh --progress /pgData/pgsql17/data/pg_wal/ /pgWal/pgsql17/wal/ > rsync_pgwal.log 2>&1
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ cat rsync_pgwal.log
nohup: ignoring input
sending incremental file list
./
000000010000000000000006
         16.78M 100%   81.89MB/s    0:00:00 (xfr#1, to-chk=5/7)
000000010000000000000007
         16.78M 100%   43.84MB/s    0:00:00 (xfr#2, to-chk=4/7)
000000010000000000000008
         16.78M 100%   31.07MB/s    0:00:00 (xfr#3, to-chk=3/7)
archive_status/
archive_status/000000010000000000000006.done
              0 100%    0.00kB/s    0:00:00 (xfr#4, to-chk=0/7)
summaries/

sent 50.34M bytes  received 107 bytes  33.56M bytes/sec
total size is 50.33M  speedup is 1.00
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ ls -lrth /pgWal/pgsql17/wal/
total 48M
drwx------. 2 postgres postgres   6 Sep 30 21:50 summaries
-rw-------. 1 postgres postgres 16M Oct  8 04:24 000000010000000000000008
-rw-------. 1 postgres postgres 16M Oct  8 16:08 000000010000000000000006
-rw-------. 1 postgres postgres 16M Oct  8 16:08 000000010000000000000007
drwx------. 2 postgres postgres  43 Oct  8 16:08 archive_status
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ du -sh /pgWal/pgsql17/wal/
48M     /pgWal/pgsql17/wal/
[postgres@lxicbpgdsgv01 ~]$

5. Move old directory as backup

[postgres@lxicbpgdsgv01 ~]$ mv /pgData/pgsql17/data/pg_wal /pgData/pgsql17/data/pg_wal.bak
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ ls -ld /pgData/pgsql17/data/pg_wal
ls: cannot access '/pgData/pgsql17/data/pg_wal': No such file or directory
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ ls -ld /pgData/pgsql17/data/pg_wal.bak
drwx------. 4 postgres postgres 141 Oct  8 16:08 /pgData/pgsql17/data/pg_wal.bak
[postgres@lxicbpgdsgv01 ~]$

6. Create symlink

[postgres@lxicbpgdsgv01 ~]$ ln -s /pgWal/pgsql17/wal /pgData/pgsql17/data/pg_wal
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ ls -ltr /pgData/pgsql17/data/pg_wal
lrwxrwxrwx. 1 postgres postgres 18 Oct  8 16:16 /pgData/pgsql17/data/pg_wal -> /pgWal/pgsql17/wal
[postgres@lxicbpgdsgv01 ~]$

7. Fix permissions (if required)

[postgres@lxicbpgdsgv01 ~]$ chown -R postgres:postgres /pgWal/pgsql17/wal

8. Start PostgreSQL Service

[root@lxicbpgdsgv01 ~]# systemctl start postgresql-17.service
[root@lxicbpgdsgv01 ~]#
[root@lxicbpgdsgv01 ~]# systemctl status postgresql-17.service
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-10-08 16:20:46 +08; 7s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 7079 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 7084 (postgres)
      Tasks: 8 (limit: 15835)
     Memory: 18.1M
        CPU: 94ms
     CGroup: /system.slice/postgresql-17.service
             ├─7084 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─7086 "postgres: logger "
             ├─7087 "postgres: checkpointer "
             ├─7088 "postgres: background writer "
             ├─7090 "postgres: walwriter "
             ├─7091 "postgres: autovacuum launcher "
             ├─7092 "postgres: archiver "
             └─7093 "postgres: logical replication launcher "

Oct 08 16:20:46 lxicbpgdsgv01.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 08 16:20:46 lxicbpgdsgv01.rajasekhar.com postgres[7084]: 2025-10-08 16:20:46.162 +08 [7084] LOG:  redirecting log output to logging collector process
Oct 08 16:20:46 lxicbpgdsgv01.rajasekhar.com postgres[7084]: 2025-10-08 16:20:46.162 +08 [7084] HINT:  Future log output will appear in directory "log".
Oct 08 16:20:46 lxicbpgdsgv01.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv01 ~]#

9. Verify

-- Load WAL File generation (Testing)

postgres=# -- Create test table
DROP TABLE IF EXISTS wal_test;
CREATE TABLE wal_test (
    id serial PRIMARY KEY,
    data text
);

-- Generate WAL traffic
DO $$
DECLARE
    i integer;
BEGIN
    FOR i IN 1..50 LOOP
        -- INSERT: 10,000 rows
        INSERT INTO wal_test (data)
        SELECT repeat('wal_test_data_', 50)
        FROM generate_series(1, 10000);

        -- UPDATE: 5,000 rows using CTE with LIMIT
        WITH to_update AS (
            SELECT id FROM wal_test WHERE id % 2 = 0 LIMIT 5000
        )
        UPDATE wal_test
        SET data = data || '_updated'
        WHERE id IN (SELECT id FROM to_update);

        -- DELETE: 5,000 rows using CTE with LIMIT
        WITH to_delete AS (
            SELECT id FROM wal_test WHERE id % 3 = 0 LIMIT 5000
        )
        DELETE FROM wal_test
        WHERE id IN (SELECT id FROM to_delete);

        -- Commit to flush WAL
        COMMIT;

        -- Optional pause to slow down the loop
        PERFORM pg_sleep(0.5);
    END LOOP;
END$$;
DROP TABLE
CREATE TABLE
DO
postgres=# exit
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ ls -lrth  /pgWal/pgsql17/wal
total 752M
drwx------. 2 postgres postgres    6 Sep 30 21:50 summaries
-rw-------. 1 postgres postgres  16M Oct  8 16:34 000000010000000000000009
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000A
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000B
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000C
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000D
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000E
-rw-------. 1 postgres postgres  16M Oct  8 16:34 00000001000000000000000F
-rw-------. 1 postgres postgres  16M Oct  8 16:34 000000010000000000000010
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000011
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000012
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000013
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000014
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000015
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000016
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000017
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000018
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000019
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001A
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001B
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001C
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001D
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001E
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000001F
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000020
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000021
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000022
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000023
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000024
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000025
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000026
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000027
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000028
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000029
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002A
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002B
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002C
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002D
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002E
-rw-------. 1 postgres postgres  16M Oct  8 16:35 00000001000000000000002F
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000030
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000031
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000032
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000033
-rw-------. 1 postgres postgres  16M Oct  8 16:35 000000010000000000000034
-rw-------. 1 postgres postgres  16M Oct  8 16:36 000000010000000000000035
drwx------. 2 postgres postgres 4.0K Oct  8 16:36 archive_status
-rw-------. 1 postgres postgres  16M Oct  8 16:36 xlogtemp.7289
[postgres@lxicbpgdsgv01 ~]$

10. Remove Old WAL Directory (Optional, later)

[postgres@lxicbpgdsgv01 ~]$ ls -ld /pgData/pgsql17/data/pg_wal.bak
drwx------. 4 postgres postgres 141 Oct  8 16:08 /pgData/pgsql17/data/pg_wal.bak
[postgres@lxicbpgdsgv01 ~]$ rm -rf /pgData/pgsql17/data/pg_wal.bak
[postgres@lxicbpgdsgv01 ~]$
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

Enable Archive Mode (WAL Archiving)

Enable Archive Mode in PostgreSQL 17


Table of Contents

0. Importance of Archive Log Files
1. Verify Existing Archive Mode
2. Ensure Archive Directory Exists
3. Edit postgresql.conf
4. Restart PostgreSQL
5. Verify the Configuration
6. Test Archiving Works


0. Importance of Archive Log Files

Archive log files, also known as WAL archives (Write-Ahead Log archives) , play a critical role in PostgreSQL for data protection, recovery, and replication.

A. Point-in-Time Recovery (PITR): Restore the database to a specific point in time, useful for accidental data changes or loss.
B. Continuous Backup: Works with base backups to enable robust disaster recovery.
C. Streaming Replication Support: Helps standby servers catch up if they fall behind.
D. Disaster Recovery: Enables full recovery after hardware or data corruption.
E. Data Audit & Analysis: Allows decoding WAL logs for auditing and compliance.

🛑 Important Note:

If WAL archiving is disabled and a backup is taken, you can only restore to the exact backup time, not to any point after.

1. Verify Existing Archive Mode

[postgres@lxicbpgdsgv01 ~]$ psql
psql (17.6)
Type "help" for help.

postgres=# SHOW archive_mode;
 archive_mode 
--------------
 off <--- it's off
(1 row)

postgres=# SHOW archive_command;
 archive_command 
-----------------
 (disabled) <----
(1 row)
[root@lxicbpgdsgv01 ~]# systemctl status postgresql-17
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-10-07 18:33:05 +08; 2min 26s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 5911 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 5916 (postgres)
      Tasks: 7 (limit: 15700)
     Memory: 21.3M
        CPU: 177ms
     CGroup: /system.slice/postgresql-17.service
             ├─5916 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─5917 "postgres: logger "
             ├─5918 "postgres: checkpointer "
             ├─5919 "postgres: background writer "
             ├─5921 "postgres: walwriter "
             ├─5922 "postgres: autovacuum launcher "
             └─5923 "postgres: logical replication launcher "

Oct 07 18:33:05 lxicbpgdsgv01.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 07 18:33:05 lxicbpgdsgv01.rajasekhar.com postgres[5916]: 2025-10-07 18:33:05.392 +08 [5916] LOG:  redirecting log output to logging collector process
Oct 07 18:33:05 lxicbpgdsgv01.rajasekhar.com postgres[5916]: 2025-10-07 18:33:05.392 +08 [5916] HINT:  Future log output will appear in directory "log".
Oct 07 18:33:05 lxicbpgdsgv01.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv01 ~]#

Currently, there is no active archive process running in the background.

2. Ensure Archive Directory Exists

[root@lxicbpgdsgv01 ~]# mkdir -p /pgArch/pgsql17/arch/
[root@lxicbpgdsgv01 ~]# chown postgres:postgres /pgArch/pgsql17/arch/
[root@lxicbpgdsgv01 ~]# chmod 700 /pgArch/pgsql17/arch/

3. Edit postgresql.conf

[postgres@lxicbpgdsgv01 ~]$ vi /pgData/pgsql17/data/postgresql.conf

Update or add the following lines:

archive_mode = on
archive_command = 'cp %p /pgArch/pgsql17/arch/%f'

Explanation:

  • %p = Full path of WAL file
  • %f = WAL file name
  • cp %p /pgArch/pgsql17/arch/%f = Command to copy the WAL file to archive directory

4. Restart PostgreSQL

[root@lxicbpgdsgv01 ~]# systemctl status postgresql-17
● postgresql-17.service - PostgreSQL 17 database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql-17.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-10-07 23:48:29 +08; 18s ago
       Docs: https://www.postgresql.org/docs/17/static/
    Process: 7868 ExecStartPre=/usr/pgsql-17/bin/postgresql-17-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
   Main PID: 7873 (postgres)
      Tasks: 8 (limit: 15700)
     Memory: 19.0M
        CPU: 96ms
     CGroup: /system.slice/postgresql-17.service
             ├─7873 /usr/pgsql-17/bin/postgres -D /pgData/pgsql17/data/
             ├─7874 "postgres: logger "
             ├─7875 "postgres: checkpointer "
             ├─7876 "postgres: background writer "
             ├─7878 "postgres: walwriter "
             ├─7879 "postgres: autovacuum launcher "
             ├─7880 "postgres: archiver "  <------
             └─7881 "postgres: logical replication launcher "

Oct 07 23:48:29 lxicbpgdsgv01.rajasekhar.com systemd[1]: Starting PostgreSQL 17 database server...
Oct 07 23:48:29 lxicbpgdsgv01.rajasekhar.com postgres[7873]: 2025-10-07 23:48:29.503 +08 [7873] LOG:  redirecting log output to logging collector process
Oct 07 23:48:29 lxicbpgdsgv01.rajasekhar.com postgres[7873]: 2025-10-07 23:48:29.503 +08 [7873] HINT:  Future log output will appear in directory "log".
Oct 07 23:48:29 lxicbpgdsgv01.rajasekhar.com systemd[1]: Started PostgreSQL 17 database server.
[root@lxicbpgdsgv01 ~]#

Make sure the archiver process is running.

5. Verify the Configuration

[postgres@lxicbpgdsgv01 ~]$ psql -c "SHOW archive_mode;"
 archive_mode 
--------------
 on <-----------
(1 row)

[postgres@lxicbpgdsgv01 ~]$ psql -c "SHOW archive_command;"
        archive_command         
-------------------------------
 cp %p /pgArch/pgsql17/arch/%f  <-----------------
(1 row)

6. Test Archiving Works

[postgres@lxicbpgdsgv01 ~]$ psql -c "SELECT pg_switch_wal();"

Check archive folder for new WAL files:

[postgres@lxicbpgdsgv01 ~]$ ls -lrth /pgArch/pgsql17/arch/
total 16M
-rw-------. 1 postgres postgres 16M Oct  7 23:50 000000010000000000000001

[postgres@lxicbpgdsgv01 ~]$ psql -c "SELECT pg_switch_wal();"
[postgres@lxicbpgdsgv01 ~]$ ls -lrth /pgArch/pgsql17/arch/
total 32M
-rw-------. 1 postgres postgres 16M Oct  7 23:50 000000010000000000000001
-rw-------. 1 postgres postgres 16M Oct  7 23:51 000000010000000000000002

 Archiving is working successfully.

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL Backup and Restore Using pg_dumpall

PostgreSQL Backup and Restore Using pg_dumpall and psql

Table of Contents


0. Introduction

Backup:

1. Backup All Databases
2. Backup Users/Roles Definition
3. Backup Tablespaces Definition
4. Backup Schema Only (No Data)
5. Backup Data Only (No Schema)
6. Backup Data as INSERT Commands
7. Backup Global Objects Only (No Databases)

Restore:

8. Restore on Same Host

9. Restore to Another Host (Different Tablespace Paths)


Click to expand pg_dumpall –help
[postgres@lxtrdpgdsgv01 ~]$ pg_dumpall --help
pg_dumpall extracts a PostgreSQL database cluster into an SQL script file.

Usage:
  pg_dumpall [OPTION]...

General options:
  -f, --file=FILENAME          output file name
  -v, --verbose                verbose mode
  -V, --version                output version information, then exit
  --lock-wait-timeout=TIMEOUT  fail after waiting TIMEOUT for a table lock
  -?, --help                   show this help, then exit

Options controlling the output content:
  -a, --data-only              dump only the data, not the schema
  -c, --clean                  clean (drop) databases before recreating
  -E, --encoding=ENCODING      dump the data in encoding ENCODING
  -g, --globals-only           dump only global objects, no databases
  -O, --no-owner               skip restoration of object ownership
  -r, --roles-only             dump only roles, no databases or tablespaces
  -s, --schema-only            dump only the schema, no data
  -S, --superuser=NAME         superuser user name to use in the dump
  -t, --tablespaces-only       dump only tablespaces, no databases or roles
  -x, --no-privileges          do not dump privileges (grant/revoke)
  --binary-upgrade             for use by upgrade utilities only
  --column-inserts             dump data as INSERT commands with column names
  --disable-dollar-quoting     disable dollar quoting, use SQL standard quoting
  --disable-triggers           disable triggers during data-only restore
  --exclude-database=PATTERN   exclude databases whose name matches PATTERN
  --extra-float-digits=NUM     override default setting for extra_float_digits
  --if-exists                  use IF EXISTS when dropping objects
  --inserts                    dump data as INSERT commands, rather than COPY
  --load-via-partition-root    load partitions via the root table
  --no-comments                do not dump comments
  --no-publications            do not dump publications
  --no-role-passwords          do not dump passwords for roles
  --no-security-labels         do not dump security label assignments
  --no-subscriptions           do not dump subscriptions
  --no-sync                    do not wait for changes to be written safely to disk
  --no-table-access-method     do not dump table access methods
  --no-tablespaces             do not dump tablespace assignments
  --no-toast-compression       do not dump TOAST compression methods
  --no-unlogged-table-data     do not dump unlogged table data
  --on-conflict-do-nothing     add ON CONFLICT DO NOTHING to INSERT commands
  --quote-all-identifiers      quote all identifiers, even if not key words
  --restrict-key=RESTRICT_KEY  use provided string as psql \restrict key
  --rows-per-insert=NROWS      number of rows per INSERT; implies --inserts
  --use-set-session-authorization
                               use SET SESSION AUTHORIZATION commands instead of
                               ALTER OWNER commands to set ownership

Connection options:
  -d, --dbname=CONNSTR     connect using connection string
  -h, --host=HOSTNAME      database server host or socket directory
  -l, --database=DBNAME    alternative default database
  -p, --port=PORT          database server port number
  -U, --username=NAME      connect as specified database user
  -w, --no-password        never prompt for password
  -W, --password           force password prompt (should happen automatically)
  --role=ROLENAME          do SET ROLE before dump

If -f/--file is not used, then the SQL script will be written to the standard
output.

Report bugs to <pgsql-bugs@lists.postgresql.org>.
PostgreSQL home page: <https://www.postgresql.org/>
[postgres@lxtrdpgdsgv01 ~]$

 

0. Introduction

Note: pg_dumpall does not support custom format backups.

The pg_dumpall utility is used to back up an entire PostgreSQL environment, including:

* Roles and users
* Tablespaces
* All databases (schemas and data)

It is especially useful for:

* Full cluster migrations
* Disaster recovery
* Environment replication across dev, QA, and prod

When restoring to a different host, you'll need to:

* Update tablespace paths (using tools like sed)
* Pre-create required tablespace directories

This ensures compatibility and successful restoration across different environments.

Backup


1. Backup ALL databases

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.log 2>&1 &
[1] 5610
[postgres@lxtrdpgdsgv01 ~]$ 
[postgres@lxtrdpgdsgv01 ~]$ cat /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.log | grep -i /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql
pg_dumpall: running ""/usr/pgsql-15/bin/pg_dump"  -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql  -Fa 'user=postgres dbname=template1'"
pg_dumpall: running ""/usr/pgsql-15/bin/pg_dump"  -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql --create -Fa 'user=postgres dbname=edpua'"
pg_dumpall: running ""/usr/pgsql-15/bin/pg_dump"  -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql --create -Fa 'user=postgres dbname=gebua'"
pg_dumpall: running ""/usr/pgsql-15/bin/pg_dump"  -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql --create -Fa 'user=postgres dbname=orcl'"
pg_dumpall: running ""/usr/pgsql-15/bin/pg_dump"  -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql  -Fa 'user=postgres dbname=postgres'"
[postgres@lxtrdpgdsgv01 ~]$

[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \c orcl
You are now connected to database "orcl" as user "postgres".
orcl=# SELECT
orcl-#     schemaname || '.' || relname AS table_name,
orcl-#     pg_size_pretty(pg_total_relation_size(relid)) AS total_size,
orcl-#     pg_size_pretty(pg_relation_size(relid)) AS table_size,
orcl-#     pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS index_size
orcl-# FROM
orcl-#     pg_catalog.pg_statio_user_tables
orcl-# ORDER BY
orcl-#     pg_total_relation_size(relid) DESC;
    table_name    | total_size | table_size | index_size
------------------+------------+------------+------------
 trd.metrics_high | 799 MB     | 498 MB     | 301 MB
 trd.metrics_mid  | 638 MB     | 398 MB     | 240 MB
 trd.employees    | 493 MB     | 322 MB     | 172 MB
 trd.sales_2023   | 399 MB     | 249 MB     | 150 MB
 trd.sales_2024   | 399 MB     | 249 MB     | 150 MB
 trd.sales_2022   | 399 MB     | 249 MB     | 150 MB
 trd.sales_2021   | 398 MB     | 248 MB     | 150 MB
 trd.metrics_low  | 159 MB     | 99 MB      | 60 MB
 trd.test_data    | 71 MB      | 50 MB      | 21 MB
 trd.emp_summary  | 24 kB      | 8192 bytes | 16 kB
 trd.metrics_rest | 8192 bytes | 0 bytes    | 8192 bytes
(11 rows)

orcl=#


2. Backup users/roles definition

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --roles-only -v -f /pgBackup/pgsql15/backup/roles.sql > /pgBackup/pgsql15/backup/roles.log 2>&1 &
[1] 5205
[postgres@lxtrdpgdsgv01 ~]$


3. Backup tablespaces definition

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --tablespaces-only -v -f /pgBackup/pgsql15/backup/tablespaces.sql > /pgBackup/pgsql15/backup/tablespaces.log 2>&1 &
[1] 5183
[postgres@lxtrdpgdsgv01 ~]$


4. Backup dump only the schema, no data

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --schema-only -v -f /pgBackup/pgsql15/backup/schemas.sql > /pgBackup/pgsql15/backup/schemas.log 2>&1 &
[1] 4890
[postgres@lxtrdpgdsgv01 ~]$ 


5. Backup dump only the data, not the schema

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --data-only -v -f /pgBackup/pgsql15/backup/dataonly.sql > /pgBackup/pgsql15/backup/dataonly.log 2>&1 &
[1] 5233
[postgres@lxtrdpgdsgv01 ~]$ 


6. Backup dump data as INSERT commands, rather than COPY

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --inserts -v -f /pgBackup/pgsql15/backup/inserts.sql > /pgBackup/pgsql15/backup/inserts.log 2>&1 &
[1] 5274
[postgres@lxtrdpgdsgv01 ~]$


7. Backup dump only global objects, no databases

[postgres@lxtrdpgdsgv01 ~]$ nohup pg_dumpall -U postgres --globals-only -v -f /pgBackup/pgsql15/backup/globals.sql > /pgBackup/pgsql15/backup/globals.log 2>&1 &
[1] 5331
[postgres@lxtrdpgdsgv01 ~]$

Restore


8. Restore on same host


A. Drop Existing Databases (Optional)

 

[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 edpua     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 gebua     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 orcl      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | postgres=CTc/postgres+
           |          |          |             |             |            |                 | =c/postgres
(6 rows)

postgres=# drop database edpua;
DROP DATABASE
postgres=# drop database gebua;
DROP DATABASE
postgres=# drop database orcl;
DROP DATABASE
postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | postgres=CTc/postgres+
           |          |          |             |             |            |                 | =c/postgres
(3 rows)

postgres=#

postgres=# \db
             List of tablespaces
    Name    |  Owner   |      Location
------------+----------+---------------------
 edpua_ix   | postgres | /pgIx/pgsql15/edpua
 edpua_tb   | postgres | /pgTb/pgsql15/edpua
 gebua_ix   | postgres | /pgIx/pgsql15/gebua
 gebua_tb   | postgres | /pgTb/pgsql15/gebua
 orcl_ix    | postgres | /pgIx/pgsql15/orcl
 orcl_tb    | postgres | /pgTb/pgsql15/orcl
 pg_default | postgres |
 pg_global  | postgres |
(8 rows)

postgres=#


B. Restore Full Backup

[postgres@lxtrdpgdsgv01 ~]$ nohup psql -U postgres -X -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql -d postgres > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_restore.log
[1] 4132
[postgres@lxtrdpgdsgv01 ~]$ 

-- OR --

nohup psql -U postgres -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_restore.log 2>&1 &

-- Log: backup_all_databases_10OCT2025_restore.log


C. Verification

[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 edpua     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 gebua     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 orcl      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | postgres=CTc/postgres+
           |          |          |             |             |            |                 | =c/postgres
(6 rows)

postgres=#


9. Restore to Another Host (Different Tablespace Paths)

A. Copy Backup File

[postgres@lxtrdpgdsgv01 backup]$ scp backup_all_databases_10OCT2025.sql 192.168.2.31:/pgBackup/pgsql15/backup/
postgres@192.168.2.31's password:
backup_all_databases_10OCT2025.sql                 100% 3556MB  51.5MB/s   01:09
[postgres@lxtrdpgdsgv01 backup]$ 

[postgres@pg17 backup]$ ls -ltr backup_all_databases_10OCT2025.sql
-rw-r--r--. 1 postgres postgres 3729147646 Oct  6 06:17 backup_all_databases_10OCT2025.sql
[postgres@pg17 backup]$


B. Extract Tablespace/Database Info

[postgres@lxtrdpgdsgv01 backup]$ grep -i "CREATE TABLESPACE" /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql
CREATE TABLESPACE orcl_tb OWNER postgres LOCATION '/pgTb/pgsql15/orcl';
CREATE TABLESPACE orcl_ix OWNER postgres LOCATION '/pgIx/pgsql15/orcl';
CREATE TABLESPACE gebua_tb OWNER postgres LOCATION '/pgTb/pgsql15/gebua';
CREATE TABLESPACE gebua_ix OWNER postgres LOCATION '/pgIx/pgsql15/gebua';
CREATE TABLESPACE edpua_tb OWNER postgres LOCATION '/pgTb/pgsql15/edpua';
CREATE TABLESPACE edpua_ix OWNER postgres LOCATION '/pgIx/pgsql15/edpua';
[postgres@lxtrdpgdsgv01 backup]$
[postgres@lxtrdpgdsgv01 backup]$ grep -i "CREATE DATABASE" /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql
CREATE DATABASE edpua WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8' TABLESPACE = edpua_tb;
CREATE DATABASE gebua WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8' TABLESPACE = gebua_tb;
CREATE DATABASE orcl WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8' TABLESPACE = orcl_tb;
[postgres@lxtrdpgdsgv01 backup]$


C. Create Tablespace Directories on Target

[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider |   Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | =c/postgres          +
           |          |          |             |             |            |                 | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            | postgres=CTc/postgres+
           |          |          |             |             |            |                 | =c/postgres
(3 rows)

postgres=#
postgres=# \db
       List of tablespaces
    Name    |  Owner   | Location
------------+----------+----------
 pg_default | postgres |
 pg_global  | postgres |
(2 rows)

postgres=#


# Create Directory 

[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/orcl_tb
[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/orcl_ix
[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/gebua_tb
[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/gebua_ix
[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/edpua_tb
[postgres@pg17 ~]$ mkdir -p /pgData/pgsql15/edpua_ix


D. Create Tablespaces in PostgreSQL

postgres=# CREATE TABLESPACE orcl_tb OWNER postgres LOCATION  '/pgData/pgsql15/orcl_tb';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE orcl_ix OWNER postgres LOCATION  '/pgData/pgsql15/orcl_ix';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE gebua_tb OWNER postgres LOCATION '/pgData/pgsql15/gebua_tb';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE gebua_ix OWNER postgres LOCATION '/pgData/pgsql15/gebua_ix';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE edpua_tb OWNER postgres LOCATION '/pgData/pgsql15/edpua_tb';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE edpua_ix OWNER postgres LOCATION '/pgData/pgsql15/edpua_ix';
CREATE TABLESPACE
postgres=#


-- OR --- 
 You can modify the tablespace paths directly in the backup file; however, this approach is not recommended for large backup files due to  reliability concerns.

cd /pgBackup/pgsql15/backup/
# Replace ORCL paths
sed -i 's|/pgTb/pgsql15/orcl|/pgData/pgsql15/orcl_tb|g' backup_all_databases_10OCT2025.sql
sed -i 's|/pgIx/pgsql15/orcl|/pgData/pgsql15/orcl_ix|g' backup_all_databases_10OCT2025.sql

# Replace GEBUA paths
sed -i 's|/pgTb/pgsql15/gebua|/pgData/pgsql15/gebua_tb|g' backup_all_databases_10OCT2025.sql
sed -i 's|/pgIx/pgsql15/gebua|/pgData/pgsql15/gebua_ix|g' backup_all_databases_10OCT2025.sql

# Replace EDPUA paths
sed -i 's|/pgTb/pgsql15/edpua|/pgData/pgsql15/edpua_tb|g' backup_all_databases_10OCT2025.sql
sed -i 's|/pgIx/pgsql15/edpua|/pgData/pgsql15/edpua_ix|g' backup_all_databases_10OCT2025.sql


[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# \db
               List of tablespaces
    Name    |  Owner   |         Location
------------+----------+--------------------------
 edpua_ix   | postgres | /pgData/pgsql15/edpua_ix
 edpua_tb   | postgres | /pgData/pgsql15/edpua_tb
 gebua_ix   | postgres | /pgData/pgsql15/gebua_ix
 gebua_tb   | postgres | /pgData/pgsql15/gebua_tb
 orcl_ix    | postgres | /pgData/pgsql15/orcl_ix
 orcl_tb    | postgres | /pgData/pgsql15/orcl_tb
 pg_default | postgres |
 pg_global  | postgres |
(8 rows)

postgres=# 


E. Optional: Backup on Target Host

[postgres@pg17 ~]$ nohup pg_dumpall -U postgres -v -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_pg17.sql > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_pg17.log 2>&1 &
[1] 4246
[postgres@pg17 ~]$


F. Restore on Target Host

[postgres@pg17 ~]$ nohup psql -U postgres -X -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql -d postgres > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_restore_pg17.log 2>&1 &
[1] 5213
[postgres@pg17 ~]$ 

-- OR --

nohup psql -U postgres -f /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025.sql > /pgBackup/pgsql15/backup/backup_all_databases_10OCT2025_restore_pg17.log 2>&1 &

-- Log: backup_all_databases_10OCT2025_restore_pg17.log


G. Final Verification

[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | ICU Locale | Locale Provider | Access privileges
-----------+----------+----------+-------------+-------------+------------+-----------------+-----------------------
 edpua | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
gebua | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
orcl | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | =c/postgres +
| | | | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | libc | postgres=CTc/postgres+
| | | | | | | =c/postgres
(6 rows)

postgres=#

[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# \c orcl
You are now connected to database "orcl" as user "postgres".
orcl=# SELECT
orcl-# schemaname || '.' || relname AS table_name,
orcl-# pg_size_pretty(pg_total_relation_size(relid)) AS total_size,
orcl-# pg_size_pretty(pg_relation_size(relid)) AS table_size,
orcl-# pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) AS index_size
orcl-# FROM
orcl-# pg_catalog.pg_statio_user_tables
orcl-# ORDER BY
orcl-# pg_total_relation_size(relid) DESC;
 table_name | total_size | table_size | index_size
------------------+------------+------------+------------
trd.metrics_high | 799 MB | 498 MB | 301 MB
trd.metrics_mid | 638 MB | 398 MB | 240 MB
trd.employees | 493 MB | 322 MB | 172 MB
trd.sales_2023 | 399 MB | 249 MB | 150 MB
trd.sales_2024 | 399 MB | 249 MB | 150 MB
trd.sales_2022 | 399 MB | 249 MB | 150 MB
trd.sales_2021 | 398 MB | 248 MB | 150 MB
trd.metrics_low | 159 MB | 99 MB | 60 MB
trd.test_data | 71 MB | 50 MB | 21 MB
trd.emp_summary | 24 kB | 8192 bytes | 16 kB
trd.metrics_rest | 8192 bytes | 0 bytes | 8192 bytes
(11 rows)

orcl=#

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

pg_dump & pg_restore

PostgreSQL pg_dump and pg_restore Guide

Table of Contents
___________________________________________________________________________________________________

Backup:

0. pg_dump / pg_restore –help
1. Backup Output Formats
2. Full Database Backup

3. Schema Level Backup
4. Table Level Backup
5. Object Level Backup (PostgreSQL v17 Feature)

Restore:

6. Pre-requisites for Restore
7. Full Database Restore
8. Schema Level Restore

9. Table Level Restore

___________________________________________________________________________________________________

0. pg_dump/pg_restore –help

Click to expand pg_dump –help
[postgres@pg17 ~]$ pg_dump --help
pg_dump dumps a database as a text file or to other formats.

Usage:
  pg_dump [OPTION]... [DBNAME]

General options:
  -f, --file=FILENAME          output file or directory name
  -F, --format=c|d|t|p         output file format (custom, directory, tar,
                               plain text (default))
  -j, --jobs=NUM               use this many parallel jobs to dump
  -v, --verbose                verbose mode
  -V, --version                output version information, then exit
  -Z, --compress=0-9           compression level for compressed formats
  --lock-wait-timeout=TIMEOUT  fail after waiting TIMEOUT for a table lock
  --no-sync                    do not wait for changes to be written safely to disk
  -?, --help                   show this help, then exit

Options controlling the output content:
  -a, --data-only              dump only the data, not the schema
  -b, --blobs                  include large objects in dump
  -B, --no-blobs               exclude large objects in dump
  -c, --clean                  clean (drop) database objects before recreating
  -C, --create                 include commands to create database in dump
  -e, --extension=PATTERN      dump the specified extension(s) only
  -E, --encoding=ENCODING      dump the data in encoding ENCODING
  -n, --schema=PATTERN         dump the specified schema(s) only
  -N, --exclude-schema=PATTERN do NOT dump the specified schema(s)
  -O, --no-owner               skip restoration of object ownership in
                               plain-text format
  -s, --schema-only            dump only the schema, no data
  -S, --superuser=NAME         superuser user name to use in plain-text format
  -t, --table=PATTERN          dump the specified table(s) only
  -T, --exclude-table=PATTERN  do NOT dump the specified table(s)
  -x, --no-privileges          do not dump privileges (grant/revoke)
  --binary-upgrade             for use by upgrade utilities only
  --column-inserts             dump data as INSERT commands with column names
  --disable-dollar-quoting     disable dollar quoting, use SQL standard quoting
  --disable-triggers           disable triggers during data-only restore
  --enable-row-security        enable row security (dump only content user has
                               access to)
  --exclude-table-data=PATTERN do NOT dump data for the specified table(s)
  --extra-float-digits=NUM     override default setting for extra_float_digits
  --if-exists                  use IF EXISTS when dropping objects
  --include-foreign-data=PATTERN
                               include data of foreign tables on foreign
                               servers matching PATTERN
  --inserts                    dump data as INSERT commands, rather than COPY
  --load-via-partition-root    load partitions via the root table
  --no-comments                do not dump comments
  --no-publications            do not dump publications
  --no-security-labels         do not dump security label assignments
  --no-subscriptions           do not dump subscriptions
  --no-table-access-method     do not dump table access methods
  --no-tablespaces             do not dump tablespace assignments
  --no-toast-compression       do not dump TOAST compression methods
  --no-unlogged-table-data     do not dump unlogged table data
  --on-conflict-do-nothing     add ON CONFLICT DO NOTHING to INSERT commands
  --quote-all-identifiers      quote all identifiers, even if not key words
  --rows-per-insert=NROWS      number of rows per INSERT; implies --inserts
  --section=SECTION            dump named section (pre-data, data, or post-data)
  --serializable-deferrable    wait until the dump can run without anomalies
  --snapshot=SNAPSHOT          use given snapshot for the dump
  --strict-names               require table and/or schema include patterns to
                               match at least one entity each
  --use-set-session-authorization
                               use SET SESSION AUTHORIZATION commands instead of
                               ALTER OWNER commands to set ownership

Connection options:
  -d, --dbname=DBNAME      database to dump
  -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, --no-password        never prompt for password
  -W, --password           force password prompt (should happen automatically)
  --role=ROLENAME          do SET ROLE before dump

If no database name is supplied, then the PGDATABASE environment
variable value is used.

Report bugs to <pgsql-bugs@lists.postgresql.org>.
PostgreSQL home page: <https://www.postgresql.org/>
[postgres@pg17 ~]$
Click to expand pg_restore –help
[postgres@pg17 ~]$ pg_restore --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 (- for stdout)
  -F, --format=c|d|t       backup file format (should be automatic)
  -l, --list               print summarized TOC of the archive
  -v, --verbose            verbose mode
  -V, --version            output version information, then exit
  -?, --help               show this help, then exit

Options controlling the restore:
  -a, --data-only              restore only the data, no schema
  -c, --clean                  clean (drop) database objects before recreating
  -C, --create                 create the target database
  -e, --exit-on-error          exit on error, default is to continue
  -I, --index=NAME             restore named index
  -j, --jobs=NUM               use this many parallel jobs to restore
  -L, --use-list=FILENAME      use table of contents from this file for
                               selecting/ordering output
  -n, --schema=NAME            restore only objects in this schema
  -N, --exclude-schema=NAME    do not restore 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         superuser user name to use for disabling triggers
  -t, --table=NAME             restore named relation (table, view, etc.)
  -T, --trigger=NAME           restore named trigger
  -x, --no-privileges          skip restoration of access privileges (grant/revoke)
  -1, --single-transaction     restore as a single transaction
  --disable-triggers           disable triggers during data-only restore
  --enable-row-security        enable row security
  --if-exists                  use IF EXISTS when dropping objects
  --no-comments                do not restore comments
  --no-data-for-failed-tables  do not restore data of tables that could not be
                               created
  --no-publications            do not restore publications
  --no-security-labels         do not restore security labels
  --no-subscriptions           do not restore subscriptions
  --no-table-access-method     do not restore table access methods
  --no-tablespaces             do not restore tablespace assignments
  --section=SECTION            restore named section (pre-data, data, or post-data)
  --strict-names               require table and/or schema include patterns to
                               match at least one entity each
  --use-set-session-authorization
                               use SET SESSION AUTHORIZATION commands instead of
                               ALTER OWNER commands to set ownership

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, --no-password        never prompt for password
  -W, --password           force password prompt (should happen automatically)
  --role=ROLENAME          do SET ROLE before restore

The options -I, -n, -N, -P, -t, -T, and --section can be combined and specified
multiple times to select multiple objects.

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

Report bugs to <pgsql-bugs@lists.postgresql.org>.
PostgreSQL home page: <https://www.postgresql.org/>
[postgres@pg17 ~]$

1. Backup Output Formats

A. Plain Text Format
# Using -Fp explicitly:
pg_dump -U postgres -d your_db_name -Fp -f /path/to/your_db.sql

# Shell redirect
pg_dump -U postgres -d your_db_name > /path/to/your_db.sql

B. Tar Format
pg_dump -U postgres -d your_db_name -Ft -f /path/to/your_db.tar

C. Directory Format and Parallel Backup
-- Parallel backup is only supported with -Fd
-- pg_dump will create the directory if it doesn't exist.

# Without parallelism
pg_dump -U postgres -d your_db_name -Fd -f /path/to/backup_dir/

# With parallelism
pg_dump -U postgres -d your_db_name -Fd -j8 -f /path/to/backup_dir/

D. Custom Format (Compressed binary format by default)
pg_dump -U postgres -d your_db_name -Fc -f /path/to/your_db.dump


2. Full Database Backup


A. Plain Text Format

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -v > /pgBackup/pgsql15/backup/blpua/database_blpua_full.sql 2> /pgBackup/pgsql15/backup/blpua/log/database_blpua_full.log &

-- OR --

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -v -Fp -f /pgBackup/pgsql15/backup/blpua/database_blpua_full1.sql > /pgBackup/pgsql15/backup/blpua/log/database_blpua_full1.log 2>&1 &

-- OR -- 

[postgres@pg17 ~]$ pg_dump -U postgres -d blpua | split -b 1G - /pgBackup/pgsql15/backup/blpua/database_blpua_split.dmp
[postgres@pg17 ~]$
[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/database_blpua_s*
-rw-r--r--. 1 postgres postgres 1.0G Sep 30 11:03 /pgBackup/pgsql15/backup/blpua/database_blpua_split.dmpaa
-rw-r--r--. 1 postgres postgres 650M Sep 30 11:03 /pgBackup/pgsql15/backup/blpua/database_blpua_split.dmpab
[postgres@pg17 ~]$

-- OR --

[postgres@pg17 ~]$ nohup sh -c "pg_dump -U postgres -d blpua -v | gzip > /pgBackup/pgsql15/backup/blpua/database_blpua.gz" > /pgBackup/pgsql15/backup/blpua/log/database_blpua.log 2>&1 &

-- OR --

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -v > /pgBackup/pgsql15/backup/blpua/database_blpua.sql 2> /pgBackup/pgsql15/backup/blpua/log/database_blpua.log & gzip /pgBackup/pgsql15/backup/blpua/database_blpua.sql


B. Tar Format

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -v -Ft -f /pgBackup/pgsql15/backup/blpua/database_blpua.tar > /pgBackup/pgsql15/backup/blpua/log/blpua_tar_dump.log 2>&1 &


C. Directory Format

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -v -Fd -j4 -f /pgBackup/pgsql15/backup/blpua_dir > /pgBackup/pgsql15/backup/blpua/log/blpua_dump.log 2>&1 &


D. Custome Format

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -Fc -v -f /pgBackup/pgsql15/backup/blpua/database_blpua_$(date +%Y_%m_%d).dmp > /pgBackup/pgsql15/backup/blpua/log/database_blpua_$(date +%Y_%m_%d).log 2>&1 &
[postgres@pg17 ~]$ 
[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/database_blpua*.dmp
-rw-r--r--. 1 postgres postgres 402M Sep 29 04:58 /pgBackup/pgsql15/backup/blpua/database_blpua_2025_09_29.dmp

[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/log/database_blpua*.log
-rw-r--r--. 1 postgres postgres 2.5K Sep 29 04:58 /pgBackup/pgsql15/backup/blpua/log/database_blpua_2025_09_29.log
[postgres@pg17 ~]$


3. Schema Level Backup

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -n blp -Fc -v -f /pgBackup/pgsql15/backup/blpua/schema_blp_blpua_$(date +%Y_%m_%d).dmp > /pgBackup/pgsql15/backup/blpua/log/schema_blp_blpua_$(date +%Y_%m_%d).log 2>&1 &
[1] 5472
[postgres@pg17 ~]$

[postgres@pg17 ~]$ jobs -l
[1]+  5472 Running                 nohup pg_dump -U postgres -d blpua -n blp -Fc -v -f /pgBackup/pgsql15/backup/blpua/schema_blp_blpua_$(date +%Y_%m_%d).dmp > /pgBackup/pgsql15/backup/blpua/log/schema_blp_blpua_$(date +%Y_%m_%d).log 2>&1 &
[postgres@pg17 ~]$

[postgres@pg17 ~]$ jobs -l
[1]+  5472 Done                    nohup pg_dump -U postgres -d blpua -n blp -Fc -v -f /pgBackup/pgsql15/backup/blpua/schema_blp_blpua_$(date +%Y_%m_%d).dmp > /pgBackup/pgsql15/backup/blpua/log/schema_blp_blpua_$(date +%Y_%m_%d).log 2>&1
[postgres@pg17 ~]$


[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/schema_blp_blpua*
-rw-r--r--. 1 postgres postgres 402M Sep 30 02:09 /pgBackup/pgsql15/backup/blpua/schema_blp_blpua_2025_09_30.dmp
[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/log/schema_blp_blpua*
-rw-r--r--. 1 postgres postgres 2.5K Sep 30 02:09 /pgBackup/pgsql15/backup/blpua/log/schema_blp_blpua_2025_09_30.log
[postgres@pg17 ~]$


4. Table Level Backup

[postgres@pg17 ~]$ nohup pg_dump -U postgres -d blpua -t blp.employees -Fc -v -f /pgBackup/pgsql15/backup/blpua/table_blp_employees_$(date +%Y_%m_%d).dmp > /pgBackup/pgsql15/backup/blpua/log/table_blp_employees_$(date +%Y_%m_%d).log 2>&1 &
[1] 5652
[postgres@pg17 ~]$ 

[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/table_blp_employees_*
-rw-r--r--. 1 postgres postgres 62M Sep 30 02:22 /pgBackup/pgsql15/backup/blpua/table_blp_employees_2025_09_30.dmp
[postgres@pg17 ~]$ ls -lrth /pgBackup/pgsql15/backup/blpua/log/table_blp_employees_*
-rw-r--r--. 1 postgres postgres 2.0K Sep 30 02:22 /pgBackup/pgsql15/backup/blpua/log/table_blp_employees_2025_09_30.log
[postgres@pg17 ~]$


5. Object Level Backup (PostgreSQL v17 Feature)

++ filter is only for pg_dump, not pg_restore

[postgres@lxicbpgdsgv01 ~]$ cat include_tables.par
include table demo.table_1
include table demo.table_2
include table demo.table_3
[postgres@lxicbpgdsgv01 ~]$


[postgres@lxicbpgdsgv01 ~]$ pg_dump -d testdb_source --filter=include_tables.par > include_tables.sql

[postgres@lxicbpgdsgv01 ~]$ ls -lrth include_tables.sql
-rw-r--r--. 1 postgres postgres 4.5K Sep 30 22:19 include_tables.sql
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ cat include_tables.sql | grep -i "CREATE TABLE"
CREATE TABLE demo.table_1 (
CREATE TABLE demo.table_2 (
CREATE TABLE demo.table_3 (
[postgres@lxicbpgdsgv01 ~]$


[postgres@lxicbpgdsgv01 ~]$ cat exclude_tables.par
exclude table demo.table_1
exclude table demo.table_2
exclude table demo.table_3
[postgres@lxicbpgdsgv01 ~]$

[postgres@lxicbpgdsgv01 ~]$ pg_dump -d testdb_source --filter=exclude_tables.par > exclude_tables.sql
[postgres@lxicbpgdsgv01 ~]$ ls -ltr exclude_tables.sql
-rw-r--r--. 1 postgres postgres 10931 Sep 30 22:23 exclude_tables.sql
[postgres@lxicbpgdsgv01 ~]$
[postgres@lxicbpgdsgv01 ~]$ cat exclude_tables.sql | grep -i "CREATE TABLE"
CREATE TABLE demo.table_10 (
CREATE TABLE demo.table_4 (
CREATE TABLE demo.table_5 (
CREATE TABLE demo.table_6 (
CREATE TABLE demo.table_7 (
CREATE TABLE demo.table_8 (
CREATE TABLE demo.table_9 (
[postgres@lxicbpgdsgv01 ~]$


6. Pre-requisites for restore

postgres=# CREATE TABLESPACE TEST_TB LOCATION '/pgTb/pgsql15/test';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE TEST_IX LOCATION '/pgIx/pgsql15/test';
CREATE TABLESPACE
postgres=#
postgres=# CREATE DATABASE TEST TABLESPACE TEST_TB;
CREATE DATABASE
postgres=#

[postgres@pg17 blpua]$ scp *.dmp postgres@192.168.2.32:/pgBackup/pgsql15/backup/test
postgres@192.168.2.32's password:
database_blpua_2025_09_29.dmp                           100%  402MB  39.9MB/s   00:10
schema_blp_blpua_2025_09_30.dmp                         100%  402MB  43.8MB/s   00:09
table_blp_employees_2025_09_30.dmp                      100%   61MB  47.0MB/s   00:01
[postgres@pg17 blpua]$


7. Full Database Restore

++ The source database uses two custom tablespaces: blpua_tbs01 and blpua_ixtbs01.
++ On the target system, I have two different tablespaces: test_tb and test_ix.
++ Unlike Oracle, PostgreSQL does not provide a direct equivalent of REMAP_TABLESPACE.
++ Therefore, to simplify the restore and ensure all objects are placed into the default tablespace (test_tb).
++ Using --no-owner --no-tablespaces in pg_restore — even if not specified, data still gets written to the default database tablespace. These options just help avoid errors in the log.
++ This ensures that all objects are restored to the default tablespace of the target database, regardless of their original tablespace assignments.
++ Later, we can move all indexes to the desired target tablespace using the ALTER INDEX ... SET TABLESPACE command.
postgres=# \c test
You are now connected to database "test" as user "postgres".
test=# ALTER INDEX blp.idx_employee_name SET TABLESPACE test_ix;  <--  This command physically relocates the index to the test_ix tablespace.
ALTER INDEX
test=#


[postgres@lxtrdpgdsgv01 ~]$ nohup pg_restore -U postgres -d test --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/database_blpua_2025_09_29.dmp > /pgBackup/pgsql15/backup/test/log/restore_blpua_test_$(date +%Y_%m_%d).log 2>&1 &
[1] 5300
[postgres@lxtrdpgdsgv01 ~]$

[postgres@lxtrdpgdsgv01 ~]$ cat /pgBackup/pgsql15/backup/test/log/restore_blpua_test_2025_09_30.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: creating SCHEMA "blp"
pg_restore: creating TYPE "blp.address"
pg_restore: creating TYPE "blp.employment_status"
pg_restore: creating DOMAIN "blp.positive_integer"
pg_restore: creating FUNCTION "blp.get_salary(integer)"
pg_restore: creating FUNCTION "blp.log_update()"
pg_restore: creating PROCEDURE "blp.raise_salary(integer, numeric)"
pg_restore: creating SEQUENCE "blp.emp_id_seq"
pg_restore: creating TABLE "blp.employees"
pg_restore: creating MATERIALIZED VIEW "blp.emp_summary"
pg_restore: creating SEQUENCE "blp.employees_id_seq"
pg_restore: creating SEQUENCE OWNED BY "blp.employees_id_seq"
pg_restore: creating VIEW "blp.high_paid_employees"
pg_restore: creating TABLE "blp.metrics"
pg_restore: creating TABLE "blp.metrics_high"
pg_restore: creating SEQUENCE "blp.metrics_id_seq"
pg_restore: creating TABLE "blp.metrics_low"
pg_restore: creating TABLE "blp.metrics_mid"
pg_restore: creating TABLE "blp.metrics_rest"
pg_restore: creating TABLE "blp.sales"
pg_restore: creating TABLE "blp.sales_2021"
pg_restore: creating TABLE "blp.sales_2022"
pg_restore: creating TABLE "blp.sales_2023"
pg_restore: creating TABLE "blp.sales_2024"
pg_restore: creating SEQUENCE "blp.sales_id_seq"
pg_restore: creating TABLE "blp.test_data"
pg_restore: creating SEQUENCE "blp.test_data_id_seq"
pg_restore: creating SEQUENCE OWNED BY "blp.test_data_id_seq"
pg_restore: creating TABLE ATTACH "blp.metrics_high"
pg_restore: creating TABLE ATTACH "blp.metrics_low"
pg_restore: creating TABLE ATTACH "blp.metrics_mid"
pg_restore: creating TABLE ATTACH "blp.metrics_rest"
pg_restore: creating TABLE ATTACH "blp.sales_2021"
pg_restore: creating TABLE ATTACH "blp.sales_2022"
pg_restore: creating TABLE ATTACH "blp.sales_2023"
pg_restore: creating TABLE ATTACH "blp.sales_2024"
pg_restore: creating DEFAULT "blp.employees id"
pg_restore: creating DEFAULT "blp.test_data id"
pg_restore: processing data for table "blp.employees"
pg_restore: processing data for table "blp.metrics_high"
pg_restore: processing data for table "blp.metrics_low"
pg_restore: processing data for table "blp.metrics_mid"
pg_restore: processing data for table "blp.metrics_rest"
pg_restore: processing data for table "blp.sales_2021"
pg_restore: processing data for table "blp.sales_2022"
pg_restore: processing data for table "blp.sales_2023"
pg_restore: processing data for table "blp.sales_2024"
pg_restore: processing data for table "blp.test_data"
pg_restore: executing SEQUENCE SET emp_id_seq
pg_restore: executing SEQUENCE SET employees_id_seq
pg_restore: executing SEQUENCE SET metrics_id_seq
pg_restore: executing SEQUENCE SET sales_id_seq
pg_restore: executing SEQUENCE SET test_data_id_seq
pg_restore: creating CONSTRAINT "blp.employees employees_pkey"
pg_restore: creating CONSTRAINT "blp.metrics metrics_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_high metrics_high_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_low metrics_low_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_mid metrics_mid_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_rest metrics_rest_pkey"
pg_restore: creating CONSTRAINT "blp.sales sales_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2021 sales_2021_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2022 sales_2022_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2023 sales_2023_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2024 sales_2024_pkey"
pg_restore: creating CONSTRAINT "blp.test_data test_data_pkey"
pg_restore: creating INDEX "blp.idx_employee_name"
pg_restore: creating INDEX ATTACH "blp.metrics_high_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_low_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_mid_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_rest_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2021_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2022_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2023_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2024_pkey"
pg_restore: creating TRIGGER "blp.employees employee_update_trigger"
pg_restore: creating MATERIALIZED VIEW DATA "blp.emp_summary"
[postgres@lxtrdpgdsgv01 ~]$


8. Schema Level Restore

++ pg_restore does not support schema remapping like Oracle’s REMAP_SCHEMA.
++ I want to restore schema blp --> trd. 
++ Option A: Restore Dump as it is, Then Rename <--- Best for simplicity
++ Option B: Split Dump into Schema + Data, Modify Both <--- This is more complex, but possible if you must use schema remapping.
++ This is schema dump file : /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
++ Using --no-owner --no-tablespaces in pg_restore — even if not specified, data still gets written to the default database tablespace. These options just help avoid errors in the log.


A. To Restore schema from own schema’s backup

postgres=# CREATE TABLESPACE ORCL_TB LOCATION '/pgTb/pgsql15/orcl';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE ORCL_IX LOCATION '/pgIx/pgsql15/orcl';
CREATE TABLESPACE
postgres=#
postgres=# CREATE DATABASE ORCL TABLESPACE ORCL_TB;
CREATE DATABASE
postgres=#

-- With NO parallelism


[postgres@lxtrdpgdsgv01 ~]$ nohup pg_restore -U postgres -d orcl --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp > /pgBackup/pgsql15/backup/test/log/restore_blpua_test_$(date +%Y_%m_%d).log 2>&1 &
[1] 7344
[postgres@lxtrdpgdsgv01 ~]$

postgres=# \c orcl
You are now connected to database "orcl" as user "postgres".
orcl=# ALTER SCHEMA blp RENAME TO trd;
ALTER SCHEMA
orcl=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 public | pg_database_owner
 trd    | postgres
(2 rows)

orcl=#


[postgres@lxtrdpgdsgv01 ~]$ cat /pgBackup/pgsql15/backup/test/log/restore_blpua_test_2025_09_30.log
nohup: ignoring input
pg_restore: connecting to database for restore
pg_restore: creating SCHEMA "blp"
pg_restore: creating TYPE "blp.address"
pg_restore: creating TYPE "blp.employment_status"
pg_restore: creating DOMAIN "blp.positive_integer"
pg_restore: creating FUNCTION "blp.get_salary(integer)"
pg_restore: creating FUNCTION "blp.log_update()"
pg_restore: creating PROCEDURE "blp.raise_salary(integer, numeric)"
pg_restore: creating SEQUENCE "blp.emp_id_seq"
pg_restore: creating TABLE "blp.employees"
pg_restore: creating MATERIALIZED VIEW "blp.emp_summary"
pg_restore: creating SEQUENCE "blp.employees_id_seq"
pg_restore: creating SEQUENCE OWNED BY "blp.employees_id_seq"
pg_restore: creating VIEW "blp.high_paid_employees"
pg_restore: creating TABLE "blp.metrics"
pg_restore: creating TABLE "blp.metrics_high"
pg_restore: creating SEQUENCE "blp.metrics_id_seq"
pg_restore: creating TABLE "blp.metrics_low"
pg_restore: creating TABLE "blp.metrics_mid"
pg_restore: creating TABLE "blp.metrics_rest"
pg_restore: creating TABLE "blp.sales"
pg_restore: creating TABLE "blp.sales_2021"
pg_restore: creating TABLE "blp.sales_2022"
pg_restore: creating TABLE "blp.sales_2023"
pg_restore: creating TABLE "blp.sales_2024"
pg_restore: creating SEQUENCE "blp.sales_id_seq"
pg_restore: creating TABLE "blp.test_data"
pg_restore: creating SEQUENCE "blp.test_data_id_seq"
pg_restore: creating SEQUENCE OWNED BY "blp.test_data_id_seq"
pg_restore: creating TABLE ATTACH "blp.metrics_high"
pg_restore: creating TABLE ATTACH "blp.metrics_low"
pg_restore: creating TABLE ATTACH "blp.metrics_mid"
pg_restore: creating TABLE ATTACH "blp.metrics_rest"
pg_restore: creating TABLE ATTACH "blp.sales_2021"
pg_restore: creating TABLE ATTACH "blp.sales_2022"
pg_restore: creating TABLE ATTACH "blp.sales_2023"
pg_restore: creating TABLE ATTACH "blp.sales_2024"
pg_restore: creating DEFAULT "blp.employees id"
pg_restore: creating DEFAULT "blp.test_data id"
pg_restore: processing data for table "blp.employees"
pg_restore: processing data for table "blp.metrics_high"
pg_restore: processing data for table "blp.metrics_low"
pg_restore: processing data for table "blp.metrics_mid"
pg_restore: processing data for table "blp.metrics_rest"
pg_restore: processing data for table "blp.sales_2021"
pg_restore: processing data for table "blp.sales_2022"
pg_restore: processing data for table "blp.sales_2023"
pg_restore: processing data for table "blp.sales_2024"
pg_restore: processing data for table "blp.test_data"
pg_restore: executing SEQUENCE SET emp_id_seq
pg_restore: executing SEQUENCE SET employees_id_seq
pg_restore: executing SEQUENCE SET metrics_id_seq
pg_restore: executing SEQUENCE SET sales_id_seq
pg_restore: executing SEQUENCE SET test_data_id_seq
pg_restore: creating CONSTRAINT "blp.employees employees_pkey"
pg_restore: creating CONSTRAINT "blp.metrics metrics_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_high metrics_high_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_low metrics_low_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_mid metrics_mid_pkey"
pg_restore: creating CONSTRAINT "blp.metrics_rest metrics_rest_pkey"
pg_restore: creating CONSTRAINT "blp.sales sales_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2021 sales_2021_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2022 sales_2022_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2023 sales_2023_pkey"
pg_restore: creating CONSTRAINT "blp.sales_2024 sales_2024_pkey"
pg_restore: creating CONSTRAINT "blp.test_data test_data_pkey"
pg_restore: creating INDEX "blp.idx_employee_name"
pg_restore: creating INDEX ATTACH "blp.metrics_high_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_low_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_mid_pkey"
pg_restore: creating INDEX ATTACH "blp.metrics_rest_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2021_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2022_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2023_pkey"
pg_restore: creating INDEX ATTACH "blp.sales_2024_pkey"
pg_restore: creating TRIGGER "blp.employees employee_update_trigger"
pg_restore: creating MATERIALIZED VIEW DATA "blp.emp_summary"
[postgres@lxtrdpgdsgv01 ~]$


--- OR ---

-- With parallelism 4

nohup pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp > /pgBackup/pgsql15/backup/test/log/restore_blpua_test_$(date +%Y_%m_%d).log1 2>&1 &

[postgres@lxtrdpgdsgv01 ~]$ ps -ef | grep pg_restore
postgres    7089    5102  0 05:49 pts/0    00:00:00 pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
postgres    7091    7089  2 05:49 pts/0    00:00:00 pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
postgres    7092    7089  3 05:49 pts/0    00:00:00 pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
postgres    7093    7089  2 05:49 pts/0    00:00:00 pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
postgres    7094    7089  2 05:49 pts/0    00:00:00 pg_restore -U postgres -d orcl -j4 --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
postgres    7126    5736  0 05:49 pts/1    00:00:00 grep --color=auto pg_restore
[postgres@lxtrdpgdsgv01 ~]$


B. To Restore only a specific schema from Full Database Backup

Step 1: Create schema 

gebua=# CREATE SCHEMA IF NOT EXISTS blp;

Step 2: Restore Objects and Data

nohup pg_restore -U postgres -d gebua -n blp --no-owner --no-tablespaces -v /pgBackup/pgsql15/backup/test/database_blpua_2025_09_29.dmp > /pgBackup/pgsql15/backup/test/log/restore_blpua_test_$(date +%Y_%m_%d).log_full 2>&1 &


9. Table Level Restore


A. Restore Table from own table’s backup

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -l /pgBackup/pgsql15/backup/test/table_blp_employees_2025_09_30.dmp
;
; Archive created at 2025-09-30 02:22:21 EDT
;     dbname: blpua
;     TOC Entries: 13
;     Compression: -1
;     Dump Version: 1.14-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 15.13
;     Dumped by pg_dump version: 15.13
;
;
; Selected TOC Entries:
;
229; 1259 92805 TABLE blp employees postgres
228; 1259 92804 SEQUENCE blp employees_id_seq postgres
4338; 0 0 SEQUENCE OWNED BY blp employees_id_seq postgres
4181; 2604 92808 DEFAULT blp employees id postgres
4331; 0 92805 TABLE DATA blp employees postgres
4339; 0 0 SEQUENCE SET blp employees_id_seq postgres
4183; 2606 92812 CONSTRAINT blp employees employees_pkey postgres
4184; 1259 92824 INDEX blp idx_employee_name postgres
4185; 2620 92829 TRIGGER blp employees employee_update_trigger postgres
[postgres@lxtrdpgdsgv01 ~]$


Step 1: Create schema 

postgres=# \c edpua
You are now connected to database "edpua" as user "postgres".
edpua=# CREATE SCHEMA IF NOT EXISTS blp;
CREATE SCHEMA
edpua=#


Step 2: Restore Objects and Data

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -U postgres -d edpua --no-tablespaces -v /pgBackup/pgsql15/backup/test/table_blp_employees_2025_09_30.dmp
pg_restore: connecting to database for restore
pg_restore: creating TABLE "blp.employees"
pg_restore: creating SEQUENCE "blp.employees_id_seq"
pg_restore: creating SEQUENCE OWNED BY "blp.employees_id_seq"
pg_restore: creating DEFAULT "blp.employees id"
pg_restore: processing data for table "blp.employees"
pg_restore: executing SEQUENCE SET employees_id_seq
pg_restore: creating CONSTRAINT "blp.employees employees_pkey"
pg_restore: creating INDEX "blp.idx_employee_name"
pg_restore: creating TRIGGER "blp.employees employee_update_trigger"
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 4185; 2620 92829 TRIGGER employees employee_update_trigger postgres
pg_restore: error: could not execute query: ERROR:  function blp.log_update() does not exist
Command was: CREATE TRIGGER employee_update_trigger AFTER UPDATE ON blp.employees FOR EACH ROW EXECUTE FUNCTION blp.log_update();


pg_restore: warning: errors ignored on restore: 1
[postgres@lxtrdpgdsgv01 ~]$

++ PostgreSQL does not have a --ignore-errors flag, The above erros ignorable.


B. Restore Single Table data-only from Schema backup

edpua=# TRUNCATE TABLE blp.employees;
TRUNCATE TABLE
edpua=#

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -U postgres -d edpua --data-only -t employees -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
pg_restore: connecting to database for restore
pg_restore: processing data for table "blp.employees"
[postgres@lxtrdpgdsgv01 ~]$

edpua=# select count(*) from blp.employees;
 5000000  <-----

edpua=#


C. Restore Single Table from Schema backup

Step 1: Create schema 

edpua=# CREATE SCHEMA blp;

Step 2: Restore Objects and Data

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -U postgres -d edpua --clean -t employees -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
pg_restore: connecting to database for restore
pg_restore: dropping TABLE employees
pg_restore: creating TABLE "blp.employees"
pg_restore: processing data for table "blp.employees"
[postgres@lxtrdpgdsgv01 ~]$
[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \c edpua
You are now connected to database "edpua" as user "postgres".
edpua=# select count(*) from blp.employees;
  count
---------
 5000000 <----
(1 row)

edpua=#


D. Restore Single Table from Schema backup (add both -n and -t)

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -U postgres -d edpua --clean -n blp -t employees -v /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
pg_restore: connecting to database for restore
pg_restore: dropping TABLE employees
pg_restore: creating TABLE "blp.employees"
pg_restore: processing data for table "blp.employees"
[postgres@lxtrdpgdsgv01 ~]$
[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \c edpua
You are now connected to database "edpua" as user "postgres".
edpua=# select count(*) from blp.employees;
  count
---------
 5000000 <-----
(1 row)

edpua=#


E. Restoring Using a Plain SQL File (COPY-based)

Step 1: Extracted table data from custom-format dump

[postgres@lxtrdpgdsgv01 ~]$ pg_restore -U postgres -n blp -t employees -f /pgBackup/pgsql15/backup/test/blp_employees.sql /pgBackup/pgsql15/backup/test/schema_blp_blpua_2025_09_30.dmp
[postgres@lxtrdpgdsgv01 ~]$
[postgres@lxtrdpgdsgv01 ~]$ ls -lrth /pgBackup/pgsql15/backup/test/blp_employees.sql
-rw-r--r--. 1 postgres postgres 210M Sep 30 09:17 /pgBackup/pgsql15/backup/test/blp_employees.sql
[postgres@lxtrdpgdsgv01 ~]$

[postgres@lxtrdpgdsgv01 ~]$ head -50 /pgBackup/pgsql15/backup/test/blp_employees.sql
--
-- PostgreSQL database dump
--

\restrict TthhVsS8JvVxrplYNApzHUalZpygXUqFg2pIvbSH8GTkbJ6WBNyW0JLnuuvkPdt

-- Dumped from database version 15.13
-- Dumped by pg_dump version 15.13

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: employees; Type: TABLE; Schema: blp; Owner: postgres
--

CREATE TABLE blp.employees (
    id integer NOT NULL,
    name text,
    salary numeric(10,2),
    hired_on date
);


ALTER TABLE blp.employees OWNER TO postgres;

--
-- Data for Name: employees; Type: TABLE DATA; Schema: blp; Owner: postgres
--

COPY blp.employees (id, name, salary, hired_on) FROM stdin;
1       Employee_1      70969.47        2005-06-13
2       Employee_2      94341.15        2006-12-09
3       Employee_3      101657.57       2012-07-05
4       Employee_4      54701.92        2010-01-05
5       Employee_5      104229.43       2001-06-28
6       Employee_6      95842.57        2010-10-06
7       Employee_7      50618.08        2015-06-02
[postgres@lxtrdpgdsgv01 ~]$

Step 2: Restore using psql command

postgres=# \c edpua
You are now connected to database "edpua" as user "postgres".
edpua=#
edpua=# drop table blp.employees;
DROP TABLE
edpua=# exit
[postgres@lxtrdpgdsgv01 ~]$


psql -U postgres -d edpua < /pgBackup/pgsql15/backup/test/blp_employees.sql

[postgres@lxtrdpgdsgv01 ~]$ psql -U postgres -d edpua < /pgBackup/pgsql15/backup/test/blp_employees.sql
SET
SET
SET
SET
SET
 set_config
------------

(1 row)

SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
COPY 5000000
[postgres@lxtrdpgdsgv01 ~]$

[postgres@lxtrdpgdsgv01 ~]$ psql
psql (15.14)
Type "help" for help.

postgres=# \c edpua
You are now connected to database "edpua" as user "postgres".
edpua=# SELECT COUNT(*) FROM blp.employees;
  count
---------
 5000000 <-----
(1 row)

edpua=#

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL Tablespace

PostgreSQL Tablespace Management

Table of Contents

___________________________________________________________________________________________________

0. Introduction
1. How big can a PostgreSQL tablespace grow?
2. Create a Tablespace
3. Create a Database with default tablespace
4. Create Tables on Data tablspace
5. Crate Index on Index tablespaces
6. Create a Dedicated Tablespace for Temp
7. Assign Temp Tablespace to a Database
8. Check Tablespace OIDs
9. Move Table Between Tablespaces
10. Verify Database Directory (Filesystem)
11. Rename tablespace
12. Drop Tablespace
13. Change ownership for Tablespace
14. Verify Symbolic Links
15. How to find tablespace size
___________________________________________________________________________________________________


0. Introduction

What is a Tablespace?

--> Tablespace is a logical structure in which objects are stored.

--> A tablespace is simply a physical storage location on disk where PostgreSQL stores database objects (tables, indexes, etc.). 

--> By default database objects are stored in the current default tablespace of the database.

List tablespaces:

\db+ or select * from pg_tablespace;

 

Types of Tablespaces: Default Tablespaces and Non-Default Tablespaces
I. Default Tablespaces

These come built-in with PostgreSQL:

pg_global – for shared system data
pg_default – for regular user data (tables, indexes, etc.)
Featurepg_defaultpg_global
PurposeStores regular user dataStores global system data
Used by default?Yes, for tables/indexesNo, only used internally
Can store user tables?YesNo
Location$PGDATA/base/$PGDATA/global/
Droppable?NoNo
II. Non-Default Tablespaces :

--> These are created by users to store data in custom locations.
--> Useful for managing storage better (e.g., putting large tables on faster disks).


1. How big can a PostgreSQL tablespace grow?

There is no fixed maximum size for a tablespace in PostgreSQL itself.
The limit depends on your operating system and filesystem where the tablespace directory is located.

For example:

On modern filesystems like ext4 or XFS, a single file can be several terabytes (TB) or even petabytes (PB).
PostgreSQL breaks large tables into multiple files (each typically up to 1 GB) internally, so extremely large tablespaces are supported.
Your disk/storage capacity is the main practical limit.


2. Create a Tablespace

[root@pg17 ~]# mkdir -p /pgData/pgsql15/edbua_tbs01
[root@pg17 ~]# mkdir -p /pgData/pgsql15/edbua_tbs02
[root@pg17 ~]# mkdir -p /pgData/pgsql15/edbua_ixtbs01
[root@pg17 ~]# mkdir -p /pgData/pgsql15/edbua_temptbs01
[root@pg17 ~]# chown postgres:postgres /pgData/pgsql15/edbua*
[root@pg17 ~]# chmod 700 /pgData/pgsql15/edbua*
[root@pg17 ~]#

[root@pg17 ~]# su - postgres
[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# CREATE TABLESPACE edbua_tbs01 LOCATION '/pgData/pgsql15/edbua_tbs01';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE edbua_tbs02 LOCATION '/pgData/pgsql15/edbua_tbs02';
CREATE TABLESPACE
postgres=# CREATE TABLESPACE edbua_ixtbs01 LOCATION '/pgData/pgsql15/edbua_ixtbs01';
CREATE TABLESPACE
postgres=# 


3. Create a Database with default tablespace

postgres=# CREATE DATABASE edbua TABLESPACE edbua_tbs01;
CREATE DATABASE
postgres=# 
postgres=# SELECT oid, datname, dattablespace, datistemplate, datdba FROM pg_database WHERE datname = 'edbua';
  oid  | datname | dattablespace | datistemplate | datdba
-------+---------+---------------+---------------+--------
 92666 | edbua   |         92662 | f             |     10
(1 row)

postgres=#


4. Create Tables on Data tablspace

postgres=# \c edbua
You are now connected to database "edbua" as user "postgres".
edbua=# CREATE TABLE emp01 (id int, name text) TABLESPACE edbua_tbs01;
CREATE TABLE
edbua=# CREATE TABLE emp02 (id int, name text) TABLESPACE edbua_tbs01;
CREATE TABLE
edbua=# CREATE TABLE emp03 (id int, name text) TABLESPACE edbua_tbs01;
CREATE TABLE
edbua=#


5. Create Index on Index tablespaces

edbua=# CREATE INDEX emp01_ix ON emp01(name) TABLESPACE edbua_ixtbs01;
CREATE INDEX
edbua=# CREATE INDEX emp02_ix ON emp02(name) TABLESPACE edbua_ixtbs01;
CREATE INDEX
edbua=# CREATE INDEX emp03_ix ON emp03(name) TABLESPACE edbua_ixtbs01;
CREATE INDEX
edbua=# SELECT c.oid, c.relname, c.relkind, t.spcname AS tablespace, c.relfilenode
edbua-# FROM pg_class c
edbua-# LEFT JOIN pg_tablespace t ON c.reltablespace = t.oid
edbua-# WHERE c.relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
  oid  | relname  | relkind |  tablespace   | relfilenode
-------+----------+---------+---------------+-------------
 92685 | emp01    | r       |               |       92685
 92690 | emp02    | r       |               |       92690
 92695 | emp03    | r       |               |       92695
 92700 | emp01_ix | i       | edbua_ixtbs01 |       92700
 92701 | emp02_ix | i       | edbua_ixtbs01 |       92701
 92702 | emp03_ix | i       | edbua_ixtbs01 |       92702
(6 rows)

edbua=#

If a table or index is created in the database’s default tablespace, PostgreSQL does not explicitly record the tablespace in pg_class.reltablespace.

But when it’s created in a non-default tablespace, PostgreSQL records that tablespace OID in pg_class.reltablespace.

If you want to always see the tablespace name (even when it's the default)

edbua=# SELECT
edbua-#     c.oid,
edbua-#     c.relname,
edbua-#     c.relkind,
edbua-#     COALESCE(t1.spcname, t2.spcname) AS tablespace,
edbua-#     c.relfilenode
edbua-# FROM pg_class c
edbua-# LEFT JOIN pg_tablespace t1 ON c.reltablespace = t1.oid
edbua-# LEFT JOIN pg_database d ON d.datname = current_database()
edbua-# LEFT JOIN pg_tablespace t2 ON d.dattablespace = t2.oid
edbua-# WHERE c.relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
  oid  | relname  | relkind |  tablespace   | relfilenode
-------+----------+---------+---------------+-------------
 92685 | emp01    | r       | edbua_tbs01   |       92685
 92690 | emp02    | r       | edbua_tbs01   |       92690
 92695 | emp03    | r       | edbua_tbs01   |       92695
 92700 | emp01_ix | i       | edbua_ixtbs01 |       92700
 92701 | emp02_ix | i       | edbua_ixtbs01 |       92701
 92702 | emp03_ix | i       | edbua_ixtbs01 |       92702
(6 rows)

edbua=#

pg_tblspc/<tbs_oid>/PG_15_<catalog_version>/<db_oid>/<relfilenode>

edbua=# SELECT relname, pg_relation_filepath(oid) AS filepath
edbua-# FROM pg_class
edbua-# WHERE relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
 relname  |                  filepath
----------+---------------------------------------------
 emp01    | pg_tblspc/92662/PG_15_202209061/92666/92685
 emp02    | pg_tblspc/92662/PG_15_202209061/92666/92690
 emp03    | pg_tblspc/92662/PG_15_202209061/92666/92695
 emp01_ix | pg_tblspc/92664/PG_15_202209061/92666/92700
 emp02_ix | pg_tblspc/92664/PG_15_202209061/92666/92701
 emp03_ix | pg_tblspc/92664/PG_15_202209061/92666/92702
(6 rows)

edbua=#


6. Create a Dedicated Tablespace for Temp

postgres=# CREATE TABLESPACE edbua_temptbs01 LOCATION '/pgData/pgsql15/edbua_temptbs01';
CREATE TABLESPACE
postgres=#


7. Assign Temp Tablespace to a Database

postgres=# ALTER DATABASE edbua SET temp_tablespaces = edbua_temptbs01;
ALTER DATABASE
postgres=#

postgres=# \c edbua
You are now connected to database "edbua" as user "postgres".
edbua=# 

edbua=# CREATE TEMP TABLE emp_tmp (id int, name text);
CREATE TABLE
edbua=#
edbua=# SELECT c.oid, c.relname, t.spcname, pg_relation_filepath(c.oid)
edbua-# FROM pg_class c
edbua-# LEFT JOIN pg_tablespace t ON c.reltablespace = t.oid
edbua-# WHERE c.relname = 'emp_tmp';
  oid  | relname |     spcname     |              pg_relation_filepath
-------+---------+-----------------+------------------------------------------------
 92705 | emp_tmp | edbua_temptbs01 | pg_tblspc/92665/PG_15_202209061/92666/t4_92705
(1 row)

edbua=#

pg_tblspc/<tbs_oid>/PG_15_<catalog_version>/<db_oid>/<relfilenode>


8. Check Tablespace OIDs

edbua=# SELECT oid, spcname AS tablespace_name, pg_tablespace_location(oid) AS location FROM pg_tablespace ORDER BY oid;
  oid  | tablespace_name |            location
-------+-----------------+---------------------------------
  1663 | pg_default      |
  1664 | pg_global       |
 24581 | dell_ts_data    | /u01/data/dell_ts_data
 24582 | dell_ts_index   | /u01/data/dell_ts_index
 24594 | dell_tbs        | /pgData/pgsql15/data
 24597 | trd_tb01        | /pgData/pgsql15/data/trd_tb01
 24598 | trd_ix01        | /pgData/pgsql15/data/trd_ix01
 32787 | geb_tb          | /pgData/pgsql15/pgtb/geb_tb
 32788 | geb_ix          | /pgData/pgsql15/pgix/geb_ix
 92662 | edbua_tbs01     | /pgData/pgsql15/edbua_tbs01
 92663 | edbua_tbs02     | /pgData/pgsql15/edbua_tbs02
 92664 | edbua_ixtbs01   | /pgData/pgsql15/edbua_ixtbs01
 92665 | edbua_temptbs01 | /pgData/pgsql15/edbua_temptbs01
(13 rows)

edbua=#


9. Move Table Between Tablespaces

edbua=# ALTER TABLE emp01 SET TABLESPACE edbua_tbs02;
ALTER TABLE
edbua=# ALTER TABLE emp02 SET TABLESPACE edbua_tbs02;
ALTER TABLE
edbua=# ALTER TABLE emp03 SET TABLESPACE edbua_tbs02;
ALTER TABLE
edbua=#

pg_tblspc/<tbs_oid>/PG_15_<catalog_version>/<db_oid>/<relfilenode>

edbua=# select pg_relation_filepath('emp01');
            pg_relation_filepath
---------------------------------------------
 pg_tblspc/92663/PG_15_202209061/92666/92710
(1 row)

edbua=# 

edbua=# SELECT relname, pg_relation_filepath(oid) AS filepath
FROM pg_class
WHERE relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
 relname  |                  filepath
----------+---------------------------------------------
 emp01    | pg_tblspc/92663/PG_15_202209061/92666/92710
 emp02    | pg_tblspc/92663/PG_15_202209061/92666/92713
 emp03    | pg_tblspc/92663/PG_15_202209061/92666/92716
 emp01_ix | pg_tblspc/92664/PG_15_202209061/92666/92700
 emp02_ix | pg_tblspc/92664/PG_15_202209061/92666/92701
 emp03_ix | pg_tblspc/92664/PG_15_202209061/92666/92702
(6 rows)

edbua=#

Important: Indexes do not move automatically when you move a table.
They remain in their original tablespace (edbua_ixtbs01 in this case).
If you want indexes in edbua_tbs02, you must explicitly run:

edbua=# ALTER INDEX emp01_ix SET TABLESPACE edbua_tbs02;
ALTER INDEX
edbua=# ALTER INDEX emp02_ix SET TABLESPACE edbua_tbs02;
ALTER INDEX
edbua=# ALTER INDEX emp03_ix SET TABLESPACE edbua_tbs02;
ALTER INDEX
edbua=#
edbua=# SELECT c.relname, t.spcname AS tablespace, pg_relation_filepath(c.oid)
edbua-# FROM pg_class c
edbua-# LEFT JOIN pg_tablespace t ON c.reltablespace = t.oid
edbua-# WHERE c.relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
 relname  | tablespace  |            pg_relation_filepath
----------+-------------+---------------------------------------------
 emp01_ix | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92719
 emp02_ix | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92720
 emp03_ix | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92721
 emp01    | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92710
 emp02    | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92713
 emp03    | edbua_tbs02 | pg_tblspc/92663/PG_15_202209061/92666/92716
(6 rows)

edbua=#

edbua=# SELECT
edbua-#     c.relname,
edbua-#     COALESCE(t1.spcname, t2.spcname) AS tablespace,
edbua-#     pg_catalog.pg_tablespace_location(COALESCE(c.reltablespace, d.dattablespace)) AS tablespace_path,
edbua-#     current_setting('data_directory') AS data_directory,
edbua-#     CASE
edbua-#         WHEN c.reltablespace = 0 THEN
edbua-#             current_setting('data_directory') || '/base/' || d.oid || '/' || c.relfilenode
edbua-#         ELSE
edbua-#             pg_catalog.pg_tablespace_location(c.reltablespace) || '/PG_' ||
edbua-#             split_part(split_part(version(), ' ', 2), '.', 1) || '_' ||
edbua-#             '202209061/' || d.oid || '/' || c.relfilenode
edbua-#     END AS full_path_guess
edbua-# FROM pg_class c
edbua-# LEFT JOIN pg_tablespace t1 ON c.reltablespace = t1.oid
edbua-# LEFT JOIN pg_database d ON d.datname = current_database()
edbua-# LEFT JOIN pg_tablespace t2 ON d.dattablespace = t2.oid
edbua-# WHERE c.relname IN ('emp01','emp02','emp03','emp01_ix','emp02_ix','emp03_ix');
 relname  | tablespace  |       tablespace_path       |    data_directory    |                     full_path_guess
----------+-------------+-----------------------------+----------------------+---------------------------------------------------------
 emp01_ix | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92719
 emp02_ix | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92720
 emp03_ix | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92721
 emp01    | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92710
 emp02    | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92713
 emp03    | edbua_tbs02 | /pgData/pgsql15/edbua_tbs02 | /pgData/pgsql15/data | /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92716
(6 rows)

edbua=#


10. Verify Database Directory (Filesystem)

edbua=# SELECT oid, datname FROM pg_database WHERE datname = current_database();
  oid  | datname
-------+---------
 92666 | edbua
(1 row)

edbua=#

[root@pg17 ~]# ls -ltr /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/*
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92710
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92711
-rw-------. 1 postgres postgres 8192 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92712
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92713
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92714
-rw-------. 1 postgres postgres 8192 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92715
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92716
-rw-------. 1 postgres postgres    0 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92717
-rw-------. 1 postgres postgres 8192 Sep 23 00:14 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92718
-rw-------. 1 postgres postgres 8192 Sep 23 00:52 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92719
-rw-------. 1 postgres postgres 8192 Sep 23 00:52 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92720
-rw-------. 1 postgres postgres 8192 Sep 23 00:52 /pgData/pgsql15/edbua_tbs02/PG_15_202209061/92666/92721
[root@pg17 ~]#


Issue: Why are there 12 files when I have only 6 objects?

created only: 3 tables: emp01, emp02, emp03 & 3 indexes: emp01_ix, emp02_ix, emp03_ix

But in the tablespace directory, we're seeing 12 files: 3 tables + 3 indexes + 3 TOAST tables + 3 TOAST indexes

edbua=# SELECT
edbua-#     c.relname,
edbua-#     c.relfilenode,
edbua-#     c.relkind,
edbua-#     n.nspname AS schema,
edbua-#     t.spcname AS tablespace
edbua-# FROM
edbua-#     pg_class c
edbua-# JOIN
edbua-#     pg_namespace n ON n.oid = c.relnamespace
edbua-# LEFT JOIN
edbua-#     pg_tablespace t ON c.reltablespace = t.oid
edbua-# WHERE
edbua-#     c.reltablespace = (SELECT oid FROM pg_tablespace WHERE spcname = 'edbua_tbs02')
edbua-# ORDER BY
edbua-#     c.relfilenode;
       relname        | relfilenode | relkind |  schema  | tablespace
----------------------+-------------+---------+----------+-------------
 emp01                |       92710 | r       | public   | edbua_tbs02
 pg_toast_92685       |       92711 | t       | pg_toast | edbua_tbs02
 pg_toast_92685_index |       92712 | i       | pg_toast | edbua_tbs02
 emp02                |       92713 | r       | public   | edbua_tbs02
 pg_toast_92690       |       92714 | t       | pg_toast | edbua_tbs02
 pg_toast_92690_index |       92715 | i       | pg_toast | edbua_tbs02
 emp03                |       92716 | r       | public   | edbua_tbs02
 pg_toast_92695       |       92717 | t       | pg_toast | edbua_tbs02
 pg_toast_92695_index |       92718 | i       | pg_toast | edbua_tbs02
 emp01_ix             |       92719 | i       | public   | edbua_tbs02
 emp02_ix             |       92720 | i       | public   | edbua_tbs02
 emp03_ix             |       92721 | i       | public   | edbua_tbs02
(12 rows)

edbua=#


11. Rename tablespace

edbua=# ALTER TABLESPACE edbua_tbs02 RENAME TO edbua_tbs03;
ALTER TABLESPACE
edbua=#

edbua=# \db+ edbua*
                                                List of tablespaces
      Name       |  Owner   |            Location             | Access privileges | Options |  Size   | Description
-----------------+----------+---------------------------------+-------------------+---------+---------+-------------
 edbua_ixtbs01   | postgres | /pgData/pgsql15/edbua_ixtbs01   |                   |         | 6 bytes |
 edbua_tbs01     | postgres | /pgData/pgsql15/edbua_tbs01     |                   |         | 7789 kB |
 edbua_tbs03     | postgres | /pgData/pgsql15/edbua_tbs02     |                   |         | 48 kB   |
 edbua_temptbs01 | postgres | /pgData/pgsql15/edbua_temptbs01 |                   |         | 6 bytes |
(4 rows)

edbua=#


12. Drop Tablespace

edbua=# drop tablespace edbua_tbs03;
ERROR:  tablespace "edbua_tbs03" is not empty
edbua=#

edbua=# SELECT
edbua-#   CASE
edbua-#     WHEN c.relkind = 'r' THEN
edbua-#       format('ALTER TABLE %I.%I SET TABLESPACE edbua_tbs01;', n.nspname, c.relname)
edbua-#     WHEN c.relkind = 'i' THEN
edbua-#       format('ALTER INDEX %I.%I SET TABLESPACE edbua_tbs01;', n.nspname, c.relname)
edbua-#     WHEN c.relkind = 'S' THEN
edbua-#       format('ALTER SEQUENCE %I.%I SET TABLESPACE edbua_tbs01;', n.nspname, c.relname)
edbua-#   END AS alter_statement
edbua-# FROM pg_class c
edbua-# JOIN pg_namespace n ON n.oid = c.relnamespace
edbua-# WHERE c.reltablespace = (SELECT oid FROM pg_tablespace WHERE spcname = 'edbua_tbs03')
edbua-#   AND c.relkind IN ('r', 'i', 'S')
edbua-#   AND n.nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema')
edbua-# ORDER BY n.nspname, c.relname;
                     alter_statement
---------------------------------------------------------
 ALTER TABLE public.emp01 SET TABLESPACE edbua_tbs01;
 ALTER INDEX public.emp01_ix SET TABLESPACE edbua_tbs01;
 ALTER TABLE public.emp02 SET TABLESPACE edbua_tbs01;
 ALTER INDEX public.emp02_ix SET TABLESPACE edbua_tbs01;
 ALTER TABLE public.emp03 SET TABLESPACE edbua_tbs01;
 ALTER INDEX public.emp03_ix SET TABLESPACE edbua_tbs01;
(6 rows)

edbua=#

edbua=# ALTER TABLE public.emp01 SET TABLESPACE edbua_tbs01;
 ALTER INDEX public.emp02_ix SET TABLESPACE edbua_tbs01;
 ALTER TABLE public.emp03 SET TABLESPACE edbua_tbs01;
 ALTER INDEX public.emp03_ix SET TABLESPACE edbua_tbs01;ALTER TABLE
edbua=#  ALTER INDEX public.emp01_ix SET TABLESPACE edbua_tbs01;
ALTER INDEX
edbua=#  ALTER TABLE public.emp02 SET TABLESPACE edbua_tbs01;
ALTER TABLE
edbua=#  ALTER INDEX public.emp02_ix SET TABLESPACE edbua_tbs01;
ALTER INDEX
edbua=#  ALTER TABLE public.emp03 SET TABLESPACE edbua_tbs01;
ALTER TABLE
edbua=#  ALTER INDEX public.emp03_ix SET TABLESPACE edbua_tbs01;
ALTER INDEX
edbua=#

edbua=# drop tablespace edbua_tbs03;
DROP TABLESPACE
edbua=# \db+ edbua*
                                                List of tablespaces
      Name       |  Owner   |            Location             | Access privileges | Options |  Size   | Description
-----------------+----------+---------------------------------+-------------------+---------+---------+-------------
 edbua_ixtbs01   | postgres | /pgData/pgsql15/edbua_ixtbs01   |                   |         | 6 bytes |
 edbua_tbs01     | postgres | /pgData/pgsql15/edbua_tbs01     |                   |         | 7837 kB |
 edbua_temptbs01 | postgres | /pgData/pgsql15/edbua_temptbs01 |                   |         | 6 bytes |
(3 rows)

edbua=#


13. Change ownership for Tablespace

edbua=# ALTER TABLESPACE edbua_tbs01 OWNER TO teja;
ALTER TABLESPACE
edbua=# \db+ edbua*
                                                List of tablespaces
      Name       |  Owner   |            Location             | Access privileges | Options |  Size   | Description
-----------------+----------+---------------------------------+-------------------+---------+---------+-------------
 edbua_ixtbs01   | postgres | /pgData/pgsql15/edbua_ixtbs01   |                   |         | 6 bytes |
 edbua_tbs01     | teja     | /pgData/pgsql15/edbua_tbs01     |                   |         | 7837 kB |
 edbua_temptbs01 | postgres | /pgData/pgsql15/edbua_temptbs01 |                   |         | 6 bytes |
(3 rows)

edbua=# ALTER TABLESPACE edbua_tbs01 OWNER TO postgres;
ALTER TABLESPACE
edbua=# \db+ edbua*
                                                List of tablespaces
      Name       |  Owner   |            Location             | Access privileges | Options |  Size   | Description
-----------------+----------+---------------------------------+-------------------+---------+---------+-------------
 edbua_ixtbs01   | postgres | /pgData/pgsql15/edbua_ixtbs01   |                   |         | 6 bytes |
 edbua_tbs01     | postgres | /pgData/pgsql15/edbua_tbs01     |                   |         | 7837 kB |
 edbua_temptbs01 | postgres | /pgData/pgsql15/edbua_temptbs01 |                   |         | 6 bytes |
(3 rows)

edbua=#


14. Verify Symbolic Links

edbua=# show data_directory;
    data_directory
----------------------
 /pgData/pgsql15/data  <----
(1 row)

edbua=#

[root@pg17 pg_tblspc]# ls -ltr /pgData/pgsql15/data/pg_tblspc/*
lrwxrwxrwx. 1 postgres postgres 22 Aug 18 06:36 /pgData/pgsql15/data/pg_tblspc/24581 -> /u01/data/dell_ts_data
lrwxrwxrwx. 1 postgres postgres 23 Aug 18 06:36 /pgData/pgsql15/data/pg_tblspc/24582 -> /u01/data/dell_ts_index
lrwxrwxrwx. 1 postgres postgres 20 Sep  3 09:52 /pgData/pgsql15/data/pg_tblspc/24594 -> /pgData/pgsql15/data
lrwxrwxrwx. 1 postgres postgres 29 Sep  3 11:55 /pgData/pgsql15/data/pg_tblspc/24597 -> /pgData/pgsql15/data/trd_tb01
lrwxrwxrwx. 1 postgres postgres 29 Sep  3 11:55 /pgData/pgsql15/data/pg_tblspc/24598 -> /pgData/pgsql15/data/trd_ix01
lrwxrwxrwx. 1 postgres postgres 27 Sep  4 05:59 /pgData/pgsql15/data/pg_tblspc/32787 -> /pgData/pgsql15/pgtb/geb_tb
lrwxrwxrwx. 1 postgres postgres 27 Sep  4 06:03 /pgData/pgsql15/data/pg_tblspc/32788 -> /pgData/pgsql15/pgix/geb_ix
lrwxrwxrwx. 1 postgres postgres 27 Sep 20 07:20 /pgData/pgsql15/data/pg_tblspc/92662 -> /pgData/pgsql15/edbua_tbs01
lrwxrwxrwx. 1 postgres postgres 29 Sep 20 07:21 /pgData/pgsql15/data/pg_tblspc/92664 -> /pgData/pgsql15/edbua_ixtbs01
lrwxrwxrwx. 1 postgres postgres 31 Sep 20 07:21 /pgData/pgsql15/data/pg_tblspc/92665 -> /pgData/pgsql15/edbua_temptbs01
[root@pg17 pg_tblspc]#


15. How to find tablespace size

edbua=# SELECT spcname, pg_size_pretty(pg_tablespace_size(spcname)) AS size FROM pg_tablespace;
     spcname     |  size
-----------------+---------
 pg_default      | 1660 MB
 pg_global       | 571 kB
 dell_ts_data    | 7761 kB
 dell_ts_index   | 16 kB
 dell_tbs        | 0 bytes
 trd_tb01        | 1615 MB
 trd_ix01        | 2648 kB
 geb_tb          | 13 GB
 geb_ix          | 8950 MB
 edbua_ixtbs01   | 6 bytes
 edbua_temptbs01 | 6 bytes
 edbua_tbs01     | 7837 kB
(12 rows)

edbua=#
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you
Rajasekhar Amudala

PostgreSQL pg_hba.conf

Host-Based Authentication (pg_hba.conf)

Table of Contents


1. What is pg_hba.conf?
2. Authentication Methods in pg_hba.conf
3. Create Database and User
4. Contents of pg_hba.conf
5. Play with peer
6. Play with trust
7. Play with reject
8. Restrict by User
9. Restrict by Network
10. Verify logs



1. What is pg_hba.conf?

HBA = Host-Based Authentication.
Location: usually inside PostgreSQL data directory (/var/lib/pgsql/<version>/data/pg_hba.conf or /pgData/pgsql15/data/pg_hba.conf depending on your setup).



Format:

# TYPE  DATABASE  USER  ADDRESS        METHOD
TYPE: local, host, hostssl, hostnossl
DATABASE: which DBs (e.g. all, postgres, mydb)
USER: which roles (e.g. all, myuser)
ADDRESS: client IP/CIDR (127.0.0.1/32, 192.168.2.0/24)
METHOD: authentication method (trust, md5, scram-sha-256, peer, reject, cert)

OPTIONS	: optional settings (e.g., clientcert=1)


2. Authentication Methods in pg_hba.conf

trust:
--- > No password needed. Anyone who can connect to the server is trusted.
--- > Use: testing only.
--- > Not secure in production.

Example:

host    all    all    127.0.0.1/32    trust

md5
--- > Password required, stored as MD5 hash.
--- > Legacy support. Weaker security, avoid if possible.

Example:

host    all    all    127.0.0.1/32    md5

scram-sha-256
--- > Password required, stored as salted SCRAM-SHA-256 hash.
--- > Stronger than MD5.
--- > Recommended method for production.

Example:

host    all    all    127.0.0.1/32    scram-sha-256


peer
--- > Works for local connections only.
--- > The OS user name must match the PostgreSQL role.
--- > Good for local scripts/services under same user.

Example:

local   all    all                     peer


reject
--- > Explicitly denies access.
----> Useful for blocking unwanted connections (like a firewall rule).

Example:

host    all    all    0.0.0.0/0       reject


cert
---> Requires SSL/TLS client certificate.
---> PostgreSQL role must match certificate username.
---> Very secure for enterprise / production with SSL.

Example:
hostssl all   all    192.168.1.0/24   cert clientcert=1


3. Create Database and User

postgres=# CREATE USER teja WITH PASSWORD 'teja123';
CREATE ROLE
postgres=# CREATE DATABASE orcl OWNER teja;
CREATE DATABASE
postgres=#


4. Contents of pg_hba.conf

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres
local   all             postgres                                peer

# Allow local password access for all
local   all             all                                     scram-sha-256

[postgres@pg17 ~]$


5. Play with peer

Works for local connections only. The OS user name must match the PostgreSQL role.

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres

local   all             postgres                                peer


# Allow local password access for all
local   all             all                                     scram-sha-256

[postgres@pg17 ~]$

[postgres@pg17 ~]$ psql -U teja -d orcl
 Password for user teja: <---- it's asking password 

psql (15.13)
Type "help" for help.

orcl=> exit
[postgres@pg17 ~]$

 Password Not asking for user postgres 
[postgres@pg17 ~]$ psql -U postgres -d orcl
psql (15.13)
Type "help" for help.

orcl=#


6. Play with trust

No password needed. Anyone who can connect to the server is trusted.
Use: testing only. Not secure in production.

Change pg_hba.conf:

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres
local   all             postgres                                peer

# Allow local password access for all

local   all             all                                     trust

[postgres@pg17 ~]$

[postgres@pg17 ~]$ /usr/pgsql-15/bin/pg_ctl reload -D /pgData/pgsql15/data/
server signaled
[postgres@pg17 ~]$ psql -U teja -d orcl  <--- It won’t ask for a password. 
psql (15.13)
Type "help" for help.

orcl=>


7. Play with reject

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres
local   all             postgres                                peer

# Allow local password access for all

local   all             all                                     reject

[postgres@pg17 ~]$

[postgres@pg17 ~]$ /usr/pgsql-15/bin/pg_ctl reload -D /pgData/pgsql15/data/
server signaled
[postgres@pg17 ~]$ psql -U teja -d orcl

psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  pg_hba.conf rejects connection for host "[local]", user "teja", database "orcl", no encryption

[postgres@pg17 ~]$


8. Restrict by User

Allow only user teja, block everyone else:

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres
local   all             postgres                                peer

# Allow local password access for all
local   all             all                                     trust

# Allow IPv4 localhost

host    orcl            teja             192.168.2.31/32         scram-sha-256
host    orcl            all              192.168.2.31/32         reject


[postgres@pg17 ~]$

[postgres@pg17 ~]$ /usr/pgsql-15/bin/pg_ctl reload -D /pgData/pgsql15/data/
server signaled
[postgres@pg17 ~]$ psql -U teja -d orcl -h 192.168.2.31
Password for user teja:
psql (15.13)
Type "help" for help.

orcl=> \conninfo
You are connected to database "orcl" as user "teja" on host "192.168.2.31" at port "5432".
orcl=>
orcl=> exit
[postgres@pg17 ~]$


[postgres@pg17 ~]$ psql -U postgres -d orcl -h 192.168.2.31

psql: error: connection to server at "192.168.2.31", port 5432 failed: FATAL:  pg_hba.conf rejects connection for host "192.168.2.31", user "postgres", database "orcl", no encryption

[postgres@pg17 ~]$


Notice: Only user Teja able to connect where as user postgres not able to connect


9. Restrict by Network

We want to block connections from IP 192.168.2.0/24 

[postgres@pg17 ~]$ cat /pgData/pgsql15/data/pg_hba.conf
# TYPE  DATABASE         USER            ADDRESS                METHOD

# Allow local peer access for postgres
local   all             postgres                                peer

# Allow local password access for all
local   all             all                                     trust

# Allow IPv4 localhost

host    all             all             192.168.2.0/24          reject

[postgres@pg17 ~]$

[postgres@pg17 ~]$ /usr/pgsql-15/bin/pg_ctl reload -D /pgData/pgsql15/data/
server signaled
[postgres@pg17 ~]$ 
[postgres@pg17 ~]$ psql -U teja -d orcl -h 192.168.2.31

psql: error: connection to server at "192.168.2.31", port 5432 failed: FATAL:  pg_hba.conf rejects connection for host "192.168.2.31", user "teja", database "orcl", no encryption

[postgres@pg17 ~]$


10. Verify logs

postgres=# SELECT * FROM pg_hba_file_rules;
 line_number | type  | database | user_name  |   address    |     netmask     |  auth_method  | options | error
-------------+-------+----------+------------+--------------+-----------------+---------------+---------+-------
           4 | local | {all}    | {postgres} |              |                 | peer          |         |
           7 | local | {all}    | {all}      |              |                 | trust         |         |
          11 | host  | {orcl}   | {teja}     | 192.168.2.31 | 255.255.255.255 | scram-sha-256 |         |
          12 | host  | {orcl}   | {all}      | 192.168.2.31 | 255.255.255.255 | reject        |         |
(4 rows)

postgres=#

[postgres@pg17 ~]$ tail -f /pgData/pgsql15/data/log/postgresql-Tue.log
2025-09-16 04:08:37.244 EDT [8294] LOG:  database system was shut down at 2025-09-16 04:08:32 EDT
2025-09-16 04:08:37.251 EDT [8289] LOG:  database system is ready to accept connections
2025-09-16 04:11:27.459 EDT [8289] LOG:  received SIGHUP, reloading configuration files
2025-09-16 04:11:31.842 EDT [8401] FATAL:  pg_hba.conf rejects connection for host "[local]", user "teja", database "orcl", no encryption
2025-09-16 04:13:37.568 EDT [8292] LOG:  checkpoint starting: time
2025-09-16 04:13:37.573 EDT [8292] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.002 s, total=0.006 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB
2025-09-16 04:16:15.863 EDT [8289] LOG:  received SIGHUP, reloading configuration files
2025-09-16 04:16:52.318 EDT [8474] FATAL:  pg_hba.conf rejects connection for host "192.168.2.31", user "teja", database "orcl", no encryption
2025-09-16 04:27:15.932 EDT [8289] LOG:  received SIGHUP, reloading configuration files
2025-09-16 04:27:50.593 EDT [8613] FATAL:  pg_hba.conf rejects connection for host "192.168.2.31", user "postgres", database "orcl", no encryption

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

PostgreSQL User Management

PostgreSQL User Management

Create Users, Groups and Schema Paths for PostgreSQL

Table of Contents


Step 1: Create a User
Step 2: Change User Password
Step 3: Grant Database Access
Step 4: Expire Password
Step 5: Set Password Never Expire
Step 6: Lock Account
Step 7: Unlock Account
Step 8: Create Schema
Step 9: Create Roles & Users
Step 10: Assign Ownership
Step 11: Grant Schema Privileges
Step 12: Grant RW Privileges
Step 13: Grant RO Privileges
Step 14: Assign Roles to Users
Step 15: Testing
Step 16: Set Schema Search Path
Step 17: Groups
Step 18: PostgreSQL — Table-View Privileges


The primary difference between CREATE ROLE and CREATE USER is that CREATE USER automatically includes the LOGIN privilege, allowing the role to connect to the database, whereas CREATE ROLE does not grant the LOGIN privilege unless it is explicitly specified.

PostgreSQL internally treats users and groups as roles. Therefore, using CREATE ROLE is often recommended. However, CREATE USER and CREATE GROUP are still supported and commonly used by DBAs. You can use whichever command you find easier to understand and manage.


Step 1: Create a User

-- Option 1: Using CREATE USER
CREATE USER john WITH PASSWORD 'mypassword';

-- Option 2: Using CREATE ROLE with LOGIN
CREATE ROLE john LOGIN PASSWORD 'mypassword';

postgres=# CREATE USER john WITH PASSWORD 'mypassword';
CREATE ROLE
postgres=# CREATE ROLE john LOGIN PASSWORD 'mypassword';
ERROR:  role "john" already exists



Step 2: Change User Password

Passwords can be changed by either an admin or the user.

By Admin:

postgres=# ALTER USER john WITH PASSWORD 'newpassword';
ALTER ROLE
postgres=#

-- OR --

postgres=# \password john
Enter new password for user "john":
Enter it again:
postgres=#


By User (self-service): From the psql prompt:

[postgres@pg17 ~]$ psql -h 192.168.2.31 -U john -d mydb -W
Password:

mydb=> \conninfo
You are connected to database "mydb" as user "john" on host "192.168.2.31" at port "5432".

mydb=> \password
Enter new password for user "john":
Enter it again:
mydb=>



Step 3: Grant Database Access

To allow a user to connect to a database:

postgres=# GRANT CONNECT ON DATABASE mydb TO john;
GRANT
postgres=#


Verify user login:

-- Connect as user
[postgres@pg17 ~]$ psql -h 192.168.2.31 -U john -d mydb -W
Password:

-- Check current user
mydb=> SELECT CURRENT_USER;
 current_user
--------------
 john
(1 row)

mydb=>
mydb=> select session_user;
 session_user
--------------
 john
(1 row)

-- Connection info
mydb=> \conninfo
You are connected to database "mydb" as user "john" on host "192.168.2.31" at port "5432".
mydb=>



Step 4: Expire User Password

postgres=# ALTER USER john VALID UNTIL '2025-09-11';
ALTER ROLE
postgres=#
postgres=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 john      | Password valid until 2025-09-11 00:00:00-04                | {}        |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |

postgres=#



Step 5: Set Password to Never Expire

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 john      | Password valid until 2025-09-11 00:00:00-04                | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


-- Without changing existing password

postgres=# ALTER USER john VALID UNTIL 'infinity';
ALTER ROLE
postgres=#

-- With changing existing password

postgres=# ALTER USER john WITH PASSWORD 'newpassword' VALID UNTIL 'infinity';
ALTER ROLE
postgres=#
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 john      | Password valid until infinity                              | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}


postgres=#

-- Set to future date

postgres=# ALTER USER john VALID UNTIL '2025-12-31';
ALTER ROLE
postgres=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 john      | Password valid until 2025-12-31 00:00:00-05                | {}        |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |

postgres=#



Step 6: Lock User Account

postgres=# ALTER USER john NOLOGIN;
ALTER ROLE
postgres=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 john      | Cannot login                                              +| {}        |
           | Password valid until infinity                              |           |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |

postgres=#



Step 7: Unlock User Account

postgres=# ALTER USER john LOGIN;
ALTER ROLE
postgres=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 john      | Password valid until infinity                              | {}        |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |

postgres=#



Step 8: Create Schema

[postgres@pg17 ~]$ psql
psql (15.13)
Type "help" for help.

postgres=# \c mydb
You are now connected to database "mydb" as user "postgres".
mydb=#
mydb=# CREATE SCHEMA BLP;
CREATE SCHEMA
mydb=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 blp    | postgres
 public | pg_database_owner
(2 rows)

mydb=#



Step 9: Create Roles & Users

postgres=# CREATE USER "BLP" WITH PASSWORD 'blp';
CREATE ROLE
postgres=# 
postgres=# CREATE ROLE blp_rw NOLOGIN;
CREATE ROLE
postgres=# CREATE ROLE blp_ro NOLOGIN;
CREATE ROLE
postgres=#

postgres=# CREATE USER alice WITH PASSWORD 'alice123';
CREATE ROLE
postgres=# CREATE USER bob WITH PASSWORD 'bob123';
CREATE ROLE
postgres=# CREATE USER charlie WITH PASSWORD 'charlie123';
CREATE ROLE
postgres=#

postgres=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 BLP       |                                                            | {}        |
 alice     |                                                            | {}        |
 blp_ro    | Cannot login                                               | {}        |
 blp_rw    | Cannot login                                               | {}        |
 bob       |                                                            | {}        |
 charlie   |                                                            | {}        |
 john      | Password valid until 2025-12-31 00:00:00-05                | {}        |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |
 trduser   |                                                            | {}        |

postgres=#



Step 10: Assign Ownership on Schema

-- Please do NOT grant this privillege, Owner can drop the schema, change privileges, and has full control over all objects inside.

postgres=# \c mydb
You are now connected to database "mydb" as user "postgres".
mydb=#
mydb=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 blp    | postgres
 public | pg_database_owner
(2 rows)

mydb=# ALTER SCHEMA BLP OWNER TO "BLP";
ALTER SCHEMA
mydb=#

mydb=# \dn+
                                       List of schemas
  Name  |       Owner       |           Access privileges            |      Description
--------+-------------------+----------------------------------------+------------------------
 blp    | BLP               |                                        |
 public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
        |                   | =U/pg_database_owner                   |
(2 rows)

mydb=# 



Step 11: Grant Schema Privileges to Owner

-- Full control on schema: usage + create
GRANT USAGE, CREATE ON SCHEMA blp TO "BLP";

mydb=# \dn+
                                       List of schemas
  Name  |       Owner       |           Access privileges            |      Description
--------+-------------------+----------------------------------------+------------------------
 blp    | BLP               |                                        |
 public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
        |                   | =U/pg_database_owner                   |
(2 rows)

mydb=# GRANT USAGE, CREATE ON SCHEMA blp TO "BLP";
GRANT
mydb=# \dn+
                                       List of schemas
  Name  |       Owner       |           Access privileges            |      Description
--------+-------------------+----------------------------------------+------------------------
 blp    | BLP               | BLP=UC/BLP                             |
 public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
        |                   | =U/pg_database_owner                   |
(2 rows)

mydb=#



Step 12: Grant RW Privileges

USAGE → allows the role to see the schema and its objects.

-- Grant schema access without CREATE
GRANT USAGE ON SCHEMA BLP TO blp_rw;

-- Grant DML on all existing tables
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA BLP TO blp_rw;

-- Future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA BLP GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO blp_rw;

mydb=# GRANT USAGE ON SCHEMA BLP TO blp_rw;
GRANT
mydb=# GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA BLP TO blp_rw;
GRANT
mydb=# ALTER DEFAULT PRIVILEGES IN SCHEMA BLP GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO blp_rw;
ALTER DEFAULT PRIVILEGES
mydb=#
mydb=# \dn+
                                       List of schemas
  Name  |       Owner       |           Access privileges            |      Description
--------+-------------------+----------------------------------------+------------------------
 blp    | BLP               | BLP=UC/BLP                            +|
        |                   | blp_rw=U/BLP                           |
 public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
        |                   | =U/pg_database_owner                   |
(2 rows)

mydb=#



Step 13: Grant RO Privileges

-- Grant schema access without CREATE
GRANT USAGE ON SCHEMA BLP TO BLP_RO;

-- Grant SELECT on all existing tables
GRANT SELECT ON ALL TABLES IN SCHEMA BLP TO BLP_RO;

-- Future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA BLP GRANT SELECT ON TABLES TO BLP_RO;

mydb=# GRANT USAGE ON SCHEMA BLP TO BLP_RO;
GRANT
mydb=# GRANT SELECT ON ALL TABLES IN SCHEMA BLP TO BLP_RO;
GRANT
mydb=# ALTER DEFAULT PRIVILEGES IN SCHEMA BLP GRANT SELECT ON TABLES TO BLP_RO;
ALTER DEFAULT PRIVILEGES
mydb=#
mydb=# \dn+
                                       List of schemas
  Name  |       Owner       |           Access privileges            |      Description
--------+-------------------+----------------------------------------+------------------------
 blp    | BLP               | BLP=UC/BLP                            +|
        |                   | blp_rw=U/BLP                          +|
        |                   | blp_ro=U/BLP                           |
 public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
        |                   | =U/pg_database_owner                   |
(2 rows)

mydb=#



Step 14: Assign Roles to Users

mydb=# GRANT BLP_RW TO ALICE;
GRANT ROLE
mydb=# 
mydb=# GRANT BLP_RO TO BOB,CHARLIE;
GRANT ROLE
mydb=#

mydb=# \du+
                                          List of roles
 Role name |                         Attributes                         | Member of | Description
-----------+------------------------------------------------------------+-----------+-------------
 BLP       |                                                            | {}        |
 alice     |                                                            | {blp_rw}  |
 blp_ro    | Cannot login                                               | {}        |
 blp_rw    | Cannot login                                               | {}        |
 bob       |                                                            | {blp_ro}  |
 charlie   |                                                            | {blp_ro}  |
 john      | Password valid until 2025-12-31 00:00:00-05                | {}        |
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}        |
 trduser   |                                                            | {}        |

mydb=# 



Step 15: Testing

-- Login to BLP user on mydb database and create table on blp schema. 

[postgres@pg17 ~]$ psql -h 192.168.2.31 -U BLP -d mydb -W
Password:
psql (15.13)
Type "help" for help.

mydb=> \conninfo
You are connected to database "mydb" as user "BLP" on host "192.168.2.31" at port "5432".
mydb=> CREATE TABLE blp.employees (
mydb(>     emp_id SERIAL PRIMARY KEY,
mydb(>     first_name VARCHAR(50),
mydb(>     last_name VARCHAR(50),
mydb(>     hire_date DATE,
mydb(>     salary NUMERIC(10,2)
mydb(> );
CREATE TABLE
mydb=>

mydb=> INSERT INTO blp.employees (first_name, last_name, hire_date, salary) VALUES
mydb-> ('John', 'Doe', '2023-01-15', 5000.00),
mydb-> ('Jane', 'Smith', '2022-11-20', 6000.00),
mydb-> ('Alice', 'Johnson', '2024-03-01', 5500.00);
INSERT 0 3
mydb=>
mydb=> select * from blp.employees;
 emp_id | first_name | last_name | hire_date  | salary
--------+------------+-----------+------------+---------
      1 | John       | Doe       | 2023-01-15 | 5000.00
      2 | Jane       | Smith     | 2022-11-20 | 6000.00
      3 | Alice      | Johnson   | 2024-03-01 | 5500.00
(3 rows)

mydb=>

mydb=> drop table blp.employees;
DROP TABLE
mydb=>

-- Login to alice user on mydb database and update table on blp schema. 



[root@pg17 ~]# psql -h 192.168.2.31 -U alice -d mydb -W
Password:
psql (15.13)
Type "help" for help.

mydb=> \conninfo
You are connected to database "mydb" as user "alice" on host "192.168.2.31" at port "5432".
mydb=>

mydb=> \du+ alice
                  List of roles
 Role name | Attributes | Member of | Description
-----------+------------+-----------+-------------
 alice     |            | {blp_rw}  |

mydb=>


mydb=> \dt+ blp.*
                                      List of relations
 Schema |   Name    | Type  | Owner | Persistence | Access method |    Size    | Description
--------+-----------+-------+-------+-------------+---------------+------------+-------------
 blp    | employees | table | BLP   | permanent   | heap          | 8192 bytes |
(1 row)

mydb=> select * from blp.employees;
 emp_id | first_name | last_name | hire_date  | salary
--------+------------+-----------+------------+---------
      1 | John       | Doe       | 2023-01-15 | 5000.00
      2 | Jane       | Smith     | 2022-11-20 | 6000.00
      3 | Alice      | Johnson   | 2024-03-01 | 5500.00
(3 rows)

mydb=> UPDATE blp.employees
SET salary = CASE
                WHEN first_name = 'John' THEN 7000.00
                WHEN first_name = 'Alice' THEN 6500.00
             END
WHERE first_name IN ('John', 'Alice');
UPDATE 2
mydb=> select * from blp.employees;
 emp_id | first_name | last_name | hire_date  | salary
--------+------------+-----------+------------+---------
      2 | Jane       | Smith     | 2022-11-20 | 6000.00
      1 | John       | Doe       | 2023-01-15 | 7000.00
      3 | Alice      | Johnson   | 2024-03-01 | 6500.00
(3 rows)

mydb=>

-- Note, we have granted only DML privilleges, hence create and alter table command failing

mydb=> CREATE TABLE blp.departments (
mydb(>     dept_id SERIAL PRIMARY KEY,
mydb(>     dept_name VARCHAR(100) NOT NULL,
mydb(>     location VARCHAR(100)
mydb(> );
ERROR:  permission denied for schema blp
LINE 1: CREATE TABLE blp.departments (
                     ^
mydb=>

mydb=> ALTER TABLE blp.employees
mydb-> ADD COLUMN department VARCHAR(50);
ERROR:  must be owner of table employees
mydb=>

-- Login to bob user on mydb database and select table on blp schema. 

[postgres@pg17 ~]$ psql -h 192.168.2.31 -U bob -d mydb -W
Password:
psql (15.13)
Type "help" for help.

mydb=> \conninfo
You are connected to database "mydb" as user "bob" on host "192.168.2.31" at port "5432".
mydb=>
mydb=> \du+ bob
                  List of roles
 Role name | Attributes | Member of | Description
-----------+------------+-----------+-------------
 bob       |            | {blp_ro}  |

mydb-> \dt+ blp.*
                                      List of relations
 Schema |   Name    | Type  | Owner | Persistence | Access method |    Size    | Description
--------+-----------+-------+-------+-------------+---------------+------------+-------------
 blp    | employees | table | BLP   | permanent   | heap          | 8192 bytes |
(1 row)

mydb=> select * from blp.employees;
 emp_id | first_name | last_name | hire_date  | salary
--------+------------+-----------+------------+---------
      2 | Jane       | Smith     | 2022-11-20 | 6000.00
      1 | John       | Doe       | 2023-01-15 | 7000.00
      3 | Alice      | Johnson   | 2024-03-01 | 6500.00
(3 rows)

mydb=>

mydb=> INSERT INTO blp.employees (first_name, last_name, hire_date, salary) VALUES
mydb-> ('Bob', 'Williams', '2024-04-01', 5800.00),
mydb-> ('Clara', 'Brown', '2024-05-10', 6200.00),
mydb-> ('David', 'Lee', '2024-06-15', 5300.00);
ERROR:  permission denied for table employees
mydb=>



Step 16: Set Schema Search Path

[postgres@pg17 ~]$ psql -h 192.168.2.31 -U BLP -d mydb -W
Password:
psql (15.13)
Type "help" for help.

mydb=> 
mydb=> \conninfo
You are connected to database "mydb" as user "BLP" on host "192.168.2.31" at port "5432".
mydb=>
mydb=> \dt+ blp.*
                                      List of relations
 Schema |   Name    | Type  | Owner | Persistence | Access method |    Size    | Description
--------+-----------+-------+-------+-------------+---------------+------------+-------------
 blp    | employees | table | BLP   | permanent   | heap          | 8192 bytes |
(1 row)

mydb=> 

mydb=> select * from employees;
ERROR:  relation "employees" does not exist
LINE 1: select * from employees;
mydb=>

mydb=> SET search_path to BLP; -- Temporarily for this session
SET
mydb=> select * from employees;
 emp_id | first_name | last_name | hire_date  | salary
--------+------------+-----------+------------+---------
      2 | Jane       | Smith     | 2022-11-20 | 6000.00
      1 | John       | Doe       | 2023-01-15 | 7000.00
      3 | Alice      | Johnson   | 2024-03-01 | 6500.00
(3 rows)

mydb=>

-- Make the Schema Default for the user BLP -- Permenant
ALTER ROLE blp_owner SET search_path = BLP;


Step 17: Groups

postgres=# CREATE GROUP app_users;
postgres=# ALTER GROUP app_users ADD USER alice;
postgres=# ALTER GROUP app_users ADD USER bob;
postgres=# ALTER GROUP app_users ADD USER charlie;
postgres=# ALTER GROUP app_users DROP USER charlie;
postgres=# ALTER GROUP app_users RENAME TO appusers;
postgres=# DROP GROUP appusers;

mydb=> select * from pg_group;
          groname          | grosysid |    grolist
---------------------------+----------+---------------
 pg_database_owner         |     6171 | {}
 pg_read_all_data          |     6181 | {}
 pg_write_all_data         |     6182 | {}
 pg_monitor                |     3373 | {}
 pg_read_all_settings      |     3374 | {3373}
 pg_read_all_stats         |     3375 | {3373}
 pg_stat_scan_tables       |     3377 | {3373}
 pg_read_server_files      |     4569 | {}
 pg_write_server_files     |     4570 | {}
 pg_execute_server_program |     4571 | {}
 pg_signal_backend         |     4200 | {}
 pg_checkpoint             |     4544 | {}
 blp_rw                    |    84444 | {84447}
 blp_ro                    |    84445 | {84448,84449}
 app_users                 |    84468 | {}
(15 rows)

mydb=>



Step 18: PostgreSQL Object-Level Privilege Summary

mydb=> \z blp.employees
                               Access privileges
 Schema |   Name    | Type  | Access privileges | Column privileges | Policies
--------+-----------+-------+-------------------+-------------------+----------
 blp    | employees | table | BLP=arwdDxt/BLP  +|                   |
        |           |       | blp_ro=r/BLP     +|                   |
        |           |       | blp_rw=arwd/BLP   |                   |
(1 row)

Example:

 

ShortFull PrivilegeExample GRANT
rSELECTGRANT SELECT ON employees TO hr_user;
aINSERTGRANT INSERT ON employees TO hr_user;
wUPDATEGRANT UPDATE ON employees TO hr_user;
dDELETEGRANT DELETE ON employees TO hr_user;
DTRUNCATEGRANT TRUNCATE ON employees TO hr_user;
xREFERENCESGRANT REFERENCES ON employees TO hr_user;
tTRIGGERGRANT TRIGGER ON employees TO hr_user;
RRULEGRANT RULE ON employees TO hr_user; (rarely used)

 

Tip: the shorthand string you see in \z (for example arwdDxt) can be expanded by mapping each letter to the rows above, then converting them into one or more GRANT statements.

 

 

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
WhatsApp : 
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/

 

PSQL

PostgreSQL DBA Step by Step Learning

#PostgreSQL DBA Topics
1How to Install PostgreSQL ON Linux?
2How to Install PostgreSQL on Linux 7 using source code?
3How to START/STOP PostgreSQL ON Linux?
4How to Create Database in PostgreSQL?
5PostgreSQL User Management
6PostgreSQL pg_hba.conf Guide
7PostgreSQL Change Data Directory
8Understanding WAL Files in PostgreSQL – For Oracle DBAs
9Change PostgreSQL WAL Directory Path (pg_wal)
10Enable Archive Mode in PostgreSQL 17
11How to Disable ARCHIVELOG Mode
12PostgreSQL Tablespace Management
13PostgreSQL pg_dump and pg_restore Guide
14PostgreSQL Backup and Restore Using pg_dumpall and psql
15pg_basebackup – Backup, Restore, and Recovery
16Backup & Restore PostgreSQL DB Cluster to Another Host (No Archive Mode)
17Backup & Restore PostgreSQL DB Cluster on Same Host
18Restore PostgreSQL to New Host using pg_basebackup + WAL Archives
19PostgreSQL PITR – Point in Time Recovery
20Configure Streaming Replication in PostgreSQL
21Manual Failover in PostgreSQL Streaming Replication
22Convert Asynchronous Replication to Synchronous Replication

 

Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/