3 Replies Latest reply: Jul 10, 2015 5:05 PM by Tim Erickson RSS

    Automating backup with pg_dump.exe not working.

    Sam Hull


      Using the Backing up a Qlik Sense Site document as a guide, http://help.qlik.com/sense/en-US/online/Subsystems/Server_deployment_and_configuration/Content/Qlik%20Sense/QSSRM_Backup_Restore_Central_Node_Backup.htm, I attempting to create a batch file to automate the site backup so I can schedule it.

       

      I found that it expects a password at the command prompt so my script just hangs.  Tried passing a password using the -W switch as described in the pg_dump.exe --help, and I'm getting error message "'too many command-line arguments"

       

      Command I'm using:

      pg_dump.exe -h localhost -p 4432 -f E:\backup\dump -U USERNAME -W PASSWORD QSR

       

      Using the prescribed command-line from Qlik, pg_dump.exe -h localhost -U USERNAME -W PASSWORD QSR > e:\backup, also produces the same error message.

       

      Tested with first command line based on what pg_dump.exe --help provided.

       

      pg_dump.exe --help gives me:

      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
        -?, --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
        -c, --clean                  clean (drop) database objects before recreating
        -C, --create                 include commands to create database in dump
        -E, --encoding=ENCODING      dump the data in encoding ENCODING
        -n, --schema=SCHEMA          dump the named schema(s) only
        -N, --exclude-schema=SCHEMA  do NOT dump the named schema(s)
        -o, --oids                   include OIDs in dump
        -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=TABLE            dump the named table(s) only
        -T, --exclude-table=TABLE    do NOT dump the named 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
        --exclude-table-data=TABLE   do NOT dump data for the named table(s)
        --inserts                    dump data as INSERT commands, rather than COPY
        --no-security-labels         do not dump security label assignments
        --no-synchronized-snapshots  do not use synchronized snapshots in parallel jobs
        --no-tablespaces             do not dump tablespace assignments
        --no-unlogged-table-data     do not dump unlogged table data
        --quote-all-identifiers      quote all identifiers, even if not key words
        --section=SECTION            dump named section (pre-data, data, or post-data)
        --serializable-deferrable    wait until the dump can run without anomalies
        --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@postgresql.org>.