πŸŽ“ 100% FREE TRAINING
πŸ†“ 100% FREE PostgreSQL DBA Training for Beginners FREE! FREE! FREE! No fees. No hidden charges. πŸ“… Free Live Batch: November 16 – December 15, 2026 ⏰ Free Live Classes: Monday to Friday, 7 AM IST πŸ‘‰ Register FREE & Join WhatsApp Group πŸ“˜ See the FREE Course Content πŸ†“ 100% FREE PostgreSQL DBA Training for Beginners FREE! FREE! FREE! No fees. No hidden charges. πŸ“… Free Live Batch: November 16 – December 15, 2026 ⏰ Free Live Classes: Monday to Friday, 7 AM IST πŸ‘‰ Register FREE & Join WhatsApp Group πŸ“˜ See the FREE Course Content
BRIGHT DBARemote Database Services
  • Services
  • Training
  • Knowledge Base
    • Oracle
      • DBA Monitor
        • DBA Sheet v7.0 popular
        • OS-DB-Commands
        • Database-Scripts
        • Generate INSERT statements from the SELECT query
        • Generate INSERT statements to a flat file using a PL/SQL query
      • DB-Install
        • Install Oracle AI Database 26ai
        • Install 19c GUI
        • Install 19c in silent mode
        • Install 18c
        • Install 12.2 Database Binaries in silent mode
        • Install Oracle Software in silent mode 11gR2
        • Install 10g
        • Deinstall Oracle 11gR2 Database binaries
        • Deinstall Oracle 18c Database Binaries
        • Oracle 19c Deinstall
        • Uninstall Oracle Client on Windows
      • DB-Upgrade
        • Upgrade DB using DBUA from 11.2.0.4 to 12.2.0.1
        • Upgrade DB Manually 11.2.0.4 to 12.2.0.1
        • Upgrade Oracle Database from 12.2.0.1 to 19c using DBUA
        • Upgrade Oracle Database Manually from 12.2.0.1 to 19c
        • Rolling Upgrade With an Existing Physical Standby Database
        • Upgrade TIMEZONE Version
        • Upgrade Database to 12.2 with Physical Standby
      • Patching
        • Patch Terminology
        • Apply Patch RU on Database 19c
        • 18c DB Patching
        • 18c DB Patching - Youtube
        • Apply RU on DATABASE 12.2 (CDB/PDB)
        • ROLLBACK RU from DATABASE 12.2
        • Apply DB PSU on Standby
      • CDB
        • CREATE NEW PDB BY CLONING AN EXISTING PDB
        • CREATE PDB USING DBCA
        • CREATE PDB USING SEED
        • DROP PDB MANUALLY
        • STARTUP/SHUTDOWN CDB AND PDB
        • Convert Non-CDB to PDB with DBMS_PDB
        • SCHEMA REFRESH FROM 11G TO 12C PDB
      • Non-CDB
        • Store DB credentials in Oracle Wallet
        • Create database -DBCA silent mode
        • Drop Database
        • Delete database -DBCA silent mode
        • DBT-06103 The port (1,522) is already used - DBCA
        • Create DB 19C – DBCA-GUI
        • Create DB 19C – DBCA-SILENT
        • CREATE NON-CDB ON ORACLE 12C IN SILENT MODE
        • Configure OEM Express 12c
        • Create Non-CDB on Oracle 12c using DBCA (GUI)
        • How to Change MAX_STRING_SIZE on Physical Standby Environment
        • How to change SQLΒ  prompt to show connected user and database name
        • Enable Archivelog
        • Change Archive Dest
        • How to Recover Loss of DATA – (Without a Backup!)
        • Configure OEM DBConsole manually
        • Proxy User
        • Database Link
        • DBMS_SCHEDULER
        • Enable/Disable JOBS during Maintenance
        • ORA-00054
        • Blocking Sessions
        • Create Service using DBMS_SERVICE
        • Error TNS-12543
      • Backup & Recovery
        • How to Recover Loss of DATA – (Without a Backup!)
        • BACKUP ORACLE HOME AND INVENTORY
        • SCHEMA REFRESH FROM 11G TO 12C PDB
        • RMAN-CATALOG
        • RMAN Database Restore RAC – RAC
        • RMAN Database Restore ASM – ASM
        • RMAN Database Restore from ASM to File System
        • RMAN ACTIVE DUPLICATION ASM TO ASM
        • Backup Based RMAN Duplicate Database
      • HA-CONFIGURATION
        • Active Dataguard on Non-ASM
        • Active Dataguard on ASM
        • Convert Physical Standby Database to Snapshot Standby Database
        • Convert Snapshot Standby database to Physical Standby database
        • Configure Cascading Standby Database
        • DG Broker Configuration
        • DG Broker Error – ORA-16714
        • Disable DG Broker
        • 12.2 Active Dataguard in CDB on Non-ASM
        • Create Physical Standby using RMAN Backup Without Duplicate Command
        • Create Physical Standby using RMAN Backup with Duplicate Command
        • 12c DG Broker Configuration
        • Enable Real-Time Apply
        • Refresh Standby Database using RMAN Incremental SCN Backup
        • Resetlogs on Primary where Standby in place
        • Drop SRL
      • HA-SWITCHOVER
        • Switchover Manual No-Broker
        • Switchover with Broker
      • HA-FAILOVER
        • Failover with Broker(No Flashback)
        • Failover with No Broker (No Flashback)
        • Failover with Broker using Flashback
        • Failover with No Broker using Flashback
      • Oracle Tuning Stage 1
        • Statistics
        • Oracle Histograms
        • Export/Import schema statistics
        • CONTROL MANAGEMENT PACK ACCESS
        • Generate Explain Plan
        • SQL Query is really hanged or not
      • Oracle Tuning Stage 2
        • STATSPACK
        • ASH
        • AWR
        • Colored SQL_ID
        • SYSAUX Tablespace
      • Oracle Tuning Stage 3
        • Troubleshooting Long Running Queries popular
        • SQL Tuning Advisor
        • How to Install SQLT
        • How to Run SQLT
        • How to Create Custom SQL Profile
        • Uninstall SQLT
        • Tracing
        • TRCA – Trace Analyzer
      • FF Analysis - Internal Only
        • Fire-Fighting Analysis (Ongoing / Live Issues)
          • Explain Plan Analysis
          • Top SQL Analysis
          • 10046 Trace Analysis
          • 10053 Trace Analysis
        • Forensic Analysis (RCA – Completed Issues)
    • ExaData
      • Overview
      • Compute Node
      • Cell Node
      • Network
      • Create Oracle Exadata ASM Disk
      • Replacement Runbook
      • CellCLI Commands
    • RAC
      • ASM
        • Configure UDEV Rules for Oracle ASM
        • Configure ASMLib for Oracle ASM
        • Move ASM Spfile to diff. DiskGroup
        • ASM Commands
        • Instantiating disk: failed
        • CSSD won’t start automatically
        • Create ACFS File System on RAC
      • RAC Install
        • Create users, groups and Paths for Oracle RAC
        • RAC Install 11.2.0.3
        • Upgrade GI to 11.2.0.4
        • Downgrade GI to 11.2.0.3
        • root.sh failed with ORA-29783 on RAC
        • Delete Node
        • Add Node
        • Delete Node without remove software
        • Add Node Back which was DELETED without remove software
      • RAC Admin
        • How to take OCR backup on 11.2.0.4
        • Cluster Name
        • Move/Relocate OCR
        • Restore loss of all VOTE disk
        • Cluster Startup issues
        • Add SCAN
      • RAC Tools
        • CLUVFY
        • OSWatcher
      • RAC Standby 12.2
    • GG
      • GG Install
        • GoldenGate Installation
        • GoldenGate 12C Installation
        • Install Oracle GoldenGate 19C for Database 12C
        • Install Oracle GoldenGate 19C for Database 19C
      • Replication & Migration
        • Unidirectional DML Replication
        • Zero Downtime Migration
        • DDL Replication
        • Integrated Capture
        • Oracle GoldenGate Heterogeneous Replication
        • Credential Store
        • ADD NEW TABLE TO AN EXISTING GOLDENGATE CONFIGURATION
    • OEM
      • Install OEM 13.2
      • Install OEM 13.3
      • Add Targets Manually
      • Upgrade OMSPatcher
      • Apply Patch on OMS 13.1
      • Apply Patch on Agent 13.1
    • PostgreSQLNew
      • PostgreSQL DBA Quiz
        • PostgreSQL DBA Training Quiz
      • Installation
        • PostgreSQL DBA Lab: Build the VM with Vagrant, Add Disks and Create LVM
        • PostgreSQL Versions & Features
        • Create PostgreSQL 17 using Docker CLI
        • Install PostgreSQL 13 Using Source Code (Offline Method)
        • Install PostgreSQL 15 using yum Repository on Linux
        • Install PostgreSQL 17 on Linux Using Yum Repository
        • Install PostgreSQL 17.4 from Source code (Offline Method)
        • Install PostgreSQL 17.6 using RPM Packages (Offline Method)
        • Install PostgreSQL 17 client (dnf Method)
        • Uninstall PostgreSQL 17(RPM Method)
        • Uninstall PostgreSQL 17(Source Method)
        • Uninstall PostgreSQL 17 client (dnf Method)
        • How to Set cluster_name in PostgreSQL
        • Create a Second PostgreSQL Instance on the Same Linux Server
        • How to START/STOP PostgreSQL on Linux
        • Types of Shutdown in PostgreSQL
      • Database, User & Security
        • Create Database in PostgreSQL v1.0
        • Databases in PostgreSQL v2.0
        • PostgreSQL User Management - version 1.0
        • PostgreSQL User & Role Management - version 2.0
        • PostgreSQL Configuration File(postgresql.conf & auto.conf)
        • Host-Based Authentication in PostgreSQL (pg_hba conf)
        • Host-Based Authentication in PostgreSQL v2.0
        • Identity Mapping in PostgreSQL (pg_ident.conf)
        • PostgreSQL Password File .pgpass
        • Enable SSL in PostgreSQL
        • PostgreSQL Metadata Views
        • PostgreSQL Tablespace Internals
      • Architecture
        • PostgreSQL Architecture
        • initdb – PostgreSQL Cluster Initialization
        • How SELECT, INSERT, UPDATE, and DELETE Work Internally in PostgreSQL
        • How COMMIT Process work Internally in PostgreSQL
        • How ABORT/ROLLBACK Works in PostgreSQL
        • How a Checkpoint Works in PostgreSQL
        • How PostgreSQL Replay Uncommitted Data During Crash Recovery
        • WAL Files
        • Are Uncommitted Transactions Also Written to WAL?
        • Physical Database Directory Layout on Disk
        • PostgreSQL Tablespace
        • PostgreSQL vs Oracle Terminology
      • Backup & Recovery
        • Enable Archive Mode
        • Disable ARCHIVELOG
        • Backup & Restore using PostgreSQL COPY
        • Database Backup and Recovery Using pg_dump in PostgreSQL
        • Schema Backup and Recovery Using pg_dump in PostgreSQL
        • Table Backup and Recovery Using pg_dump in PostgreSQL
        • Logical - pg_dump and pg_restore (Backup & Restore)
        • Logical - pg_dumpall (Backup & Restore)
        • Physical - pg_basebackup (Backup and Restore)
        • Backup & Restore to Another Host (No Archive Mode)
        • Backup & Restore on Same Host
        • Restore PostgreSQL to New Host using pg_basebackup + WAL Archives
        • PostgreSQL PITR – Point in Time Recovery
      • High Availability
        • Streaming Replication
        • Manual Failover - Streaming Replication
        • Synchronous Replication
        • Rejoining an Old Primary as a New Standby After Failover with pg_rewind and Replication Slots
      • Interview QuestionsNew
        • PostgreSQL Interview Questions - v2.0
      • Replication Manager
        • PostgreSQL HA Setup with REPMGR + Automatic Failover
      • Patroni HA (Internal Only)
        • etcd Cluster Setup
        • Patroni and Postgres
        • Haproxy (Load Balancer)
        • Keepalived VIP
      • Migrations (Internal Only)
        • Oracle to PostgreSQL via ora2pg (Internal Only)
      • EDB Postgres
        • Install EDB Postgres Advanced Server 17 on Linux 8
      • PostgreSQL Maintenance
        • PostgreSQL Shortcut Commands
        • Change Data Directory Path ($PGDATA) in PostgreSQL
        • Change WAL Directory Path (pg_wal) in PostgreSQL
        • PostgreSQL Partitioning Basics
        • MVCC in PostgreSQL
        • VACUUM in PostgreSQL
        • ANALYZE in PostgreSQL
        • Free Space Map (FSM) in PostgreSQL
        • Visibility Map (VM) in PostgreSQL
      • PostgreSQL Troubleshooting (Internal Only)
      • PostgreSQL DBA Script Library (Internal Only)
      • DBA ScriptsNew
    • SQL Server
      • Installation
        • SQL Server Basics
        • Install Microsoft SQL Server Express 2014
        • Install Only SQL Server Management Studio
        • Create Database using GUI
        • Enable TCP/IP Connection
        • Allow Remote Connection
      • Security & User
        • Authentication Method
        • Create a new domain user account in Windows
        • Create Windows Authentication Login
        • Create SQL Server Authenticated Login in SQL Server
        • Create Windows Group Authentication Login in SQL Server
      • Backup & Recovery
        • SQL Server – Recovery Models
        • Database Backup-FULL-DIFFERENTIAL-TLOG
        • Restore Database without Tail-log Backup
        • Restore Database with Tail-log Backup
      • High Availability
        • Log Shipping (SQL Server 2022)
        • Windows Server 2022 Failover Cluster
        • Setup 4 Node Always On Availability Group
        • Who is NT AUTHORITY\SYSTEM?
        • Add Database to Existing AG using Backup and Restore
        • Manual Failover (Planned)
        • Automatic Failover (Unplanned)
    • MySQL
      • Install MySQL 8 on Linux 7
      • Create a MySQL Database
      • User Management
      • Grant Privileges in MySQL
      • Create Roles in MySQL
      • Backup MySQL Using mysqldump
      • Restore a MySQL Database
      • Restore a Single Table in MySQL
      • Restore a Single Database from..
      • Master-Slave Replication
    • DB2
      • Install DB2 V10.5 using GUI
      • DB2 STOP and START
      • DB2 Troubleshooting Guide
    • DevOps
      • Install Git on Linux
      • How to Install Jenkins on Linux
      • Install Docker on Linux
      • Docker Cheat Sheet
    • MongoDB (Internal Only)
      • MongoDB 7.0 Install - Tarball
      • How to Connect to MongoDB
      • MongoDB: Create DB
      • MongoDB: DML Operations
      • MongoDB: DDL Operations
      • MongoDB: Object Types
      • MongoDB: User Management
      • MongoDB: How SELECT Works
      • MongoDB: How INSERT Works
      • MongoDB: How UPDATE Works
      • MongoDB: How DELETE Works
      • MongoDB: How COMMIT Works
      • MongoDB: How Rollback Works
      • MongoDB: Checkpoints
      • MongoDB: Storage Management
      • MongoDB: How Crash Recovery Works
      • MongoDB: Logical Backup and Restore
      • MongoDB: Replica Set Config
      • MongoDB: Replica Set – Planned Shutdown and Startup
      • MongoDB: Replica Set – Rolling Restart
      • MongoDB: Replica Set – Maintenance on Only the Primary
      • MongoDB: Replica Set – Switchover
      • MongoDB: Replica Set – Failover(Only Primary Fails)
      • MongoDB: Replica Set Failover (Only Primary Survives)
      • MongoDB: Replica Set – Data center 1 goes down
  • About
  • Contact Us

