SQWareProduction:postgres:bin:sqwpg PgBackrestAll.ksh

From Wiki_dbSQWare
Revision as of 16:18, 10 October 2025 by BatchUser (talk | contribs) (Created page with "{{SQWareProductionBinHelp|postgres|Pg|pg|sqwpg_PgBackrestAll.ksh| {{SQWareProduction_sqwpg_PgBackrestAll.ksh_presentation}} | {{SQWareProduction_sqwpg_PgBackrestAll.ksh_help}} | <pre> Lack backup type parameter, Usage: sqwpg_PgBackrestAll.ksh [-h] -I instance [+ options] For full help : sqwpg_PgBackrestAll.ksh -h </pre> | <pre> Not sending mail because you are in connected mode !!! Lack backup type parameter </pre> | {{SQWareProduction_sqwpg_PgBackrestAll.ksh_example}} }}")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Presentation

Script $gvsqw_PgBin/sqwpg_PgBackrestAll.ksh :


Run of sqwpg_PgBackrest.ksh in parallel mode on all clusters
You can choose:

  • The type of backup (full,diff,incr)
  • The parallel degree
  • Aggressiveness of run (number of seconds between two runs)
  • Aggressiveness of check end (number of seconds between two checks of end)



Online help

The online help is available for most scripts with the -h option.
Ex: $gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -h
Content of this assistance :

Sourcing sqwpg_Global.lib v2025.10 SQWareProduction for PostgreSQL (dbSQWare) ... 

Usage: sqwpg_PgBackrestAll.ksh [-h] -I instance [+ options]

DESCRIPTION
   sqwpg_PgBackrestAll.ksh backup all PG clusters with pgbackrest in parallel
SUPPORT
   PostgreSQL supported versions: 9.0 <= v <= 17
    Before using this script, you must install pgbackrest utilities on your system !
    More information on https://pgbackrest.org/

PARAMETERS
     -Type type         : Type of backup (full,diff,incr).
OPTIONS
     -h                 : Display the full usage.
     -s                 : Display samples of usage.
     -P    Nb threads   : Number of threads in parallel (by default 2).
     -AGR Nb_sec        : Nb of seconds between two runs (by default 1s).
     -AGE Nb_sec        : Nb of seconds between two checks of end (by default 10s).
     -FRT       code    : Force return code value on error.
     -BkrMode   mode    : Mode of backup Local or Central (by default, Local)
     -AddMail   email   : Email address to add at 'demo-sqwarebox@dbsqware.com'.
     -ListFile filename : File containing the list of clusters(by default /home/dbsqware/sqwConfig/sqwpg_PgbackrestClusters.lst).
     -SendReport        : Send execution log report.
     -Opt  option       : Additional options for command line
     -NoMail            : Deactivate sendmail on error demo-sqwarebox@dbsqware.com (by default, send on error).
     -Locale    locale  : Force Locale for help display (fr,en).
     -Exec              : Execute commands (by default, display generated commands).

Note:
To be sure the aid is accurate, refer directly to the online help script -h option.


Error management

Errors passing arguments

This type of message is generated:

Lack backup type parameter, Usage: sqwpg_PgBackrestAll.ksh [-h]  -I instance [+ options]
For full help : sqwpg_PgBackrestAll.ksh -h

If you are connecting through a terminal, no mail will be sent and you will have more this kind of message:

Not sending mail because you are in connected mode !!!
Lack backup type parameter

If you are not connected to a terminal, the error message appears and is sent by mail to the address contained in the variable $gvsqw_GlobalMail (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_postgres : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Execution errors

Whether you are or not connected to a terminal, the error message appears and an email containing a summary of treatment errors is sent to the address contained in the variable $gvsqw_Mail_postgres (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_postgres : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Usage examples

Sourcing sqwpg_Global.lib v2025.10 SQWareProduction for PostgreSQL (dbSQWare) ... 

#Standard help for script sqwpg_PgBackrestAll.ksh:


$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -h
#Display online help for this script

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -Locale en -h
#Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale)

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -s
#Display usage examples for this script

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full
#Display generated commands without execute them !

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -Exec
#Execute the script sqwpg_PgBackrest.ksh to analyze tables of all clusters in parallel

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -Dist -Exec
#Analyze all tables for all the databases of the non-local instance $PG_SID with distant connection
#You need to register credentials to use for distant connection to the instance (user and so on) in file $gvsqw_DistPasswdFile

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -P <Nb threads> -Exec
#Execute generated commands with several threads in parallel

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -Opt <Option> -Exec
#Execute the script with option <Option>

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -AGR 20 -Exec
#Set the waiting time in seconds between two command run, 20s here

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -AGE 30 -Exec
#Set the waiting time in seconds between two end checks, 30s here

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec
#Add the mail list to the default address managed by $gvsqw_GlobalMail

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -SendReport -Exec
#Send the log by email at the end of the treatment even if there is no error

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -NoMail -Exec
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error)

$gvsqw_PgBin/sqwpg_PgBackrestAll.ksh -T full -FRT <NumericValue> -Exec
#Force return code to <NumericValue> on error (if no error, exit 0!)
#You can also force return code of this script on all your
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwpg_PgBackrestAll=<NumericValue>
#in configuration file $gvsqw_PgBin/../etc_cust/sqwpg_GlobalVar.cfg

Note:
To be sure the examples are accurate, refer directly to the online help script -s option.