Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

...

  • Kotva
    trezorreadsegment0pg
    trezorreadsegment0pg
    TrezorReadSegment0
    - Parameter has a meaning only if depository segments are configured (non-zero value of TrezorCountSegments parameter). Activation of a parameter (value 1) instructs the archive to read also from depository segment 0 when reading from any other depository segment. Reading from depository databases will be slower, but it enables reconfiguring historical values from default depository segment 0 to a different segment while keeping access to data previously stored in depository segment 0.
    The TrezorReadSegment0 parameter can be changed by the SET_OPTION TELL command.
  • Kotva
    trezorreadsincecreatepg
    trezorreadsincecreatepg
    TrezorReadSinceCreate - value 1 means that depositories that are older than Create Time of historical value will not be read. The TrezorReadSinceCreate parameter can be changed by the SET_OPTION TELL command.
  • Kotva
    trezorcompressofflinepg
    trezorcompressofflinepg
    TrezorCompressOffline - value 1 (default) means that the compressed depository database will be put into offline mode. Value 0 means that the depository database remains in read-only mode and data will be available for reading. Value 2 means that D2000 Archiv will not access the depository database while TrezorPostCompressCmd is running, so this command may perform various maintenance tasks that could otherwise block the archive.
  • Kotva
    trezorcompresstimepg
    trezorcompresstimepg
    TrezorCompressTime - time for releasing the depository database. The database is available for writing delayed data during this period. TrezorCompressTime must be less than TrezorPeriod.
  • Kotva
    trezorcountsegmentspg
    trezorcountsegmentspg
    TrezorCountSegments - number of depository database segments (depository databases), that are being created in parallel. The default value is 0 (only segment 0 is being created), and the maximum value is 99 (segments 0 to 99 are being created). The parameter is of DWORD type !!!.
  • Kotva
    trezorpostcompresscmdpg
    trezorpostcompresscmdpg
    TrezorPostCompressCmd - the name of a program to be run after releasing the depository database. This program can for example move and compress a disconnected depository database or create a dump of read-only depository database via the PostgreSQL utility pg_dump.
    Note: before running the command, the environment variables D2000_DBUSER and D2000_DBPASS are set to the name and password that D2000 Archive uses to access the archive database. These variables can be used in a script to connect to the archive database.
  • Kotva
    trezorpostcompressparpg
    trezorpostcompressparpg
    TrezorPostCompressPar - optional parameter, used for the program specified by the parameter TrezorPostCompressCmd. It can contain optional text and predefined macros to be replaced before running the program:
    • #ID# - is replaced by depository database ID (e.g. 5).
    • #OID# - is replaced by OID (object identifier) of the depository database (OID is related to the name of the directory containing the respective database inside PostgreSQL tablespace).
    • #OID0#, #OID1#, #OID2#, etc - is replaced by OIDs (object identifiers) of databases representing respective depository database segments 0, 1, 2, etc.
    • #TREZOR# - is replaced by the depository database name (e.g. Test_TREZOR_5).
    • #TREZOR0#, #TREZOR1#, #TREZOR2#, etc - is replaced by the database name representing the respective depository database segments.

    An example of a batch file used to perform a depository database maintenance and export as well as the export of trezors table located in the archive database MyApp.Archiv. The batch file requires as a parameter the name of the depository database, which can be provided by setting the TrezorPostCompressPar parameter to value #TREZOR#.

    rem Target directory for exports
    set MyDir=D:\Trezors_export\
    rem Set PGPASSWORD to password assigned to D2000 user
    set PGPASSWORD=%D2000_DBPASS%
    set PGUSER=%D2000_DBUSER%
    rem Set PATH to PostgreSQL installation (version-dependent)
    set PATH=%PATH%;c:\Program Files\PostgreSQL\13\bin
    rem export of table trezors from the archive database
    pg_dump -Fc -U %D2000_DBUSER% -f "%MyDir%\MyApp_arc_trezors.dmp" --table \"trezors\" MyApp.Archiv >> %MyDir%\%1.log
    rem permit write access to depository database and cluster the data table
    echo alter database "%1" set default_transaction_read_only=false | psql -S -U %D2000_DBUSER% MyApp.Archiv >> %MyDir%\%1.log
    echo alter table data cluster on ix_data_rc | psql -S -U %D2000_DBUSER% %1 >> %MyDir%\%1.log
    echo cluster data | psql -S -U %D2000_DBUSER% %1 >> %MyDir%\%1.log
    rem set access to depository database back to read only
    echo alter database "%1" set default_transaction_read_only=true | psql -S -U %D2000_DBUSER% MyApp.Archiv >> %MyDir%\%1.log
    pg_dump -Fc -U %D2000_DBUSER% -f "%MyDir%\%1.dmp" %1 >> %MyDir%\%1.log

    Example of an equivalent batch file for Linux:

    #!/usr/bin/env bash
    MyDir=/trezorbackup
    MyArc=mes_tpd_archive_self
    MyLog=$MyDir/$1.log

    #path to pg_dump, psql etc
    PATH=/usr/pgsql-11/bin:$PATH

    #password for dba user
    export PGPASSWORD=$D2000_DBPASS
    export PGUSER=$D2000_DBUSER

    #export of table trezors from the archive database
    pg_dump -Fc -U $D2000_DBUSER -f "$MyDir/arc_trezors.dmp" --table \"trezors\" $MyArc >> $MyLog

    #permit write access to depository database and cluster the data table
    echo alter database \"$1\" set default_transaction_read_only=false | psql -S -U $D2000_DBUSER $MyArc >> $MyLog
    echo alter table data cluster on ix_data_rc | psql -S -U $D2000_DBUSER "$1" >> $MyLog
    echo cluster data | psql -S -U $D2000_DBUSER "$1" >> $MyLog

    #set access to depository database back to read only
    echo alter database \"$1\" set default_transaction_read_only=true | psql -S -U $D2000_DBUSER $MyArc >> $MyLog
    #execute dump of depository database
    pg_dump -Fc -U $D2000_DBUSER -f "$MyDir/$1.dmp" "$1" >> $MyLog