Skip to content
  • Services
  • Training
  • Knowledge Base
    • Oracle
      • DBA Monitor
        • DBA Sheet v7.0 popular
        • OS-DB-Commands
        • Database-Scripts
        • Generate INSERT statements from the SELECT query
        • Generate INSERT statements to a flat file using a PL/SQL query
      • DB-Install
        • Install Oracle AI Database 26ai
        • Install 19c GUI
        • Install 19c in silent mode
        • Install 18c
        • Install 12.2 Database Binaries in silent mode
        • Install Oracle Software in silent mode 11gR2
        • Install 10g
        • Deinstall Oracle 11gR2 Database binaries
        • Deinstall Oracle 18c Database Binaries
        • Oracle 19c Deinstall
        • Uninstall Oracle Client on Windows
      • DB-Upgrade
        • Upgrade DB using DBUA from 11.2.0.4 to 12.2.0.1
        • Upgrade DB Manually 11.2.0.4 to 12.2.0.1
        • Upgrade Oracle Database from 12.2.0.1 to 19c using DBUA
        • Upgrade Oracle Database Manually from 12.2.0.1 to 19c
        • Rolling Upgrade With an Existing Physical Standby Database
        • Upgrade TIMEZONE Version
        • Upgrade Database to 12.2 with Physical Standby
      • Patching
        • Patch Terminology
        • Apply Patch RU on Database 19c
        • 18c DB Patching
        • 18c DB Patching - Youtube
        • Apply RU on DATABASE 12.2 (CDB/PDB)
        • ROLLBACK RU from DATABASE 12.2
        • Apply DB PSU on Standby
      • CDB
        • CREATE NEW PDB BY CLONING AN EXISTING PDB
        • CREATE PDB USING DBCA
        • CREATE PDB USING SEED
        • DROP PDB MANUALLY
        • STARTUP/SHUTDOWN CDB AND PDB
        • Convert Non-CDB to PDB with DBMS_PDB
        • SCHEMA REFRESH FROM 11G TO 12C PDB
      • Non-CDB
        • Store DB credentials in Oracle Wallet
        • Create database -DBCA silent mode
        • Drop Database
        • Delete database -DBCA silent mode
        • DBT-06103 The port (1,522) is already used - DBCA
        • Create DB 19C – DBCA-GUI
        • Create DB 19C – DBCA-SILENT
        • CREATE NON-CDB ON ORACLE 12C IN SILENT MODE
        • Configure OEM Express 12c
        • Create Non-CDB on Oracle 12c using DBCA (GUI)
        • How to Change MAX_STRING_SIZE on Physical Standby Environment
        • How to change SQLΒ  prompt to show connected user and database name
        • Enable Archivelog
        • Change Archive Dest
        • How to Recover Loss of DATA – (Without a Backup!)
        • Configure OEM DBConsole manually
        • Proxy User
        • Database Link
        • DBMS_SCHEDULER
        • Enable/Disable JOBS during Maintenance
        • ORA-00054
        • Blocking Sessions
        • Create Service using DBMS_SERVICE
        • Error TNS-12543
      • Backup & Recovery
        • How to Recover Loss of DATA – (Without a Backup!)
        • BACKUP ORACLE HOME AND INVENTORY
        • SCHEMA REFRESH FROM 11G TO 12C PDB
        • RMAN-CATALOG
        • RMAN Database Restore RAC – RAC
        • RMAN Database Restore ASM – ASM
        • RMAN Database Restore from ASM to File System
        • RMAN ACTIVE DUPLICATION ASM TO ASM
        • Backup Based RMAN Duplicate Database
      • HA-CONFIGURATION
        • Active Dataguard on Non-ASM
        • Active Dataguard on ASM
        • Convert Physical Standby Database to Snapshot Standby Database
        • Convert Snapshot Standby database to Physical Standby database
        • Configure Cascading Standby Database
        • DG Broker Configuration
        • DG Broker Error – ORA-16714
        • Disable DG Broker
        • 12.2 Active Dataguard in CDB on Non-ASM
        • Create Physical Standby using RMAN Backup Without Duplicate Command
        • Create Physical Standby using RMAN Backup with Duplicate Command
        • 12c DG Broker Configuration
        • Enable Real-Time Apply
        • Refresh Standby Database using RMAN Incremental SCN Backup
        • Resetlogs on Primary where Standby in place
        • Drop SRL
      • HA-SWITCHOVER
        • Switchover Manual No-Broker
        • Switchover with Broker
      • HA-FAILOVER
        • Failover with Broker(No Flashback)
        • Failover with No Broker (No Flashback)
        • Failover with Broker using Flashback
        • Failover with No Broker using Flashback
      • Oracle Tuning Stage 1
        • Statistics
        • Oracle Histograms
        • Export/Import schema statistics
        • CONTROL MANAGEMENT PACK ACCESS
        • Generate Explain Plan
        • SQL Query is really hanged or not
      • Oracle Tuning Stage 2
        • STATSPACK
        • ASH
        • AWR
        • Colored SQL_ID
        • SYSAUX Tablespace
      • Oracle Tuning Stage 3
        • Troubleshooting Long Running Queries popular
        • SQL Tuning Advisor
        • How to Install SQLT
        • How to Run SQLT
        • How to Create Custom SQL Profile
        • Uninstall SQLT
        • Tracing
        • TRCA – Trace Analyzer
      • FF Analysis - Internal Only
        • Fire-Fighting Analysis (Ongoing / Live Issues)
          • Explain Plan Analysis
          • Top SQL Analysis
          • 10046 Trace Analysis
          • 10053 Trace Analysis
        • Forensic Analysis (RCA – Completed Issues)
    • ExaData
      • Overview
      • Compute Node
      • Cell Node
      • Network
      • Create Oracle Exadata ASM Disk
      • Replacement Runbook
      • CellCLI Commands
    • RAC
      • ASM
        • Configure UDEV Rules for Oracle ASM
        • Configure ASMLib for Oracle ASM
        • Move ASM Spfile to diff. DiskGroup
        • ASM Commands
        • Instantiating disk: failed
        • CSSD won’t start automatically
        • Create ACFS File System on RAC
      • RAC Install
        • Create users, groups and Paths for Oracle RAC
        • RAC Install 11.2.0.3
        • Upgrade GI to 11.2.0.4
        • Downgrade GI to 11.2.0.3
        • root.sh failed with ORA-29783 on RAC
        • Delete Node
        • Add Node
        • Delete Node without remove software
        • Add Node Back which was DELETED without remove software
      • RAC Admin
        • How to take OCR backup on 11.2.0.4
        • Cluster Name
        • Move/Relocate OCR
        • Restore loss of all VOTE disk
        • Cluster Startup issues
        • Add SCAN
      • RAC Tools
        • CLUVFY
        • OSWatcher
      • RAC Standby 12.2
    • GG
      • GG Install
        • GoldenGate Installation
        • GoldenGate 12C Installation
        • Install Oracle GoldenGate 19C for Database 12C
        • Install Oracle GoldenGate 19C for Database 19C
      • Replication & Migration
        • Unidirectional DML Replication
        • Zero Downtime Migration
        • DDL Replication
        • Integrated Capture
        • Oracle GoldenGate Heterogeneous Replication
        • Credential Store
        • ADD NEW TABLE TO AN EXISTING GOLDENGATE CONFIGURATION
    • OEM
      • Install OEM 13.2
      • Install OEM 13.3
      • Add Targets Manually
      • Upgrade OMSPatcher
      • Apply Patch on OMS 13.1
      • Apply Patch on Agent 13.1
    • PostgreSQLNew
      • PostgreSQL DBA Quiz
        • PostgreSQL DBA Training Quiz
      • Installation
        • PostgreSQL DBA Lab: Build the VM with Vagrant, Add Disks and Create LVM
        • PostgreSQL Versions & Features
        • Create PostgreSQL 17 using Docker CLI
        • Install PostgreSQL 13 Using Source Code (Offline Method)
        • Install PostgreSQL 15 using yum Repository on Linux
        • Install PostgreSQL 17 on Linux Using Yum Repository
        • Install PostgreSQL 17.4 from Source code (Offline Method)
        • Install PostgreSQL 17.6 using RPM Packages (Offline Method)
        • Install PostgreSQL 17 client (dnf Method)
        • Uninstall PostgreSQL 17(RPM Method)
        • Uninstall PostgreSQL 17(Source Method)
        • Uninstall PostgreSQL 17 client (dnf Method)
        • How to Set cluster_name in PostgreSQL
        • Create a Second PostgreSQL Instance on the Same Linux Server
        • How to START/STOP PostgreSQL on Linux
        • Types of Shutdown in PostgreSQL
      • Database, User & Security
        • Create Database in PostgreSQL v1.0
        • Databases in PostgreSQL v2.0
        • PostgreSQL User Management - version 1.0
        • PostgreSQL User & Role Management - version 2.0
        • PostgreSQL Configuration File(postgresql.conf & auto.conf)
        • Host-Based Authentication in PostgreSQL (pg_hba conf)
        • Host-Based Authentication in PostgreSQL v2.0
        • Identity Mapping in PostgreSQL (pg_ident.conf)
        • PostgreSQL Password File .pgpass
        • Enable SSL in PostgreSQL
        • PostgreSQL Metadata Views
        • PostgreSQL Tablespace Internals
      • Architecture
        • PostgreSQL Architecture
        • initdb – PostgreSQL Cluster Initialization
        • How SELECT, INSERT, UPDATE, and DELETE Work Internally in PostgreSQL
        • How COMMIT Process work Internally in PostgreSQL
        • How ABORT/ROLLBACK Works in PostgreSQL
        • How a Checkpoint Works in PostgreSQL
        • How PostgreSQL Replay Uncommitted Data During Crash Recovery
        • WAL Files
        • Are Uncommitted Transactions Also Written to WAL?
        • Physical Database Directory Layout on Disk
        • PostgreSQL Tablespace
        • PostgreSQL vs Oracle Terminology
      • Backup & Recovery
        • Enable Archive Mode
        • Disable ARCHIVELOG
        • Backup & Restore using PostgreSQL COPY
        • Database Backup and Recovery Using pg_dump in PostgreSQL
        • Schema Backup and Recovery Using pg_dump in PostgreSQL
        • Table Backup and Recovery Using pg_dump in PostgreSQL
        • Logical - pg_dump and pg_restore (Backup & Restore)
        • Logical - pg_dumpall (Backup & Restore)
        • Physical - pg_basebackup (Backup and Restore)
        • Backup & Restore to Another Host (No Archive Mode)
        • Backup & Restore on Same Host
        • Restore PostgreSQL to New Host using pg_basebackup + WAL Archives
        • PostgreSQL PITR – Point in Time Recovery
      • High Availability
        • Streaming Replication
        • Manual Failover - Streaming Replication
        • Synchronous Replication
        • Rejoining an Old Primary as a New Standby After Failover with pg_rewind and Replication Slots
      • Interview QuestionsNew
        • PostgreSQL Interview Questions - v2.0
      • Replication Manager
        • PostgreSQL HA Setup with REPMGR + Automatic Failover
      • Patroni HA (Internal Only)
        • etcd Cluster Setup
        • Patroni and Postgres
        • Haproxy (Load Balancer)
        • Keepalived VIP
      • Migrations (Internal Only)
        • Oracle to PostgreSQL via ora2pg (Internal Only)
      • EDB Postgres
        • Install EDB Postgres Advanced Server 17 on Linux 8
      • PostgreSQL Maintenance
        • PostgreSQL Shortcut Commands
        • Change Data Directory Path ($PGDATA) in PostgreSQL
        • Change WAL Directory Path (pg_wal) in PostgreSQL
        • PostgreSQL Partitioning Basics
        • MVCC in PostgreSQL
        • VACUUM in PostgreSQL
        • ANALYZE in PostgreSQL
        • Free Space Map (FSM) in PostgreSQL
        • Visibility Map (VM) in PostgreSQL
      • PostgreSQL Troubleshooting (Internal Only)
      • PostgreSQL DBA Script Library (Internal Only)
      • DBA ScriptsNew
    • SQL Server
      • Installation
        • SQL Server Basics
        • Install Microsoft SQL Server Express 2014
        • Install Only SQL Server Management Studio
        • Create Database using GUI
        • Enable TCP/IP Connection
        • Allow Remote Connection
      • Security & User
        • Authentication Method
        • Create a new domain user account in Windows
        • Create Windows Authentication Login
        • Create SQL Server Authenticated Login in SQL Server
        • Create Windows Group Authentication Login in SQL Server
      • Backup & Recovery
        • SQL Server – Recovery Models
        • Database Backup-FULL-DIFFERENTIAL-TLOG
        • Restore Database without Tail-log Backup
        • Restore Database with Tail-log Backup
      • High Availability
        • Log Shipping (SQL Server 2022)
        • Windows Server 2022 Failover Cluster
        • Setup 4 Node Always On Availability Group
        • Who is NT AUTHORITY\SYSTEM?
        • Add Database to Existing AG using Backup and Restore
        • Manual Failover (Planned)
        • Automatic Failover (Unplanned)
    • MySQL
      • Install MySQL 8 on Linux 7
      • Create a MySQL Database
      • User Management
      • Grant Privileges in MySQL
      • Create Roles in MySQL
      • Backup MySQL Using mysqldump
      • Restore a MySQL Database
      • Restore a Single Table in MySQL
      • Restore a Single Database from..
      • Master-Slave Replication
    • DB2
      • Install DB2 V10.5 using GUI
      • DB2 STOP and START
      • DB2 Troubleshooting Guide
    • DevOps
      • Install Git on Linux
      • How to Install Jenkins on Linux
      • Install Docker on Linux
      • Docker Cheat Sheet
    • MongoDB (Internal Only)
      • MongoDB 7.0 Install - Tarball
      • How to Connect to MongoDB
      • MongoDB: Create DB
      • MongoDB: DML Operations
      • MongoDB: DDL Operations
      • MongoDB: Object Types
      • MongoDB: User Management
      • MongoDB: How SELECT Works
      • MongoDB: How INSERT Works
      • MongoDB: How UPDATE Works
      • MongoDB: How DELETE Works
      • MongoDB: How COMMIT Works
      • MongoDB: How Rollback Works
      • MongoDB: Checkpoints
      • MongoDB: Storage Management
      • MongoDB: How Crash Recovery Works
      • MongoDB: Logical Backup and Restore
      • MongoDB: Replica Set Config
      • MongoDB: Replica Set – Planned Shutdown and Startup
      • MongoDB: Replica Set – Rolling Restart
      • MongoDB: Replica Set – Maintenance on Only the Primary
      • MongoDB: Replica Set – Switchover
      • MongoDB: Replica Set – Failover(Only Primary Fails)
      • MongoDB: Replica Set Failover (Only Primary Survives)
      • MongoDB: Replica Set – Data center 1 goes down
  • About
  • Contact Us

