Skip to main content

Welcome to DBA Master – Database Tips, Tricks, and Tutorials

Welcome to DBA Master ! This blog is dedicated to all things related to database administration , SQL optimization , and performance tuning . Whether you're a beginner or a seasoned DBA, you'll find practical guides, troubleshooting tips, and real-world tutorials to help you work smarter with data. What to Expect: SQL performance tuning tips Indexing strategies Backup and recovery best practices High availability and replication techniques Database creation, configuration, and setup Monitoring queries and scripts for proactive performance management Migration guides across different database platforms Security essentials and best practices Recommended tools for DBAs Real-world error fixes and how to solve them Stay tuned — exciting content is coming soon. Feel free to bookmark and share: www.dbamaster.com ! Thanks for visiting!

PostgreSQL Barman configuration and commands

step 1:   Download 2ndquadrant repo file:

         goto http://docs.pgbarman.org/release/2.10/#installation-on-redhatcentos-using-rpm-packages
        click 2ndQuadrant Public RPM repository on https://dl.2ndquadrant.com/default/release/site/
        and choose version copy repo link and paste for linux os on root user

step 2:   barman server: /et/yum.repo.d/

        must pgdg repo file, epel repo file and 2ndQuadrant repo file
        open pgdg repo file and add the line for end of version link ---> exclude=barman*
        example:        [pgdg11]
                        name=PostgreSQL 11 for RHEL/CentOS $releasever - $basearch
                        baseurl=http://download.postgresql.org/pub/repos/yum/11/redhat/rhel-$releasever-$basearch
                        enabled=1
                        gpgcheck=1
                        gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG
                        exclude=barman*

step 3:  barman server : 

   yum install barman (root user)
 
   /usr/bin/barman  (bin path)
   /etc/barman.conf (barman configuration file)
   /et/barman.d/  (server configuration path)

step 4: barman server:(make ssh for both machine)

  ssh-keygen
        cd .ssh
        ssh-copy-id postgres@192.168.1.21
  postgres server:
       su - postgres
       ssh-keygen
       cd .ssh
       cat id_rsa.pub >> autorized_keys
       scp authorized_keys barman@192.168.1.21:/var/lib/barman/.ssh/  

step 5:  PostgreSQL server:  (make base backup settings)

            su - postgres
                cd /usr/pgsql-11/bin/
  
                ./createuser -s -P barman
                ./createuser -P --replication streaming_barman
  
            vi pg_hba.conf
                ipv4:
                    host    postgres    barman  192.168.1.22/32        trust
                replication:
                    host    replication        streaming_barman    192.168.1.22/32        trust
   
   vi postgresql.conf
   listern_address=*
   archive_mode=on
   archive_command='cp %p /arch/%f'
   wal_level=replica
   full_page_writes=on
   max_wal_sender=6
   wal_keep_segement=500
   max_replication_slot=2
   log_statement='all'
 
        restart the server

step 6:  barman server:(create .pgpass file)

        su - barman(var/lib/barman/)
        touch .pgpass
        chmod 600 .pgpass
        vi .pgpass
             192.168.1.21:*:*:barman:password
             192.168.1.21:*:*:streaming_barman:password

step 7:   edit barman configuration file:

        vi /etc/barman.conf        ---> remove the line(;)
            barman_user = barman
            barman_home = /var/lib/barman/backup
            minimum_redundancy = 1
            retention_policy = REDUNDANCY 2
            :wq

step 8:  barman server:(server configuration file create pg1.conf)

            vi /etc/barman.d/pg1.conf
                [pg1]
                description = "db server 1"
                ssh_command = ssh postgres@192.168.1.21
                conninfo = host=192.168.1.162 user=barman dbname=postgres port=5432
                streaming_conninfo = host=192.168.1.21 user=streaming_barman port=5432
                streaming_archiver = on
                slot_name = barman
                archiver = on
                backup_method = rsync
                backup_options = concurrent_backup
                parallel_jobs = 4
                reuse_backup = link
                streaming_archiver_name = barman_receive_wal
                path_prefix = "/usr/pgsql-11/bin"
            chown -R barman:barman pg1.conf

step 9: Run barman tool      

 su - barman

barman list-server
barman check pg1
            ----------------->barman receive-wal --create-slot pg1

 vi postgresql.conf
 set archive_command = 'cp %p /arch11/%f && rsync -a %p barman@192.168.1.162:/var/lib/barman/backup/pg1/incoming/%f'
            how to find barman xlogfilepath--> barman show-server pg1 | grep incoming_wals_directory
            
check backup server:               
           barman check pg1
backup server:
           barman backup pg1
backup list:
        barman list-backup pg1
backup Details:
barman show-backup pg1 backup_id
Restore command:
barman recover --remote-ssh-command "ssh postgres@192.168.1.162" pg1 20200206T151256 /var/lib/pgsql/11/tada
Point-in-time-Recovery command:
barman recover --remote-ssh-command "ssh postgres@192.168.1.162" pg1 20200206T151256 --target-time "2020-02-06 15:34:24.842" /var/lib/pgsql/11/tada
Incremental Backup:(only last full backup)
barman backup --reuse-backup=link pg1

Comments

Popular posts from this blog

Oracle Database 19C Performance Tunning - PART 1

Advantages: 1. Improved Query Performance •    Optimized SQL execution plans lead to faster query response times. •    Reduces unnecessary full table scans and improves indexing strategies. •    Parallel execution tuning speeds up large data processing tasks. 2. Better Resource Utilization •    Efficient use of CPU, memory, disk I/O, and network resources. •    Reduces contention on Redo Logs, Undo Tablespaces, and Buffer Cache. •    Helps in load balancing across multiple instances in RAC (Real Application Clusters). 3. Increased System Scalability •    Ensures that the database can handle a growing number of users and transactions. •    Proper tuning allows scaling without degrading performance. •    Optimized parallel processing ensures better performance on multi-core servers. 4. Lower Infrastructure Costs •    Reduces the need for add...

Oracle RMAN Backup And Restore

RMAN: (Oracle 8) RMAN (Recovery Manager) is a utility provided by Oracle Database to perform backup, restore, and recovery operations. It is a command line tool. Features of RMAN in Oracle 19c Comprehensive Backup Capabilities: Full and incremental backups. Block-level backups for efficient data storage. Archived redo log backups. Fast Recovery Area (FRA) integration for centralized backup storage. Efficient Recovery Options: Point-in-time recovery (PITR). Complete and incomplete recovery. Flashback database capabilities for quick undo of changes. Multitenant Database Support: RMAN fully supports container databases (CDBs) and pluggable databases (PDBs). Provides flexibility to back up and recover individual PDBs or entire CDBs. Automatic Space Management: Manages disk space in the FRA. Automatically deletes obsolete backups and archived logs. Data Deduplication and Compression: Backup optimization through block-level deduplication. Built-in compression algorithms to reduce storage req...

Oracle 19c Database Software Installation in OEL8

 Pre-requisites for OS level:            Set the static IP Address     Disable the Firewall (systemctl stop firewalld & systemctl disable firewalld)     set SELINUX=permissive on /etc/selinux/config  ##Need to restart the server use init 6 Oracle Installation Pre-requisites Methods     Automatic Setup     Manual Setup      Automatic requisites Setup: (avoid step 1 to step 5): dnf install -y oracle-database-preinstall-19c Install the dependencies: curl -o oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm dnf -y localinstall oracle-database-preinstall-19c-1.0-2.el8.x86_64.rpm Manual Setup: step 1: Add the karenl parameters and values vi /etc/sysctl.conf     fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel....