-
Notifications
You must be signed in to change notification settings - Fork 0
About PgTools
BABA Motoharu edited this page Aug 14, 2021
·
5 revisions
[日本語]
PgTool is management tools for PostgreSQL on Windows, requires .NET Framework 4.6.1 or later.
Commandline arguments are similar to psql / pg_dump.
DB2Src.NET is database browser for PostgreSQL. English version is not ready. (I want someone to help me with the translation.)
ExpSch and ExpTbl exports database as text files for managing with version control system. (ex: git, subversion)
You can omit password by using "pgpass.conf".
ExpSch exports schema definition files per object.
Usage: ExpSch [OPTIONS]... [Directory] General options: -?, --help show this help, then exit Options controlling the output content: -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) --no-tablespaces do not dump tablespace assignments 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
ExpTbl exports tables data to files per table. Files are exported as COPY.
This tool is mainly designed for comparing two databases (like "Production system" and "Test system"), so has following functions not included in pg_dump.
- Excludes specified columns (ex: timestamp columns).
- Set dummy value to specified columns.
Usage: ExpTbl exp [OPTIONS]... [Directory] ExpTbl genconf [OPTIONS]... [CONFIGFILE] ExpTbl genrule [OPTIONS]... [RULEFILE] exp テーブルのデータをファイルに出力します genconf ファイルの出力を制御する設定ファイルを生成します CONFIGFILE を省略すると "ExpTBl.cfg" に書き出します genrule genconf で使用するルールファイルのテンプレートを生成します RULEFILE を省略すると "ExpTBlRule.cfg" に書き出します 一般的なオプション: -?, --help このヘルプを表示し、終了します 出力内容を制御するためのオプション: -E, --encoding=ENCODING ENCODING符号化方式でデータをダンプ(規定値:UTF-8) -n, --schema=SCHEMA 指名したスキーマのみをダンプ -N, --exclude-schema=SCHEMA 指名されたスキーマをダンプしません -c --cofig=CONFIGFILE CONFIGFILEを指定します。指定しない場合 "ExpTbl.cfg" になります -r --rule=RULEFILE RULEFILEを指定します。指定しない場合 "ExpTblRule.cfg" になります 接続オプション -d, --dbname=データベース名 ダンプするデータベース -h, --host=HOSTNAME データベースサーバのホストまたはソケットディレクトリです -p, --port=PORT データベースサーバのポート番号です -U, --username=NAME 指定したデータベースユーザで接続します
使用手順
cd <作業フォルダ> ExpTbl genrule -h localhost -p 5432 -d postgres -U postgres ExpTbl genconf -h localhost -p 5432 -d postgres -U postgres ExpTbl exp -h localhost -p 5432 -d postgres -U postgres
-
ExpTbl genrule で ExpTblRule.cfg を作成
ExpTblRule.cfgのテンプレートを作成します。作成後、用途に合わせて内容を修正してください。 -
ExpTbl genconf で ExpTblRul.ecfg から ExpTbl.cfg を作成
ExpTbl.cfg にはデータを出力するテーブルの一覧と、各テーブルの設定が記述されています。テーブル毎に出力を調整したい場合はこのファイルを編集してください。 -
ExpTbl exp でデータ出力
ExpTbl.cfg の設定をもとにデータを出力します。