PostgreSQL Password File .pgpass

PostgreSQL .pgpass File for Passwordless Login

Table of Contents


1. What is .pgpass?
2. File Format
3. Configure and Test
4. File Permissions (0600)
5. Example: Wildcards
6. Example: Replication
7. Example: pg_dump with cron
8. Use a Different File (PGPASSFILE)
9. Alternative: Export PGPASSWORD (not part of .pgpass)

1. What is .pgpass?

.pgpass is a plain text file in the home directory of the OS user. When psql, pg_dump, pg_basebackup or any other client needs a password, it reads this file automatically, so you are not prompted.

    • It is a client-side file. Nothing changes on the server.
    • It is used only when the server asks for a password (scram-sha-256 or md5 in pg_hba.conf). It is ignored with trust or peer.
    • Passwords are stored in clear text, so the file must have permission 0600.

2. File Format

One connection per line, five fields separated by colons:

hostname:port:database:username:password
  • Use * in the first four fields to match anything.
  • For replication connections, write replication in the database field.
  • Write a literal : in a password as \: and a backslash as \\.
  • Lines starting with # are comments.

3. Configure and Test

Run as the OS user that runs the client (here postgres):

[postgres@pg01 ~]$ cat > ~/.pgpass << 'EOF'
localhost:5432:postgres:postgres:MyStrongPassw0rd
EOF
[postgres@pg01 ~]$ chmod 600 ~/.pgpass
[postgres@pg01 ~]$ ls -l ~/.pgpass
-rw-------. 1 postgres postgres 49 Nov 12 09:15 /home/postgres/.pgpass

Test with -w (no password prompt). If the login works, .pgpass was used:

[postgres@pg01 ~]$ psql -h localhost -p 5432 -U postgres -d postgres -w -c "select current_user;"
 current_user
--------------
 postgres
(1 row)

4. File Permissions (0600)

If group or others have any access, the file is ignored:

[postgres@pg01 ~]$ chmod 644 ~/.pgpass
[postgres@pg01 ~]$ psql -h localhost -U postgres -d postgres -w
WARNING: password file "/home/postgres/.pgpass" has group or world access; permissions should be u=rw (0600) or less
psql: error: connection to server at "localhost" (::1), port 5432 failed: fe_sendauth: no password supplied

# Fix
[postgres@pg01 ~]$ chmod 600 ~/.pgpass

The file must also be owned by the user who runs the client (chown postgres:postgres ~/.pgpass).

5. Example: Wildcards

The first matching line (top to bottom) is used, so put specific lines first and wildcard lines last.

# specific entry first
pgdb01:5432:salesdb:appuser:AppPass#1
# postgres user on every database of this server
pgdb01:5432:*:postgres:PostgresPass#2
# one read-only user on any host and database
*:5432:*:report_ro:ReadOnlyPass#3

6. Example: Replication

On the standby (pg02), add an entry for the primary with replication as the database:

[postgres@pg02 ~]$ cat > ~/.pgpass << 'EOF'
192.168.2.101:5432:replication:replicator:ReplPass123
EOF
[postgres@pg02 ~]$ chmod 600 ~/.pgpass

# pg_basebackup now needs no password
[postgres@pg02 ~]$ pg_basebackup -h 192.168.2.101 -U replicator -D /pgData/17/data -R -P -w

The standby’s primary_conninfo should not contain password=.... It will use .pgpass instead:

[postgres@pg02 ~]$ grep primary_conninfo /pgData/17/data/postgresql.auto.conf
primary_conninfo = 'user=replicator host=192.168.2.101 port=5432'

7. Example: pg_dump with cron

A cron job has no terminal, so it cannot answer a password prompt. Add a .pgpass line and use -w so the job fails fast if the entry is missing:

[postgres@pg01 ~]$ echo 'localhost:5432:salesdb:backup_user:BackupPass456' >> ~/.pgpass

[postgres@pg01 ~]$ cat > /home/postgres/scripts/backup_salesdb.sh << 'EOF'
#!/bin/bash
/usr/pgsql-17/bin/pg_dump -h localhost -p 5432 -U backup_user -w -Fc salesdb \
  -f /pgBackup/salesdb_$(date +%F).dump
EOF
[postgres@pg01 ~]$ chmod 750 /home/postgres/scripts/backup_salesdb.sh

[postgres@pg01 ~]$ crontab -e
0 2 * * * /home/postgres/scripts/backup_salesdb.sh >> /pgLog/backup_salesdb.log 2>&1

Cron must run as the OS user that owns .pgpass.

8. Use a Different File (PGPASSFILE)

# environment variable
[postgres@pg01 ~]$ export PGPASSFILE=/pgBackup/.pgpass_backup
[postgres@pg01 ~]$ chmod 600 $PGPASSFILE

To make it permanent, add the line to ~/.bash_profile with the export keyword. Without export, psql cannot see the variable and still asks for a password:

# ~/.bash_profile
export PGPASSFILE=/pgBackup/.pgpass_backup

[postgres@pg01 ~]$ . ~/.bash_profile
[postgres@pg01 ~]$ env | grep PGPASSFILE
PGPASSFILE=/pgBackup/.pgpass_backup

9. Alternative: Export PGPASSWORD

This is not .pgpass, but it also avoids the password prompt. Export the password in your session, then run the command:

[postgres@pg01 ~]$ export PGPASSWORD='MyStrongPassw0rd'
[postgres@pg01 ~]$ psql -h localhost -p 5432 -U postgres -d postgres -c "select current_user;"
 current_user
--------------
 postgres
(1 row)

# remove it when finished
[postgres@pg01 ~]$ unset PGPASSWORD

For a single command only, set it in front of the command (it is not kept in your session):

[postgres@pg01 ~]$ PGPASSWORD='MyStrongPassw0rd' psql -h localhost -U postgres -d postgres -c "select now();"
  • PGPASSWORD is checked before .pgpass. If it is set, .pgpass is not used.
  • The password is visible in your shell history and, on some systems, to other users. Use it only for quick tests and prefer .pgpass for regular use.
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: linkedin.com/in/rajasekhar-amudala
About me - Rajasekhar Amudala*/?>
br8dba.com Free

PostgreSQL DBA Training

Hands-on training for aspiring DBAs

Duration
4 Weeks
Mode
Online
Cost
β‚Ή0 Free

100% free Β· No prior experience needed Β· Limited seats

You're registered! πŸŽ‰

Check your inbox for a confirmation email.
Join the WhatsApp group to stay updated.

Join WhatsApp group