{"kind": "tool", "major": "18", "item": {"slug": "pg-restore", "name": "pg_restore", "name_zh": "", "category": "\u5ba2\u6237\u7aef\u7a0b\u5e8f", "summary": "pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93", "aliases": ["pg_restore"], "content_hash": "7979095b97fb6a947af9ace75128b14912e024bf7b14e42c5cb6963a9b7690b5", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "42"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u91cd\u65b0\u521b\u5efa\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\u6e05\u7406\uff08\u5220\u9664\uff09\u5b83\u4eec\u3002\uff08\u9664\u975e\u4f7f\u7528 --if-exists \uff0c\u5426\u5219\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u4e0d\u5b58\u5728\u67d0\u4e9b\u5bf9\u8c61\uff0c\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e00\u4e9b\u65e0\u5bb3\u7684\u9519\u8bef\u6d88\u606f\u3002\uff09", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a\u6807\u51c6\u8f93\u51fa\uff0c\u8fd9\u4e5f\u662f\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u4f7f\u7528\u591a\u4e2a\u5e76\u53d1\u4f5c\u4e1a\u6267\u884c pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4 \u2014 \u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f \u2014\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u6e05\u7406\u6570\u636e\u5e93\u5bf9\u8c61\u65f6\u4f7f\u7528\u6761\u4ef6\u547d\u4ee4\uff08\u5373\u6dfb\u52a0 IF EXISTS \u5b50\u53e5\uff09\u3002\u53ea\u6709\u540c\u65f6\u6307\u5b9a --clean \uff0c\u6b64\u9009\u9879\u624d\u6709\u6548\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/10/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Clean (drop) database objects before recreating them. (Unless --if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.)", "signature": "-c --clean", "source_url": "/docs/10/app-pgrestore.html", "description": "Clean (drop) database objects before recreating them. (Unless --if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.)"}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/10/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/10/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/10/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default.", "signature": "-f filename --file= filename", "source_url": "/docs/10/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/10/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/10/app-pgrestore.html", "description": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe). This option is ignored when emitting a script rather than connecting directly to a database server. Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/10/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/10/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/10/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/10/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode.", "signature": "-v --verbose", "source_url": "/docs/10/app-pgrestore.html", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/10/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/10/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/10/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload.", "signature": "--disable-triggers", "source_url": "/docs/10/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/10/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use conditional commands (i.e., add an IF EXISTS clause) when cleaning database objects. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/10/app-pgrestore.html", "description": "Use conditional commands (i.e., add an IF EXISTS clause) when cleaning database objects. This option is not valid unless --clean is also specified."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/10/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/10/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/10/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/10/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/10/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/10/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/10/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/10/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/10/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/10/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/10/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/10/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=10", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "https://pg.center/docs/10/app-pgrestore.html", "file": "app-pgrestore.html", "label": "10.23 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "8dbe8ce258979a76a4c8b958328215f44b5d86224d2d56b85a98ace4a54619e3", "language": "en", "original_url": "/docs/10/app-pgrestore.html"}, {"url": "https://pg.center/docs/10/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "e4330732b6acd6c025a1fbdce45574b23d964de847a1b849ea88b98ab628d2e2", "language": "en", "original_url": "/docs/10/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_restore</span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.17.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u91cd\u65b0\u521b\u5efa\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\u6e05\u7406\uff08\u5220\u9664\uff09\u5b83\u4eec\u3002\uff08\u9664\u975e\u4f7f\u7528<code class=\"option\">--if-exists</code>\uff0c\u5426\u5219\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u4e0d\u5b58\u5728\u67d0\u4e9b\u5bf9\u8c61\uff0c\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e00\u4e9b\u65e0\u5bb3\u7684\u9519\u8bef\u6d88\u606f\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/10/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e<code class=\"option\">-l</code>\u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528<code class=\"literal\">-</code>\u8868\u793a\u6807\u51c6\u8f93\u51fa\uff0c\u8fd9\u4e5f\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u591a\u4e2a\u5e76\u53d1\u4f5c\u4e1a\u6267\u884c<span class=\"application\">pg_restore</span>\u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4 \u2014 \u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f \u2014\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\uff09\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e<code class=\"option\">--single-transaction</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e<code class=\"option\">-t</code>\u6807\u5fd7\u5728<span class=\"application\">pg_dump</span>\u4e2d\u7684\u884c\u4e3a\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span>\u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176<code class=\"option\">-t</code>\u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/10/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/10/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6e05\u7406\u6570\u636e\u5e93\u5bf9\u8c61\u65f6\u4f7f\u7528\u6761\u4ef6\u547d\u4ee4\uff08\u5373\u6dfb\u52a0<code class=\"literal\">IF EXISTS</code>\u5b50\u53e5\uff09\u3002\u53ea\u6709\u540c\u65f6\u6307\u5b9a<code class=\"option\">--clean</code>\uff0c\u6b64\u9009\u9879\u624d\u6709\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/10/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u610f</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/10/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/10/maintenance.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u5c06\u8f6c\u50a8\u91cd\u65b0\u88c5\u8f7d\u5230\u4e00\u4e2a\u65b0\u6570\u636e\u5e93\u4e2d\uff0c\u5176\u540d\u79f0\u4e3a <code class=\"literal\">newdb</code>\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u6211\u4eec\u6ca1\u6709\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u6700\u521d\u4e3a\u7a7a\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre></div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2>\n<span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>, <a class=\"xref\" href=\"https://pg.center/docs/10/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/10/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span></div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/10/app-pgrestore.html", "method": "same-major semantic node", "sha256": "64609ebb02cbcc0b81bcfa3ee6d2b8850546f07bd7ae0cd59306855e4bbd8dae", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Client applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/tables/1/title": "Environment variables", "/versions/10/related/0/label": "libpq connection parameters", "/versions/10/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/10/tables/0/rows/1/summary": "Clean (drop) database objects before recreating them. (Unless --if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.)", "/versions/10/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/10/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/10/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/10/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default.", "/versions/10/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/10/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/10/tables/0/rows/8/summary": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine.", "/versions/10/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/10/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/10/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/10/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/10/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/10/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/10/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/10/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/10/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/10/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/10/tables/0/rows/20/summary": "Specifies verbose mode.", "/versions/10/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/10/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/10/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/10/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload.", "/versions/10/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/10/tables/0/rows/26/summary": "Use conditional commands (i.e., add an IF EXISTS clause) when cleaning database objects. This option is not valid unless --clean is also specified.", "/versions/10/tables/0/rows/27/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/10/tables/0/rows/28/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/10/tables/0/rows/29/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/10/tables/0/rows/30/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/10/tables/0/rows/31/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/10/tables/0/rows/32/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/10/tables/0/rows/33/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/10/tables/0/rows/34/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/10/tables/0/rows/35/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/10/tables/0/rows/36/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/10/tables/0/rows/37/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/10/tables/0/rows/38/summary": "User name to connect as.", "/versions/10/tables/0/rows/39/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/10/tables/0/rows/40/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/10/tables/0/rows/41/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/10/tables/1/columns/0/label": "Variable", "/versions/10/tables/1/columns/1/label": "Meaning", "/versions/10/tables/1/rows/0/description": "Default connection parameters"}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "2a16ef3a551ba12de3f56ea7d4239f3f65e8003213dbc125dd79b5005dafcc7e"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Clean (drop) database objects before recreating them. (Unless --if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.)"}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe). This option is ignored when emitting a script rather than connecting directly to a database server. Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use conditional commands (i.e., add an IF EXISTS clause) when cleaning database objects. This option is not valid unless --clean is also specified."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}]}, "comparison_hash": "91533b86e2ef1e39a0b8df814a88631e56131b260860fa4bfff047acb242ee7c", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "43"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a\u6807\u51c6\u8f93\u51fa\uff0c\u8fd9\u4e5f\u662f\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u4f7f\u7528\u591a\u4e2a\u5e76\u53d1\u4f5c\u4e1a\u6267\u884c pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4 \u2014 \u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f \u2014\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/11/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/11/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/11/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/11/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/11/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default.", "signature": "-f filename --file= filename", "source_url": "/docs/11/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/11/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/11/app-pgrestore.html", "description": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe). This option is ignored when emitting a script rather than connecting directly to a database server. Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/11/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/11/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/11/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/11/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode.", "signature": "-v --verbose", "source_url": "/docs/11/app-pgrestore.html", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/11/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/11/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/11/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/11/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/11/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/11/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/11/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/11/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/11/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/11/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/11/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/11/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/11/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/11/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/11/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/11/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/11/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/11/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=11", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "https://pg.center/docs/11/app-pgrestore.html", "file": "app-pgrestore.html", "label": "11.22 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "012ddba2d48129bb19cc76e2fee7d78f5a0af2dafacb4c5cf4625860b61793e4", "language": "en", "original_url": "/docs/11/app-pgrestore.html"}, {"url": "https://pg.center/docs/11/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3a30e696058b118a55cc42892c39671d9bae86f77e1024d5ebcc4688ad9ab4c3", "language": "en", "original_url": "/docs/11/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_restore</span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.17.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/11/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e<code class=\"option\">-l</code>\u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528<code class=\"literal\">-</code>\u8868\u793a\u6807\u51c6\u8f93\u51fa\uff0c\u8fd9\u4e5f\u662f\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u591a\u4e2a\u5e76\u53d1\u4f5c\u4e1a\u6267\u884c<span class=\"application\">pg_restore</span>\u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4 \u2014 \u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f \u2014\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\uff09\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e<code class=\"option\">--single-transaction</code>\u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/11/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/11/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/11/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/11/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/11/maintenance.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>, <a class=\"xref\" href=\"https://pg.center/docs/11/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/11/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/11/app-pgrestore.html", "method": "same-major semantic node", "sha256": "8f8beea893242ded038b512d1e90536be675c401efecaab215ea38159bfea072", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Client applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/tables/1/title": "Environment variables", "/versions/11/related/0/label": "libpq connection parameters", "/versions/11/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/11/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/11/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/11/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/11/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/11/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default.", "/versions/11/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/11/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/11/tables/0/rows/8/summary": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine.", "/versions/11/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/11/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/11/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/11/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/11/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/11/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/11/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/11/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/11/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/11/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/11/tables/0/rows/20/summary": "Specifies verbose mode.", "/versions/11/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/11/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/11/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/11/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/11/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/11/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/11/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/11/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/11/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/11/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/11/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/11/tables/0/rows/32/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/11/tables/0/rows/33/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/11/tables/0/rows/34/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/11/tables/0/rows/35/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/11/tables/0/rows/36/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/11/tables/0/rows/37/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/11/tables/0/rows/38/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/11/tables/0/rows/39/summary": "User name to connect as.", "/versions/11/tables/0/rows/40/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/11/tables/0/rows/41/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/11/tables/0/rows/42/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/11/tables/1/columns/0/label": "Variable", "/versions/11/tables/1/columns/1/label": "Meaning", "/versions/11/tables/1/rows/0/description": "Default connection parameters"}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "7bc69f7cbd2e78a2dbb035fee88e91e0e8d9e1f3abc48614ae22563bbbb230f1"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for the standard output, which is also the default."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming parts of pg_restore \u2014 those which load data, create indexes, or create constraints \u2014 using multiple concurrent jobs. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe). This option is ignored when emitting a script rather than connecting directly to a database server. Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}]}, "comparison_hash": "66120ef5a431a7d521bbfa4f2bd1c5f7c0d833a2473a2e957dbb5442d0b22c78", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "43"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/12/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/12/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/12/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/12/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/12/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/12/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/12/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/12/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/12/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/12/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/12/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/12/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode.", "signature": "-v --verbose", "source_url": "/docs/12/app-pgrestore.html", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/12/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/12/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/12/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/12/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/12/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/12/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/12/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/12/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/12/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/12/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/12/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/12/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/12/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/12/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/12/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/12/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/12/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/12/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=12", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "https://pg.center/docs/12/app-pgrestore.html", "file": "app-pgrestore.html", "label": "12.22 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "d08b3c3fcdea998e4f90ff068cf85e75f0a8d9f0859290725f2b89c5c2394022", "language": "en", "original_url": "/docs/12/app-pgrestore.html"}, {"url": "https://pg.center/docs/12/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "089624dd131f52eea682b304f87a1acb03392ee7bcf78b000699c9b17c7ca22d", "language": "en", "original_url": "/docs/12/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_restore</span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.17.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/12/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/12/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/12/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/12/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/12/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/12/maintenance.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>, <a class=\"xref\" href=\"https://pg.center/docs/12/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/12/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/12/app-pgrestore.html", "method": "same-major semantic node", "sha256": "e9d28a37f02f2557658c1a5bbb7b7b81971a5fbae23f1018f778e6123af10963", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Client applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/tables/1/title": "Environment variables", "/versions/12/related/0/label": "libpq connection parameters", "/versions/12/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/12/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/12/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/12/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/12/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/12/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/12/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/12/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/12/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/12/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/12/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/12/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/12/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/12/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/12/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/12/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/12/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/12/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/12/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/12/tables/0/rows/20/summary": "Specifies verbose mode.", "/versions/12/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/12/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/12/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/12/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/12/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/12/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/12/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/12/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/12/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/12/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/12/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/12/tables/0/rows/32/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/12/tables/0/rows/33/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/12/tables/0/rows/34/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/12/tables/0/rows/35/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/12/tables/0/rows/36/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/12/tables/0/rows/37/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/12/tables/0/rows/38/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/12/tables/0/rows/39/summary": "User name to connect as.", "/versions/12/tables/0/rows/40/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/12/tables/0/rows/41/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/12/tables/0/rows/42/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/12/tables/1/columns/0/label": "Variable", "/versions/12/tables/1/columns/1/label": "Meaning", "/versions/12/tables/1/rows/0/description": "Default connection parameters", "/versions/12/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "3780fe0d9c3d5f59d8b725fbc107a32e2075d1b7ce7794639815403cae3eeca3"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "da159b6acc9fdac3aef33bf20c20392769c9234730383fc866821dae8b7d4ff9", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "44"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/13/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/13/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/13/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/13/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/13/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/13/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/13/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/13/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/13/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/13/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/13/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/13/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode.", "signature": "-v --verbose", "source_url": "/docs/13/app-pgrestore.html", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/13/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/13/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/13/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/13/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/13/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/13/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/13/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/13/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/13/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/13/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/13/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/13/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/13/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/13/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/13/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/13/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/13/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/13/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/13/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=13", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "https://pg.center/docs/13/app-pgrestore.html", "file": "app-pgrestore.html", "label": "13.23 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "5e1812da1aa666a6fb998456d98cba4281b874acbe7176fe5769b1f910ca7f1f", "language": "en", "original_url": "/docs/13/app-pgrestore.html"}, {"url": "https://pg.center/docs/13/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "2a16c2982d9803edd4bd6920f76b66083e7f2959182d6a3bcec7ccfbac0a9ad8", "language": "en", "original_url": "/docs/13/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\">pg_restore</span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.17.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/13/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/13/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/13/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/13/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/13/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/13/maintenance.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.17.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a>, <a class=\"xref\" href=\"https://pg.center/docs/13/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/13/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/13/app-pgrestore.html", "method": "same-major semantic node", "sha256": "6bebabff83d932fbe6f6a487c4f68bd90a4ea27b7683c0bde5868801090c4828", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Client applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/tables/1/title": "Environment variables", "/versions/13/related/0/label": "libpq connection parameters", "/versions/13/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/13/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/13/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/13/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/13/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/13/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/13/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/13/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/13/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/13/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/13/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/13/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/13/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/13/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/13/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/13/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/13/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/13/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/13/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/13/tables/0/rows/20/summary": "Specifies verbose mode.", "/versions/13/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/13/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/13/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/13/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/13/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/13/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/13/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/13/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/13/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/13/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/13/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/13/tables/0/rows/32/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/13/tables/0/rows/33/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/13/tables/0/rows/34/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/13/tables/0/rows/35/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/13/tables/0/rows/36/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/13/tables/0/rows/37/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/13/tables/0/rows/38/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/13/tables/0/rows/39/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/13/tables/0/rows/40/summary": "User name to connect as.", "/versions/13/tables/0/rows/41/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/13/tables/0/rows/42/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/13/tables/0/rows/43/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/13/tables/1/columns/0/label": "Variable", "/versions/13/tables/1/columns/1/label": "Meaning", "/versions/13/tables/1/rows/0/description": "Default connection parameters", "/versions/13/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "b0e4626aa9069305dd447bdf2b629f0225658ff99af01476b8c8a5fa89d8a10c"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "0d3bdb7097a4f12cb31d4dffb3375de107d7aac46d0e4c3cd35b3f6f7f32a25a", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "44"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/14/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/14/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/14/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/14/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/14/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/14/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/14/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/14/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/14/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/14/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/14/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/14/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/14/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/14/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/14/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/14/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/14/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/14/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/14/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/14/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/14/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/14/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/14/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/14/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/14/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/14/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/14/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/14/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/14/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/14/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/14/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/14/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=14", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "https://pg.center/docs/14/app-pgrestore.html", "file": "app-pgrestore.html", "label": "14.24 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "df5a70986459bcb9e82deccc5c1ee6f4c4cd9747ef25cd41b894433dfae1c7d6", "language": "en", "original_url": "/docs/14/app-pgrestore.html"}, {"url": "https://pg.center/docs/14/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "5a13567a052954dfe494dfaab9f50919faa1ae56023930fdbb78d45e53feccde", "language": "en", "original_url": "/docs/14/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/14/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/14/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/14/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/14/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/14/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"25.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a025.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/14/maintenance.html#AUTOVACUUM\" title=\"25.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a025.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/14/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/14/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/14/app-pgrestore.html", "method": "same-major semantic node", "sha256": "6435cc90fabaef8a2394c914d5812f4633d1d9663ea6f0f4e1d0b376901cedaa", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Client applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/tables/1/title": "Environment variables", "/versions/14/related/0/label": "libpq connection parameters", "/versions/14/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/14/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/14/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/14/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/14/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/14/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/14/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/14/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/14/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/14/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/14/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/14/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/14/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/14/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/14/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/14/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/14/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/14/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/14/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/14/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/14/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/14/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/14/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/14/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/14/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/14/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/14/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/14/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/14/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/14/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/14/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/14/tables/0/rows/32/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/14/tables/0/rows/33/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/14/tables/0/rows/34/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/14/tables/0/rows/35/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/14/tables/0/rows/36/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/14/tables/0/rows/37/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/14/tables/0/rows/38/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/14/tables/0/rows/39/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/14/tables/0/rows/40/summary": "User name to connect as.", "/versions/14/tables/0/rows/41/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/14/tables/0/rows/42/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/14/tables/0/rows/43/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/14/tables/1/columns/0/label": "Variable", "/versions/14/tables/1/columns/1/label": "Meaning", "/versions/14/tables/1/rows/0/description": "Default connection parameters", "/versions/14/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "f769e2d0c7a07c5deea61e5414fae8b49c00a76b25b2b09b038f6af965e6f0eb"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "ac37014fd0d194562c58576e6b1263132efabeb90fc097f0047a4a64eeb833f8", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "45"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u540e\uff0c\u6240\u6709\u5bf9\u8c61\u90fd\u4f1a\u91c7\u7528\u6062\u590d\u671f\u95f4\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/15/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/15/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/15/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/15/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/15/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/15/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/15/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/15/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/15/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/15/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/15/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/15/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/15/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/15/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/15/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/15/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/15/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/15/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/15/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/15/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/15/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/15/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/15/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/15/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/15/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/15/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/15/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/15/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/15/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/15/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/15/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/15/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=15", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "https://pg.center/docs/15/app-pgrestore.html", "file": "app-pgrestore.html", "label": "15.19 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "3873d8d2d2c2233fe29ca0eb8e72b1b64a6c22023ab3e2532cb21671b7a2f6f3", "language": "en", "original_url": "/docs/15/app-pgrestore.html"}, {"url": "https://pg.center/docs/15/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "015b2ea2bd205946a55a1b837e735570631bac831c92074a6bf58444f9a3cb98", "language": "en", "original_url": "/docs/15/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/15/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/15/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/15/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u540e\uff0c\u6240\u6709\u5bf9\u8c61\u90fd\u4f1a\u91c7\u7528\u6062\u590d\u671f\u95f4\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/15/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/15/maintenance.html#VACUUM-FOR-STATISTICS\" title=\"25.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a025.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/15/maintenance.html#AUTOVACUUM\" title=\"25.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a025.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/15/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/15/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/15/app-pgrestore.html", "method": "same-major semantic node", "sha256": "d65484735be44067a00bedb8b265c787f17597f3e536be510ec4e69bb1ea2087", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Client applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/tables/1/title": "Environment variables", "/versions/15/related/0/label": "libpq connection parameters", "/versions/15/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/15/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/15/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/15/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/15/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/15/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/15/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/15/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/15/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/15/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/15/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/15/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/15/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/15/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/15/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/15/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/15/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/15/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/15/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/15/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/15/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/15/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/15/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/15/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/15/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/15/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/15/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/15/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/15/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/15/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/15/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/15/tables/0/rows/32/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore.", "/versions/15/tables/0/rows/33/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/15/tables/0/rows/34/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/15/tables/0/rows/35/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/15/tables/0/rows/36/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/15/tables/0/rows/37/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/15/tables/0/rows/38/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/15/tables/0/rows/39/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/15/tables/0/rows/40/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/15/tables/0/rows/41/summary": "User name to connect as.", "/versions/15/tables/0/rows/42/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/15/tables/0/rows/43/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/15/tables/0/rows/44/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/15/tables/1/columns/0/label": "Variable", "/versions/15/tables/1/columns/1/label": "Meaning", "/versions/15/tables/1/rows/0/description": "Default connection parameters", "/versions/15/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "6b16285e788cf500d5bbaa01e775ec58505bed092a3455cbf62a9d079636e8b7"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "4e3e9a1d73c2394f1880c3717ba9a8b8fc799b6854b0e5e83a4f69f86b34efc7", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "45"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u540e\uff0c\u6240\u6709\u5bf9\u8c61\u90fd\u4f1a\u91c7\u7528\u6062\u590d\u671f\u95f4\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/16/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/16/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/16/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/16/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/16/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/16/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/16/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/16/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/16/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/16/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/16/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/16/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/16/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/16/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/16/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/16/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/16/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/16/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/16/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/16/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/16/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/16/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/16/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/16/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/16/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/16/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/16/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/16/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/16/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/16/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/16/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/16/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=16", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "https://pg.center/docs/16/app-pgrestore.html", "file": "app-pgrestore.html", "label": "16.15 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "0d3a00a59f1c6a1c92a11babd64c59ffb0aa8020ade52554edf0da729b816e39", "language": "en", "original_url": "/docs/16/app-pgrestore.html"}, {"url": "https://pg.center/docs/16/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a28c30c3c0f8783e16d56413a0b6fd39487e336da1683b29b60abf1c229cef26", "language": "en", "original_url": "/docs/16/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/16/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/16/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/16/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u540e\uff0c\u6240\u6709\u5bf9\u8c61\u90fd\u4f1a\u91c7\u7528\u6062\u590d\u671f\u95f4\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/16/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/16/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"25.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a025.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/16/routine-vacuuming.html#AUTOVACUUM\" title=\"25.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a025.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/16/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/16/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/16/app-pgrestore.html", "method": "same-major semantic node", "sha256": "177888b12cf474ff4bf0a03e699889872e3145304cfc4d6a10c6ff75ac6642b2", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Client applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/tables/1/title": "Environment variables", "/versions/16/related/0/label": "libpq connection parameters", "/versions/16/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/16/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/16/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/16/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/16/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/16/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/16/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/16/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/16/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/16/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/16/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/16/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/16/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/16/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/16/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/16/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/16/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/16/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/16/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/16/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/16/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/16/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/16/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/16/tables/0/rows/24/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/16/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/16/tables/0/rows/26/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/16/tables/0/rows/27/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/16/tables/0/rows/28/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/16/tables/0/rows/29/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/16/tables/0/rows/30/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/16/tables/0/rows/31/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/16/tables/0/rows/32/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore.", "/versions/16/tables/0/rows/33/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/16/tables/0/rows/34/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/16/tables/0/rows/35/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/16/tables/0/rows/36/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/16/tables/0/rows/37/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/16/tables/0/rows/38/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/16/tables/0/rows/39/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/16/tables/0/rows/40/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/16/tables/0/rows/41/summary": "User name to connect as.", "/versions/16/tables/0/rows/42/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/16/tables/0/rows/43/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/16/tables/0/rows/44/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/16/tables/1/columns/0/label": "Variable", "/versions/16/tables/1/columns/1/label": "Meaning", "/versions/16/tables/1/rows/0/description": "Default connection parameters", "/versions/16/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "e87965a775896dd07772f183dbc1703722e187830e64048241a32c2438e10ae0"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "4e3e9a1d73c2394f1880c3717ba9a8b8fc799b6854b0e5e83a4f69f86b34efc7", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a -n / --schema \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -N / --exclude-schema \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -P / --function \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c -I / --index \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c -t / --table \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca -T / --trigger \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece STDIN \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 - \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002 --filter \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--filter= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 N \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--transaction-size= N"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/17/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/17/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/17/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/17/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/17/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/17/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["--filter= filename"], "summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "signature": "--filter= filename", "source_url": "/docs/17/app-pgrestore.html", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/17/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/17/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/17/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/17/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/17/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/17/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/17/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/17/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/17/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/17/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/17/app-pgrestore.html", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/17/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/17/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/17/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/17/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/17/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/17/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "signature": "--strict-names", "source_url": "/docs/17/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--transaction-size= N"], "summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "signature": "--transaction-size= N", "source_url": "/docs/17/app-pgrestore.html", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/17/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/17/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/17/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/17/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/17/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/17/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/17/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/17/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=17", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "https://pg.center/docs/17/app-pgrestore.html", "file": "app-pgrestore.html", "label": "17.11 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "269dd8bee7f4e1bfc837c315cff786c5ff8398b880791a3306a4f4964cddebdc", "language": "en", "original_url": "/docs/17/app-pgrestore.html"}, {"url": "https://pg.center/docs/17/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3194fc72ddad8e2fcba55f8e007f83413cb352146cb65aaa9457a18d0314ee1b", "language": "en", "original_url": "/docs/17/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/17/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a<code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c<code class=\"option\">-I</code>/<code class=\"option\">--index</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c<code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece <code class=\"literal\">STDIN</code> \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 <code class=\"filename\">-</code> \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002<code class=\"option\">--filter</code> \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002</p>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u6bcf\u884c\u5217\u51fa\u4e00\u4e2a\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\">{ include | exclude } { function | index | schema | table | trigger } <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u662f\u5305\u542b\u8fd8\u662f\u6392\u9664\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u7b2c\u4e8c\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u8981\u7528\u8be5\u6a21\u5f0f\u8fc7\u6ee4\u7684\u5bf9\u8c61\u7c7b\u578b\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">function</code>\uff1a\u51fd\u6570\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">index\uff1a\u7d22\u5f15\uff0c\u4f5c\u7528\u4e0e -I/--indexes \u9009\u9879\u76f8\u540c\u3002\u6b64\u5173\u952e\u5b57\u53ea\u80fd\u4e0e include \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">schema</code>\uff1a\u6a21\u5f0f\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u548c <code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u9009\u9879\u76f8\u540c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">table</code>\uff1a\u8868\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">trigger</code>\uff1a\u89e6\u53d1\u5668\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4ee5 <code class=\"literal\">#</code> \u5f00\u5934\u7684\u884c\u88ab\u89c6\u4e3a\u6ce8\u91ca\u5e76\u5ffd\u7565\u3002\u6ce8\u91ca\u4e5f\u53ef\u4ee5\u653e\u5728\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u884c\u4e4b\u540e\u3002\u7a7a\u767d\u884c\u540c\u6837\u4f1a\u88ab\u5ffd\u7565\u3002\u6709\u5173\u5982\u4f55\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u52a0\u5f15\u53f7\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0e<code class=\"option\">--data-only</code>\u7684\u4f5c\u7528\u76f8\u53cd\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a<code class=\"option\">--section=pre-data --section=post-data</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4ec5\u6570\u636e\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/17/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/17/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--transaction-size=<em class=\"replaceable\"><code>N</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 <em class=\"replaceable\"><code>N</code></em> \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n<p lang=\"zh\"><code class=\"option\">--transaction-size</code> \u5728\u9ed8\u8ba4\u884c\u4e3a\uff08\u6bcf\u6761 SQL \u547d\u4ee4\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e0e <code class=\"option\">-1</code>/<code class=\"option\">--single-transaction</code>\uff08\u6240\u6709\u6062\u590d\u5bf9\u8c61\u5171\u7528\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e4b\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6298\u4e2d\u9009\u62e9\u3002\u867d\u7136 <code class=\"option\">--single-transaction</code> \u7684\u989d\u5916\u5f00\u9500\u6700\u5c0f\uff0c\u4f46\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u5e93\u6765\u8bf4\u53ef\u80fd\u5e76\u4e0d\u73b0\u5b9e\uff0c\u56e0\u4e3a\u8be5\u4e8b\u52a1\u4f1a\u5728\u6bcf\u4e2a\u6062\u590d\u5bf9\u8c61\u4e0a\u83b7\u53d6\u9501\uff0c\u4ece\u800c\u53ef\u80fd\u8017\u5c3d\u670d\u52a1\u5668\u7684\u9501\u8868\u7a7a\u95f4\u3002\u4f7f\u7528 <code class=\"option\">--transaction-size</code> \u5e76\u5c06\u5927\u5c0f\u8bbe\u4e3a\u51e0\u5343\u4e2a\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5728\u9650\u5236\u6240\u9700\u9501\u8868\u7a7a\u95f4\u7684\u540c\u65f6\uff0c\u83b7\u5f97\u51e0\u4e4e\u76f8\u540c\u7684\u6027\u80fd\u6536\u76ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/17/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u6062\u590d\u5b8c\u6210\u540e\uff0c\u6700\u597d\u5bf9\u6bcf\u4e2a\u6062\u590d\u7684\u8868\u8fd0\u884c<code class=\"command\">ANALYZE</code>\uff0c\u4ee5\u4fbf\u4f18\u5316\u5668\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\uff1b\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605<a class=\"xref\" href=\"/docs/17/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/17/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/17/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/17/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/17/app-pgrestore.html", "method": "same-major semantic node", "sha256": "209aa925b0f7593402ea51930af413b81e730a2827871df695304ca318ba0441", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[4]/ul[0]/li[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[4]/ul[0]/li[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[4]/ul[0]/li[4]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[21]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[21]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[21]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[21]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[47]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Client applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/tables/1/title": "Environment variables", "/versions/17/related/0/label": "libpq connection parameters", "/versions/17/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/17/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/17/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/17/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/17/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/17/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/17/tables/0/rows/6/summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "/versions/17/tables/0/rows/7/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/17/tables/0/rows/8/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/17/tables/0/rows/9/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/17/tables/0/rows/11/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/17/tables/0/rows/12/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/17/tables/0/rows/13/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/17/tables/0/rows/14/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/17/tables/0/rows/15/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/17/tables/0/rows/16/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/17/tables/0/rows/17/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/17/tables/0/rows/18/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/17/tables/0/rows/19/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/17/tables/0/rows/20/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/17/tables/0/rows/21/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/17/tables/0/rows/22/summary": "Print the pg_restore version and exit.", "/versions/17/tables/0/rows/23/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/17/tables/0/rows/24/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/17/tables/0/rows/25/summary": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/17/tables/0/rows/26/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/17/tables/0/rows/27/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/17/tables/0/rows/28/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/17/tables/0/rows/29/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/17/tables/0/rows/30/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/17/tables/0/rows/31/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/17/tables/0/rows/32/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/17/tables/0/rows/33/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "/versions/17/tables/0/rows/34/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/17/tables/0/rows/35/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/17/tables/0/rows/36/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/17/tables/0/rows/37/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file.", "/versions/17/tables/0/rows/38/summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "/versions/17/tables/0/rows/39/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/17/tables/0/rows/40/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/17/tables/0/rows/41/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/17/tables/0/rows/42/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/17/tables/0/rows/43/summary": "User name to connect as.", "/versions/17/tables/0/rows/44/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/17/tables/0/rows/45/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/17/tables/0/rows/46/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/17/tables/1/columns/0/label": "Variable", "/versions/17/tables/1/columns/1/label": "Meaning", "/versions/17/tables/1/rows/0/description": "Default connection parameters", "/versions/17/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "124e7e6e31a00c7dca52a941767ab33dcc32557c371455d9a01a76d8552264a8"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option is the inverse of --data-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the backup file."}, {"names": ["--transaction-size= N"], "signature": "--transaction-size= N", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "24bbe9cc3b47a658aa0851173e0fbfe7f1d5f0dec825f24e8579b6c48c0d05df", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "53"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a -n / --schema \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -N / --exclude-schema \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -P / --function \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c -I / --index \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c -t / --table \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca -T / --trigger \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece STDIN \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 - \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002 --filter \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--filter= filename"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-data"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-policies"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-statistics"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--statistics"}}, {"summary": "\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--statistics-only"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 N \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--transaction-size= N"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/18/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/18/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/18/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/18/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/18/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/18/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/18/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/18/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "signature": "--filter= filename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/18/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "summary": "Do not output commands to restore data, even if the archive contains them.", "signature": "--no-data", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/18/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "summary": "Do not output commands to restore row security policies, even if the archive contains them.", "signature": "--no-policies", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "signature": "--no-schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "summary": "Do not output commands to restore statistics, even if the archive contains them.", "signature": "--no-statistics", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/18/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/18/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "signature": "--statistics", "source_url": "/docs/18/app-pgrestore.html", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "summary": "Restore only the statistics, not schema (data definitions) or data.", "signature": "--statistics-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "signature": "--strict-names", "source_url": "/docs/18/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "signature": "--transaction-size= N", "source_url": "/docs/18/app-pgrestore.html", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/18/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/18/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgrestore.html", "file": "app-pgrestore.html", "label": "18.6 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "ac4df6d64f46809a487e98597ad3d3f69abc33de7cd5e5c1537563e2b6d9b5fa", "language": "en", "original_url": "/docs/18/app-pgrestore.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--data-only</code> \u6216 <code class=\"option\">--statistics-only</code> \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=pre-data --section=post-data --no-statistics</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a<code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c<code class=\"option\">-I</code>/<code class=\"option\">--index</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c<code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece <code class=\"literal\">STDIN</code> \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 <code class=\"filename\">-</code> \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002<code class=\"option\">--filter</code> \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002</p>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u6bcf\u884c\u5217\u51fa\u4e00\u4e2a\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\">{ include | exclude } { function | index | schema | table | trigger } <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u662f\u5305\u542b\u8fd8\u662f\u6392\u9664\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u7b2c\u4e8c\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u8981\u7528\u8be5\u6a21\u5f0f\u8fc7\u6ee4\u7684\u5bf9\u8c61\u7c7b\u578b\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">function</code>\uff1a\u51fd\u6570\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">index\uff1a\u7d22\u5f15\uff0c\u4f5c\u7528\u4e0e -I/--indexes \u9009\u9879\u76f8\u540c\u3002\u6b64\u5173\u952e\u5b57\u53ea\u80fd\u4e0e include \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">schema</code>\uff1a\u6a21\u5f0f\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u548c <code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u9009\u9879\u76f8\u540c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">table</code>\uff1a\u8868\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">trigger</code>\uff1a\u89e6\u53d1\u5668\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4ee5 <code class=\"literal\">#</code> \u5f00\u5934\u7684\u884c\u88ab\u89c6\u4e3a\u6ce8\u91ca\u5e76\u5ffd\u7565\u3002\u6ce8\u91ca\u4e5f\u53ef\u4ee5\u653e\u5728\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u884c\u4e4b\u540e\u3002\u7a7a\u767d\u884c\u540c\u6837\u4f1a\u88ab\u5ffd\u7565\u3002\u6709\u5173\u5982\u4f55\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u52a0\u5f15\u53f7\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--transaction-size=<em class=\"replaceable\"><code>N</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 <em class=\"replaceable\"><code>N</code></em> \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n<p lang=\"zh\"><code class=\"option\">--transaction-size</code> \u5728\u9ed8\u8ba4\u884c\u4e3a\uff08\u6bcf\u6761 SQL \u547d\u4ee4\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e0e <code class=\"option\">-1</code>/<code class=\"option\">--single-transaction</code>\uff08\u6240\u6709\u6062\u590d\u5bf9\u8c61\u5171\u7528\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e4b\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6298\u4e2d\u9009\u62e9\u3002\u867d\u7136 <code class=\"option\">--single-transaction</code> \u7684\u989d\u5916\u5f00\u9500\u6700\u5c0f\uff0c\u4f46\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u5e93\u6765\u8bf4\u53ef\u80fd\u5e76\u4e0d\u73b0\u5b9e\uff0c\u56e0\u4e3a\u8be5\u4e8b\u52a1\u4f1a\u5728\u6bcf\u4e2a\u6062\u590d\u5bf9\u8c61\u4e0a\u83b7\u53d6\u9501\uff0c\u4ece\u800c\u53ef\u80fd\u8017\u5c3d\u670d\u52a1\u5668\u7684\u9501\u8868\u7a7a\u95f4\u3002\u4f7f\u7528 <code class=\"option\">--transaction-size</code> \u5e76\u5c06\u5927\u5c0f\u8bbe\u4e3a\u51e0\u5343\u4e2a\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5728\u9650\u5236\u6240\u9700\u9501\u8868\u7a7a\u95f4\u7684\u540c\u65f6\uff0c\u83b7\u5f97\u51e0\u4e4e\u76f8\u540c\u7684\u6027\u80fd\u6536\u76ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u8f6c\u50a8\u6587\u4ef6\u4e2d\u5305\u542b\u4f18\u5316\u5668\u7edf\u8ba1\u4fe1\u606f\uff0c<code class=\"command\">pg_restore</code> \u4f1a\u6062\u590d\u5b83\u4eec\u3002\u5982\u679c\u5e76\u975e\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u90fd\u5df2\u6062\u590d\uff0c\u90a3\u4e48\u5bf9\u6bcf\u4e2a\u5df2\u6062\u590d\u7684\u8868\u6267\u884c <code class=\"command\">ANALYZE</code> \u53ef\u80fd\u4f1a\u5f88\u6709\u5e2e\u52a9\uff0c\u8fd9\u6837\u4f18\u5316\u5668\u5c31\u80fd\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/18/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgrestore.html", "method": "same-major semantic node", "sha256": "3ac2e6b9f506d8d1d2a1b8d626ac72d0bd4878a84c30f78d8d8e2cc9c4fe19c1", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[4]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[85]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[87]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[89]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[93]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[95]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/related/0/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/18/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/18/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/18/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/18/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/18/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/18/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/18/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/18/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/18/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/18/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/18/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/18/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/18/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/18/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/18/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/18/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/18/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/18/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/18/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/18/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/18/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/18/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/18/tables/0/rows/24/summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/18/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/18/tables/0/rows/26/summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "/versions/18/tables/0/rows/27/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/18/tables/0/rows/28/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/18/tables/0/rows/29/summary": "Do not output commands to restore data, even if the archive contains them.", "/versions/18/tables/0/rows/30/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/18/tables/0/rows/31/summary": "Do not output commands to restore row security policies, even if the archive contains them.", "/versions/18/tables/0/rows/32/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/18/tables/0/rows/33/summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "/versions/18/tables/0/rows/34/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/18/tables/0/rows/35/summary": "Do not output commands to restore statistics, even if the archive contains them.", "/versions/18/tables/0/rows/36/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/18/tables/0/rows/37/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "/versions/18/tables/0/rows/38/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/18/tables/0/rows/39/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/18/tables/0/rows/40/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/18/tables/0/rows/41/summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "/versions/18/tables/0/rows/42/summary": "Restore only the statistics, not schema (data definitions) or data.", "/versions/18/tables/0/rows/43/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "/versions/18/tables/0/rows/44/summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "/versions/18/tables/0/rows/45/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/18/tables/0/rows/46/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/18/tables/0/rows/47/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/18/tables/0/rows/48/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/18/tables/0/rows/49/summary": "User name to connect as.", "/versions/18/tables/0/rows/50/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/51/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/18/tables/0/rows/52/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Default connection parameters", "/versions/18/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "2f452cf6e4d5139505a00d4783baee42387d624c77832a31aec8b0c1a1f921c4"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "signature": "--no-schema", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "signature": "--statistics", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "signature": "--transaction-size= N", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "bd6f4ae67c44e7910aa300beb77d5bbe563ed23a586f2889963b7389840c0f97", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "53"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 njobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-j njobs --jobs= njobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002\u5b83\u4e0d\u80fd\u4e0e --create \u4e00\u8d77\u4f7f\u7528\uff0c\u4e5f\u4e0d\u80fd\u4e0e\u591a\u4e2a\u4f5c\u4e1a\uff08 --jobs \uff09\u4e00\u8d77\u4f7f\u7528\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a -n / --schema \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -N / --exclude-schema \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -P / --function \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c -I / --index \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c -t / --table \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca -T / --trigger \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece STDIN \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 - \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002 --filter \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--filter= filename"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-data"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-policies"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-statistics"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--statistics"}}, {"summary": "\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--statistics-only"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 N \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--transaction-size= N"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/19/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/19/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/19/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive. This option cannot be used together with --single-transaction ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/19/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/19/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/19/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/19/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j njobs", "--jobs= njobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j njobs --jobs= njobs", "source_url": "/docs/19/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/19/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/19/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/19/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/19/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/19/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/19/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs ).", "signature": "-1 --single-transaction", "source_url": "/docs/19/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs )."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/19/app-pgrestore.html", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/19/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "signature": "--filter= filename", "source_url": "/docs/19/app-pgrestore.html", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/19/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "summary": "Do not output commands to restore data, even if the archive contains them.", "signature": "--no-data", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/19/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "summary": "Do not output commands to restore row security policies, even if the archive contains them.", "signature": "--no-policies", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "signature": "--no-schema", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "summary": "Do not output commands to restore statistics, even if the archive contains them.", "signature": "--no-statistics", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/19/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/19/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/19/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "signature": "--statistics", "source_url": "/docs/19/app-pgrestore.html", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "summary": "Restore only the statistics, not schema (data definitions) or data.", "signature": "--statistics-only", "source_url": "/docs/19/app-pgrestore.html", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "signature": "--strict-names", "source_url": "/docs/19/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "signature": "--transaction-size= N", "source_url": "/docs/19/app-pgrestore.html", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/19/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/19/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/19/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/19/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/19/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/19/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/19/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/19/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=19", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "https://pg.center/docs/19/app-pgrestore.html", "file": "app-pgrestore.html", "label": "19beta4 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "89c41cab1e882621c7bcf75fc41c2677a5baddfef04b027530101611f069943c", "language": "en", "original_url": "/docs/19/app-pgrestore.html"}, {"url": "https://pg.center/docs/19/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "c827f460db781b39da305303c88e73729a419cd2b2b9dedb126d8ad5cbf02c95", "language": "en", "original_url": "/docs/19/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/19/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>njobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>njobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>njobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--data-only</code> \u6216 <code class=\"option\">--statistics-only</code> \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=pre-data --section=post-data --no-statistics</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002\u5b83\u4e0d\u80fd\u4e0e <code class=\"option\">--create</code> \u4e00\u8d77\u4f7f\u7528\uff0c\u4e5f\u4e0d\u80fd\u4e0e\u591a\u4e2a\u4f5c\u4e1a\uff08<code class=\"option\">--jobs</code>\uff09\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/19/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/19/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a<code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c<code class=\"option\">-I</code>/<code class=\"option\">--index</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c<code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece <code class=\"literal\">STDIN</code> \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 <code class=\"filename\">-</code> \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002<code class=\"option\">--filter</code> \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002</p>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u6bcf\u884c\u5217\u51fa\u4e00\u4e2a\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\">{ include | exclude } { function | index | schema | table | trigger } <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u662f\u5305\u542b\u8fd8\u662f\u6392\u9664\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u7b2c\u4e8c\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u8981\u7528\u8be5\u6a21\u5f0f\u8fc7\u6ee4\u7684\u5bf9\u8c61\u7c7b\u578b\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">function</code>\uff1a\u51fd\u6570\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">index\uff1a\u7d22\u5f15\uff0c\u4f5c\u7528\u4e0e -I/--indexes \u9009\u9879\u76f8\u540c\u3002\u6b64\u5173\u952e\u5b57\u53ea\u80fd\u4e0e include \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">schema</code>\uff1a\u6a21\u5f0f\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u548c <code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u9009\u9879\u76f8\u540c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">table</code>\uff1a\u8868\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">trigger</code>\uff1a\u89e6\u53d1\u5668\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4ee5 <code class=\"literal\">#</code> \u5f00\u5934\u7684\u884c\u88ab\u89c6\u4e3a\u6ce8\u91ca\u5e76\u5ffd\u7565\u3002\u6ce8\u91ca\u4e5f\u53ef\u4ee5\u653e\u5728\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u884c\u4e4b\u540e\u3002\u7a7a\u767d\u884c\u540c\u6837\u4f1a\u88ab\u5ffd\u7565\u3002\u6709\u5173\u5982\u4f55\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u52a0\u5f15\u53f7\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--transaction-size=<em class=\"replaceable\"><code>N</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 <em class=\"replaceable\"><code>N</code></em> \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n<p lang=\"zh\"><code class=\"option\">--transaction-size</code> \u5728\u9ed8\u8ba4\u884c\u4e3a\uff08\u6bcf\u6761 SQL \u547d\u4ee4\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e0e <code class=\"option\">-1</code>/<code class=\"option\">--single-transaction</code>\uff08\u6240\u6709\u6062\u590d\u5bf9\u8c61\u5171\u7528\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e4b\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6298\u4e2d\u9009\u62e9\u3002\u867d\u7136 <code class=\"option\">--single-transaction</code> \u7684\u989d\u5916\u5f00\u9500\u6700\u5c0f\uff0c\u4f46\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u5e93\u6765\u8bf4\u53ef\u80fd\u5e76\u4e0d\u73b0\u5b9e\uff0c\u56e0\u4e3a\u8be5\u4e8b\u52a1\u4f1a\u5728\u6bcf\u4e2a\u6062\u590d\u5bf9\u8c61\u4e0a\u83b7\u53d6\u9501\uff0c\u4ece\u800c\u53ef\u80fd\u8017\u5c3d\u670d\u52a1\u5668\u7684\u9501\u8868\u7a7a\u95f4\u3002\u4f7f\u7528 <code class=\"option\">--transaction-size</code> \u5e76\u5c06\u5927\u5c0f\u8bbe\u4e3a\u51e0\u5343\u4e2a\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5728\u9650\u5236\u6240\u9700\u9501\u8868\u7a7a\u95f4\u7684\u540c\u65f6\uff0c\u83b7\u5f97\u51e0\u4e4e\u76f8\u540c\u7684\u6027\u80fd\u6536\u76ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/19/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-n</code> \u6216 <code class=\"option\">-t</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u6216\u6a21\u5f0f\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6307\u5b9a\u6062\u590d\u4e00\u4e2a\u5176\u5b9a\u4e49\u5305\u542b\u5916\u952e\u7684\u8868\uff0c\u5219\u4e0d\u4f1a\u81ea\u52a8\u6062\u590d\u8be5\u5916\u952e\u6240\u5f15\u7528\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\u5e76\u884c\u6062\u590d\uff08--jobs \u5927\u4e8e 1\uff09\u9700\u8981\u5e94\u7528\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u4f9d\u8d56\u4fe1\u606f\uff0c\u4ee5\u786e\u4fdd\u5bf9\u8c61\u4e0d\u4f1a\u5148\u4e8e\u5176\u4f9d\u8d56\u7684\u5176\u4ed6\u5bf9\u8c61\u6062\u590d\u3002\u5982\u679c\u5f52\u6863\u4e0d\u5305\u542b\u5bf9\u8c61\u5b9a\u4e49\uff08pre-data \u90e8\u5206\uff09\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5c31\u4f1a\u4e0d\u5b8c\u6574\uff0c\u4ece\u800c\u5bfc\u81f4\u610f\u5916\u7684\u6062\u590d\u5931\u8d25\u3002\u56e0\u6b64\uff0c\u521b\u5efa\u51c6\u5907\u8fdb\u884c\u5e76\u884c\u6062\u590d\u7684\u5f52\u6863\u65f6\uff0c\u8bf7\u907f\u514d\u4f7f\u7528 pg_dump \u7684 --no-schema\u3001-a/--data-only\uff0c\u6216\u4e0d\u5305\u542b pre-data \u7684 --section \u7b49\u9009\u9879\u3002\u53ef\u4ee5\u6539\u4e3a\u5411 pg_restore \u63d0\u4f9b\u8fd9\u4e9b\u9009\u9879\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u8f6c\u50a8\u6587\u4ef6\u4e2d\u5305\u542b\u4f18\u5316\u5668\u7edf\u8ba1\u4fe1\u606f\uff0c<code class=\"command\">pg_restore</code> \u4f1a\u6062\u590d\u5b83\u4eec\u3002\u5982\u679c\u5e76\u975e\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u90fd\u5df2\u6062\u590d\uff0c\u90a3\u4e48\u5bf9\u6bcf\u4e2a\u5df2\u6062\u590d\u7684\u8868\u6267\u884c <code class=\"command\">ANALYZE</code> \u53ef\u80fd\u4f1a\u5f88\u6709\u5e2e\u52a9\uff0c\u8fd9\u6837\u4f18\u5316\u5668\u5c31\u80fd\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/19/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/19/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/19/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/19/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/19/app-pgrestore.html", "method": "same-major semantic node", "sha256": "2975f841116916540e9628a7be640064c3c1ae9da897e9b309c0c63f4bfa82fd", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[4]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[85]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[87]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[89]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[93]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[95]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[5]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[5]/ul[0]/li[2]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[2]", "#APP-PGRESTORE/div[8]/p[4]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[8]/p[7]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Client applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/tables/1/title": "Environment variables", "/versions/19/related/0/label": "libpq connection parameters", "/versions/19/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/19/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/19/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/19/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/19/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/19/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/19/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/19/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/19/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/19/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/19/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/19/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/19/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/19/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/19/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/19/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/19/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/19/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/19/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/19/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/19/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/19/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/19/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs ).", "/versions/19/tables/0/rows/24/summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/19/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/19/tables/0/rows/26/summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "/versions/19/tables/0/rows/27/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/19/tables/0/rows/28/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/19/tables/0/rows/29/summary": "Do not output commands to restore data, even if the archive contains them.", "/versions/19/tables/0/rows/30/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/19/tables/0/rows/31/summary": "Do not output commands to restore row security policies, even if the archive contains them.", "/versions/19/tables/0/rows/32/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/19/tables/0/rows/33/summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "/versions/19/tables/0/rows/34/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/19/tables/0/rows/35/summary": "Do not output commands to restore statistics, even if the archive contains them.", "/versions/19/tables/0/rows/36/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/19/tables/0/rows/37/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "/versions/19/tables/0/rows/38/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/19/tables/0/rows/39/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/19/tables/0/rows/40/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/19/tables/0/rows/41/summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "/versions/19/tables/0/rows/42/summary": "Restore only the statistics, not schema (data definitions) or data.", "/versions/19/tables/0/rows/43/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "/versions/19/tables/0/rows/44/summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "/versions/19/tables/0/rows/45/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/19/tables/0/rows/46/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/19/tables/0/rows/47/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/19/tables/0/rows/48/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/19/tables/0/rows/49/summary": "User name to connect as.", "/versions/19/tables/0/rows/50/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/19/tables/0/rows/51/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/19/tables/0/rows/52/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/19/tables/1/columns/0/label": "Variable", "/versions/19/tables/1/columns/1/label": "Meaning", "/versions/19/tables/1/rows/0/description": "Default connection parameters", "/versions/19/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "167d07fdf6c7c655ecd0a616134cc102d6f6ced9535992137403a821a81b11af"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive. This option cannot be used together with --single-transaction ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j njobs", "--jobs= njobs"], "signature": "-j njobs --jobs= njobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs )."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "signature": "--no-schema", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "signature": "--statistics", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "signature": "--transaction-size= N", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "11bdefc4b285205f855f386013c3e7461ae79caf5aa742632b3e51441be3b48d", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "53"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 njobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-j njobs --jobs= njobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002\u5b83\u4e0d\u80fd\u4e0e --create \u4e00\u8d77\u4f7f\u7528\uff0c\u4e5f\u4e0d\u80fd\u4e0e\u591a\u4e2a\u4f5c\u4e1a\uff08 --jobs \uff09\u4e00\u8d77\u4f7f\u7528\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a -n / --schema \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -N / --exclude-schema \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -P / --function \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c -I / --index \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c -t / --table \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca -T / --trigger \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece STDIN \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 - \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002 --filter \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--filter= filename"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-data"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-policies"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-statistics"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--statistics"}}, {"summary": "\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--statistics-only"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 N \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--transaction-size= N"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/devel/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/devel/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/devel/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive. This option cannot be used together with --single-transaction ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/devel/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/devel/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j njobs", "--jobs= njobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j njobs --jobs= njobs", "source_url": "/docs/devel/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/devel/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/devel/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/devel/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/devel/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs ).", "signature": "-1 --single-transaction", "source_url": "/docs/devel/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs )."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/devel/app-pgrestore.html", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/devel/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "signature": "--filter= filename", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/devel/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "summary": "Do not output commands to restore data, even if the archive contains them.", "signature": "--no-data", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/devel/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "summary": "Do not output commands to restore row security policies, even if the archive contains them.", "signature": "--no-policies", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "signature": "--no-schema", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "summary": "Do not output commands to restore statistics, even if the archive contains them.", "signature": "--no-statistics", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/devel/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/devel/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/devel/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "signature": "--statistics", "source_url": "/docs/devel/app-pgrestore.html", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "summary": "Restore only the statistics, not schema (data definitions) or data.", "signature": "--statistics-only", "source_url": "/docs/devel/app-pgrestore.html", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "signature": "--strict-names", "source_url": "/docs/devel/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "signature": "--transaction-size= N", "source_url": "/docs/devel/app-pgrestore.html", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/devel/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/devel/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/devel/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/devel/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/devel/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/devel/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=20", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "https://pg.center/docs/devel/app-pgrestore.html", "file": "app-pgrestore.html", "label": "20devel English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "1c296120754f5d575753568b4c8414c0f52eed3a74431233dd512371deab717c", "language": "en", "original_url": "/docs/devel/app-pgrestore.html"}, {"url": "https://pg.center/docs/devel/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a6c7ba748fa1d9feac5bb7cde41d1d36a1f4c26d5963e07fb103d02918b2a8ca", "language": "en", "original_url": "/docs/devel/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/devel/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>njobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>njobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>njobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--data-only</code> \u6216 <code class=\"option\">--statistics-only</code> \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=pre-data --section=post-data --no-statistics</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002\u5b83\u4e0d\u80fd\u4e0e <code class=\"option\">--create</code> \u4e00\u8d77\u4f7f\u7528\uff0c\u4e5f\u4e0d\u80fd\u4e0e\u591a\u4e2a\u4f5c\u4e1a\uff08<code class=\"option\">--jobs</code>\uff09\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/devel/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/devel/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a<code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c<code class=\"option\">-I</code>/<code class=\"option\">--index</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c<code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece <code class=\"literal\">STDIN</code> \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 <code class=\"filename\">-</code> \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002<code class=\"option\">--filter</code> \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002</p>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u6bcf\u884c\u5217\u51fa\u4e00\u4e2a\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\">{ include | exclude } { function | index | schema | table | trigger } <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u662f\u5305\u542b\u8fd8\u662f\u6392\u9664\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u7b2c\u4e8c\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u8981\u7528\u8be5\u6a21\u5f0f\u8fc7\u6ee4\u7684\u5bf9\u8c61\u7c7b\u578b\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">function</code>\uff1a\u51fd\u6570\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">index\uff1a\u7d22\u5f15\uff0c\u4f5c\u7528\u4e0e -I/--indexes \u9009\u9879\u76f8\u540c\u3002\u6b64\u5173\u952e\u5b57\u53ea\u80fd\u4e0e include \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">schema</code>\uff1a\u6a21\u5f0f\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u548c <code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u9009\u9879\u76f8\u540c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">table</code>\uff1a\u8868\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">trigger</code>\uff1a\u89e6\u53d1\u5668\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4ee5 <code class=\"literal\">#</code> \u5f00\u5934\u7684\u884c\u88ab\u89c6\u4e3a\u6ce8\u91ca\u5e76\u5ffd\u7565\u3002\u6ce8\u91ca\u4e5f\u53ef\u4ee5\u653e\u5728\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u884c\u4e4b\u540e\u3002\u7a7a\u767d\u884c\u540c\u6837\u4f1a\u88ab\u5ffd\u7565\u3002\u6709\u5173\u5982\u4f55\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u52a0\u5f15\u53f7\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--transaction-size=<em class=\"replaceable\"><code>N</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 <em class=\"replaceable\"><code>N</code></em> \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n<p lang=\"zh\"><code class=\"option\">--transaction-size</code> \u5728\u9ed8\u8ba4\u884c\u4e3a\uff08\u6bcf\u6761 SQL \u547d\u4ee4\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e0e <code class=\"option\">-1</code>/<code class=\"option\">--single-transaction</code>\uff08\u6240\u6709\u6062\u590d\u5bf9\u8c61\u5171\u7528\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e4b\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6298\u4e2d\u9009\u62e9\u3002\u867d\u7136 <code class=\"option\">--single-transaction</code> \u7684\u989d\u5916\u5f00\u9500\u6700\u5c0f\uff0c\u4f46\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u5e93\u6765\u8bf4\u53ef\u80fd\u5e76\u4e0d\u73b0\u5b9e\uff0c\u56e0\u4e3a\u8be5\u4e8b\u52a1\u4f1a\u5728\u6bcf\u4e2a\u6062\u590d\u5bf9\u8c61\u4e0a\u83b7\u53d6\u9501\uff0c\u4ece\u800c\u53ef\u80fd\u8017\u5c3d\u670d\u52a1\u5668\u7684\u9501\u8868\u7a7a\u95f4\u3002\u4f7f\u7528 <code class=\"option\">--transaction-size</code> \u5e76\u5c06\u5927\u5c0f\u8bbe\u4e3a\u51e0\u5343\u4e2a\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5728\u9650\u5236\u6240\u9700\u9501\u8868\u7a7a\u95f4\u7684\u540c\u65f6\uff0c\u83b7\u5f97\u51e0\u4e4e\u76f8\u540c\u7684\u6027\u80fd\u6536\u76ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/devel/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-n</code> \u6216 <code class=\"option\">-t</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u6216\u6a21\u5f0f\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6307\u5b9a\u6062\u590d\u4e00\u4e2a\u5176\u5b9a\u4e49\u5305\u542b\u5916\u952e\u7684\u8868\uff0c\u5219\u4e0d\u4f1a\u81ea\u52a8\u6062\u590d\u8be5\u5916\u952e\u6240\u5f15\u7528\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\u5e76\u884c\u6062\u590d\uff08--jobs \u5927\u4e8e 1\uff09\u9700\u8981\u5e94\u7528\u5f52\u6863\u6587\u4ef6\u4e2d\u7684\u4f9d\u8d56\u4fe1\u606f\uff0c\u4ee5\u786e\u4fdd\u5bf9\u8c61\u4e0d\u4f1a\u5148\u4e8e\u5176\u4f9d\u8d56\u7684\u5176\u4ed6\u5bf9\u8c61\u6062\u590d\u3002\u5982\u679c\u5f52\u6863\u4e0d\u5305\u542b\u5bf9\u8c61\u5b9a\u4e49\uff08pre-data \u90e8\u5206\uff09\uff0c\u8fd9\u4e9b\u4fe1\u606f\u5c31\u4f1a\u4e0d\u5b8c\u6574\uff0c\u4ece\u800c\u5bfc\u81f4\u610f\u5916\u7684\u6062\u590d\u5931\u8d25\u3002\u56e0\u6b64\uff0c\u521b\u5efa\u51c6\u5907\u8fdb\u884c\u5e76\u884c\u6062\u590d\u7684\u5f52\u6863\u65f6\uff0c\u8bf7\u907f\u514d\u4f7f\u7528 pg_dump \u7684 --no-schema\u3001-a/--data-only\uff0c\u6216\u4e0d\u5305\u542b pre-data \u7684 --section \u7b49\u9009\u9879\u3002\u53ef\u4ee5\u6539\u4e3a\u5411 pg_restore \u63d0\u4f9b\u8fd9\u4e9b\u9009\u9879\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u8f6c\u50a8\u6587\u4ef6\u4e2d\u5305\u542b\u4f18\u5316\u5668\u7edf\u8ba1\u4fe1\u606f\uff0c<code class=\"command\">pg_restore</code> \u4f1a\u6062\u590d\u5b83\u4eec\u3002\u5982\u679c\u5e76\u975e\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u90fd\u5df2\u6062\u590d\uff0c\u90a3\u4e48\u5bf9\u6bcf\u4e2a\u5df2\u6062\u590d\u7684\u8868\u6267\u884c <code class=\"command\">ANALYZE</code> \u53ef\u80fd\u4f1a\u5f88\u6709\u5e2e\u52a9\uff0c\u8fd9\u6837\u4f18\u5316\u5668\u5c31\u80fd\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/devel/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/devel/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/devel/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/devel/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/app-pgrestore.html", "method": "same-major semantic node", "sha256": "407070f0065ff5330825575351414627534337ab33f3e62aeaa346979ae0db15", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[4]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[85]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[87]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[89]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[93]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[95]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[5]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[5]/ul[0]/li[2]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[2]", "#APP-PGRESTORE/div[8]/p[4]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[8]/p[7]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/summary": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/category": "Client applications", "/versions/20/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Client applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/tables/1/title": "Environment variables", "/versions/20/related/0/label": "libpq connection parameters", "/versions/20/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/20/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/20/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/20/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/20/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/20/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/20/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/20/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/20/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/20/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/20/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/20/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/20/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/20/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/20/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/20/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/20/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/20/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/20/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/20/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/20/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/20/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/20/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs ).", "/versions/20/tables/0/rows/24/summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/20/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/20/tables/0/rows/26/summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "/versions/20/tables/0/rows/27/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/20/tables/0/rows/28/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/20/tables/0/rows/29/summary": "Do not output commands to restore data, even if the archive contains them.", "/versions/20/tables/0/rows/30/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/20/tables/0/rows/31/summary": "Do not output commands to restore row security policies, even if the archive contains them.", "/versions/20/tables/0/rows/32/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/20/tables/0/rows/33/summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "/versions/20/tables/0/rows/34/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/20/tables/0/rows/35/summary": "Do not output commands to restore statistics, even if the archive contains them.", "/versions/20/tables/0/rows/36/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/20/tables/0/rows/37/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "/versions/20/tables/0/rows/38/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/20/tables/0/rows/39/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/20/tables/0/rows/40/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/20/tables/0/rows/41/summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "/versions/20/tables/0/rows/42/summary": "Restore only the statistics, not schema (data definitions) or data.", "/versions/20/tables/0/rows/43/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "/versions/20/tables/0/rows/44/summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "/versions/20/tables/0/rows/45/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/20/tables/0/rows/46/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/20/tables/0/rows/47/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/20/tables/0/rows/48/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/20/tables/0/rows/49/summary": "User name to connect as.", "/versions/20/tables/0/rows/50/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/20/tables/0/rows/51/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/20/tables/0/rows/52/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/20/tables/1/columns/0/label": "Variable", "/versions/20/tables/1/columns/1/label": "Meaning", "/versions/20/tables/1/rows/0/description": "Default connection parameters", "/versions/20/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "b6297decdcdea0f29ea4284c33cd3def6756494266c05edf94c03c47404de216"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive. This option cannot be used together with --single-transaction ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j njobs", "--jobs= njobs"], "signature": "-j njobs --jobs= njobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to njobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error . It cannot be used together with --create , nor with multiple jobs ( --jobs )."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "signature": "--no-schema", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "signature": "--statistics", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "signature": "--transaction-size= N", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "11bdefc4b285205f855f386013c3e7461ae79caf5aa742632b3e51441be3b48d", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_restore"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "53"}], "tables": [{"key": "options", "rows": [{"summary": "\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-a --data-only"}}, {"summary": "\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa DROP \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --if-exists \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-c --clean"}}, {"summary": "\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-C --create"}}, {"summary": "\u8fde\u63a5\u5230\u6570\u636e\u5e93 dbname \uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002 dbname \u53ef\u4ee5\u662f\u4e00\u4e2a \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-e --exit-on-error"}}, {"summary": "\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e -l \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 - \u8868\u793a stdout \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-f filename --file= filename"}}, {"summary": "\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a pg_restore \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-F format --format= format"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -I \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-I index --index= index"}}, {"summary": "\u5c06 pg_restore \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 number-of-jobs \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-j number-of-jobs --jobs= number-of-jobs"}}, {"summary": "\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-l --list"}}, {"summary": "\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-L list-file --use-list= list-file"}}, {"summary": "\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -n \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e -t \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-n schema --schema= schema"}}, {"summary": "\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -N \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-N schema --exclude-schema= schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u53d1\u51fa ALTER OWNER \u6216 SET SESSION AUTHORIZATION \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 -O \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-O --no-owner"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -P \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-R --no-reconnect"}}, {"summary": "\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-s --schema-only"}}, {"summary": "\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 --disable-triggers \u65f6\u624d\u76f8\u5173\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-S username --superuser= username"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684 \u201c \u8868 \u201d \u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -t \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e -n \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-t table --table= table"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a -T \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-T trigger --trigger= trigger"}}, {"summary": "\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f pg_restore \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-v --verbose"}}, {"summary": "\u6253\u5370 pg_restore \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-V --version"}}, {"summary": "\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-x --no-privileges --no-acl"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 BEGIN / COMMIT \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-1 --single-transaction"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a pg_restore \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--disable-triggers"}}, {"summary": "\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c pg_restore \u4f1a\u5c06 row_security \u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a pg_restore \u6539\u4e3a\u5c06 row_security \u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--enable-row-security"}}, {"summary": "\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a -n / --schema \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -N / --exclude-schema \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c -P / --function \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c -I / --index \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c -t / --table \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca -T / --trigger \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece STDIN \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 - \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002 --filter \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--filter= filename"}}, {"summary": "\u4f7f\u7528 DROP ... IF EXISTS \u547d\u4ee4\u5728 --clean \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684 \u201c does not exist \u201d \u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 --clean \uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--if-exists"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-comments"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-data"}}, {"summary": "\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c PostgreSQL \u6269\u5c55\uff08\u5982 PostGIS \uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-data-for-failed-tables"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-policies"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-publications"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-schema"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-security-labels"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-statistics"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-subscriptions"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-table-access-method"}}, {"summary": "\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--no-tablespaces"}}, {"summary": "\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a psql \\restrict \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 --file \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c pg_restore \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--restrict-key= restrict_key"}}, {"summary": "\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f pre-data \u3001 data \u6216 post-data \u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--section= sectionname"}}, {"summary": "\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--statistics"}}, {"summary": "\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--statistics-only"}}, {"summary": "\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08 -n / --schema \uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08 -t / --table \uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--strict-names"}}, {"summary": "\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 N \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b --exit-on-error \u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--transaction-size= N"}}, {"summary": "\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 SET SESSION AUTHORIZATION \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 ALTER OWNER \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--use-set-session-authorization"}}, {"summary": "\u663e\u793a\u5173\u4e8e pg_restore \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-? --help"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGHOST \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-h host --host= host"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea PGPORT \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-p port --port= port"}}, {"summary": "\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-U username --username= username"}}, {"summary": "\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 .pgpass \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "-W --password"}}, {"summary": "\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f pg_restore \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa SET ROLE rolename \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 -U \u6307\u5b9a\uff09\u7f3a\u5c11 pg_restore \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002", "signature": {"url": "/docs/18/app-pgrestore.html", "text": "--role= rolename"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "signature": "-a --data-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "signature": "-c --clean", "source_url": "/docs/18/app-pgrestore.html", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "signature": "-C --create", "source_url": "/docs/18/app-pgrestore.html", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/18/app-pgrestore.html", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "signature": "-e --exit-on-error", "source_url": "/docs/18/app-pgrestore.html", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "signature": "-F format --format= format", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "signature": "-I index --index= index", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "signature": "-j number-of-jobs --jobs= number-of-jobs", "source_url": "/docs/18/app-pgrestore.html", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "signature": "-l --list", "source_url": "/docs/18/app-pgrestore.html", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "signature": "-L list-file --use-list= list-file", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "signature": "-n schema --schema= schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "signature": "-N schema --exclude-schema= schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "signature": "-O --no-owner", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "summary": "This option is obsolete but still accepted for backwards compatibility.", "signature": "-R --no-reconnect", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "signature": "-s --schema-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "signature": "-S username --superuser= username", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "signature": "-t table --table= table", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "signature": "-T trigger --trigger= trigger", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "signature": "-v --verbose", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "summary": "Print the pg_restore version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-pgrestore.html", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent restoration of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/18/app-pgrestore.html", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "signature": "-1 --single-transaction", "source_url": "/docs/18/app-pgrestore.html", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "signature": "--disable-triggers", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "signature": "--enable-row-security", "source_url": "/docs/18/app-pgrestore.html", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "signature": "--filter= filename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/18/app-pgrestore.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "summary": "Do not output commands to restore comments, even if the archive contains them.", "signature": "--no-comments", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "summary": "Do not output commands to restore data, even if the archive contains them.", "signature": "--no-data", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "signature": "--no-data-for-failed-tables", "source_url": "/docs/18/app-pgrestore.html", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "summary": "Do not output commands to restore row security policies, even if the archive contains them.", "signature": "--no-policies", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "summary": "Do not output commands to restore publications, even if the archive contains them.", "signature": "--no-publications", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "signature": "--no-schema", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "summary": "Do not output commands to restore security labels, even if the archive contains them.", "signature": "--no-security-labels", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "summary": "Do not output commands to restore statistics, even if the archive contains them.", "signature": "--no-statistics", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "signature": "--no-subscriptions", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "signature": "--no-table-access-method", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "signature": "--no-tablespaces", "source_url": "/docs/18/app-pgrestore.html", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "signature": "--restrict-key= restrict_key", "source_url": "/docs/18/app-pgrestore.html", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "signature": "--section= sectionname", "source_url": "/docs/18/app-pgrestore.html", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "signature": "--statistics", "source_url": "/docs/18/app-pgrestore.html", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "summary": "Restore only the statistics, not schema (data definitions) or data.", "signature": "--statistics-only", "source_url": "/docs/18/app-pgrestore.html", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "signature": "--strict-names", "source_url": "/docs/18/app-pgrestore.html", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "signature": "--transaction-size= N", "source_url": "/docs/18/app-pgrestore.html", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "signature": "--use-set-session-authorization", "source_url": "/docs/18/app-pgrestore.html", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "summary": "Show help about pg_restore command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-pgrestore.html", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "signature": "-h host --host= host", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "signature": "-p port --port= port", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pgrestore.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-pgrestore.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "summary": "Force pg_restore to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/18/app-pgrestore.html", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "signature": "--role= rolename", "source_url": "/docs/18/app-pgrestore.html", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgrestore.html", "file": "app-pgrestore.html", "label": "18.6 English manual \u00b7 app-pgrestore.html", "anchor": "", "sha256": "ac4df6d64f46809a487e98597ad3d3f69abc33de7cd5e5c1537563e2b6d9b5fa", "language": "en", "original_url": "/docs/18/app-pgrestore.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "signature": "pg_restore [ connection-option ...] [ option ...] [ filename ]", "description": ["pg_restore \u2014 \u4ece\u7531 pg_dump \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d PostgreSQL \u6570\u636e\u5e93"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESTORE\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_restore</span></span></h2>\n<p lang=\"zh\">pg_restore \u2014 \u4ece\u7531 <span class=\"application\">pg_dump</span> \u521b\u5efa\u7684\u5f52\u6863\u6587\u4ef6\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">pg_restore</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>filename</code></em>]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DESCRIPTION\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u662f\u4e00\u4e2a\u7528\u4e8e\u4ece<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u4ee5\u975e\u7eaf\u6587\u672c\u683c\u5f0f\u521b\u5efa\u7684\u5f52\u6863\u4e2d\u6062\u590d <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u7684\u5de5\u5177\u3002\u5b83\u4f1a\u53d1\u51fa\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u5c06\u6570\u636e\u5e93\u91cd\u5efa\u4e3a\u4fdd\u5b58\u65f6\u7684\u72b6\u6001\u3002\u5f52\u6863\u6587\u4ef6\u8fd8\u5141\u8bb8 <span class=\"application\">pg_restore</span> \u6709\u9009\u62e9\u5730\u6062\u590d\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u751a\u81f3\u5728\u6062\u590d\u524d\u91cd\u65b0\u6392\u5217\u5404\u9879\u7684\u987a\u5e8f\u3002\u5f52\u6863\u6587\u4ef6\u88ab\u8bbe\u8ba1\u4e3a\u53ef\u8de8\u4f53\u7cfb\u7ed3\u6784\u79fb\u690d\u3002</p>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u53ef\u4ee5\u4ee5\u4e24\u79cd\u6a21\u5f0f\u8fd0\u884c\u3002\u5982\u679c\u6307\u5b9a\u4e86\u6570\u636e\u5e93\u540d\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4f1a\u8fde\u63a5\u5230\u8be5\u6570\u636e\u5e93\uff0c\u5e76\u5c06\u5f52\u6863\u5185\u5bb9\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\u3002\u5426\u5219\uff0c\u5b83\u4f1a\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u91cd\u5efa\u6570\u636e\u5e93\u6240\u9700\u7684 SQL \u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u6216\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u79cd\u811a\u672c\u8f93\u51fa\u7b49\u4ef7\u4e8e <span class=\"application\">pg_dump</span> \u7684\u7eaf\u6587\u672c\u8f93\u51fa\u683c\u5f0f\u3002\u56e0\u6b64\uff0c\u4e00\u4e9b\u63a7\u5236\u8f93\u51fa\u7684\u9009\u9879\u4e0e <span class=\"application\">pg_dump</span> \u7684\u9009\u9879\u76f8\u5bf9\u5e94\u3002</p>\n<p lang=\"zh\">\u663e\u7136\uff0c<span class=\"application\">pg_restore</span> \u65e0\u6cd5\u6062\u590d\u5f52\u6863\u6587\u4ef6\u4e2d\u4e0d\u5b58\u5728\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5f52\u6863\u662f\u4f7f\u7528<span class=\"quote\">\u201c<span class=\"quote\">\u5c06\u6570\u636e\u8f6c\u50a8\u4e3a <code class=\"command\">INSERT</code> \u547d\u4ee4</span>\u201d</span>\u9009\u9879\u751f\u6210\u7684\uff0c<span class=\"application\">pg_restore</span> \u5c31\u4e0d\u80fd\u4f7f\u7528 <code class=\"command\">COPY</code> \u8bed\u53e5\u88c5\u8f7d\u6570\u636e\u3002</p>\n<div class=\"warning\">\n<h3 class=\"title\" lang=\"zh\">\u8b66\u544a</h3>\n<p lang=\"zh\">\u6062\u590d\u8f6c\u50a8\u4f1a\u5bfc\u81f4\u76ee\u6807\u7aef\u6267\u884c\u7531\u6e90\u8d85\u7ea7\u7528\u6237\u9009\u62e9\u7684\u4efb\u610f\u4ee3\u7801\u3002\u90e8\u5206\u8f6c\u50a8\u548c\u90e8\u5206\u6062\u590d\u5e76\u4e0d\u4f1a\u9650\u5236\u8fd9\u4e00\u70b9\u3002\u5982\u679c\u6e90\u8d85\u7ea7\u7528\u6237\u4e0d\u53ef\u4fe1\uff0c\u5219\u5fc5\u987b\u5728\u6062\u590d\u524d\u68c0\u67e5\u8f6c\u50a8\u5f97\u5230\u7684 SQL \u8bed\u53e5\u3002\u975e\u7eaf\u6587\u672c\u8f6c\u50a8\u53ef\u4ee5\u4f7f\u7528 <span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">--file</code> \u9009\u9879\u8fdb\u884c\u68c0\u67e5\u3002\u6ce8\u610f\uff0c\u8fd0\u884c\u8f6c\u50a8\u548c\u6062\u590d\u7684\u5ba2\u6237\u7aef\u65e0\u9700\u4fe1\u4efb\u6e90\u6216\u76ee\u6807\u8d85\u7ea7\u7528\u6237\u3002</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-OPTIONS\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u63a5\u53d7\u4e0b\u5217\u547d\u4ee4\u884c\u53c2\u6570\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u6062\u590d\u7684\u5f52\u6863\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff08\u5bf9\u4e8e\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u5219\u4e3a\u76ee\u5f55\uff09\u3002\u5982\u679c\u672a\u6307\u5b9a\uff0c\u5219\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6570\u636e\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\uff0c\u5219\u4f1a\u6062\u590d\u8868\u6570\u636e\u3001\u5927\u5bf9\u8c61\u548c\u5e8f\u5217\u503c\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=data</code>\uff0c\u4f46\u51fa\u4e8e\u5386\u53f2\u539f\u56e0\uff0c\u4e24\u8005\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br/></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u6062\u590d\u6570\u636e\u5e93\u5bf9\u8c61\u4e4b\u524d\uff0c\u53d1\u51fa <code class=\"command\">DROP</code> \u547d\u4ee4\u4ee5\u5220\u9664\u5c06\u8981\u6062\u590d\u7684\u6240\u6709\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9002\u7528\u4e8e\u8986\u76d6\u73b0\u6709\u6570\u636e\u5e93\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u5bf9\u8c61\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u62a5\u544a\u53ef\u5ffd\u7565\u7684\u9519\u8bef\u6d88\u606f\uff0c\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--if-exists</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-C</code><br/></span><span class=\"term\"><code class=\"option\">--create</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u5411\u5176\u4e2d\u6062\u590d\u4e4b\u524d\u5148\u521b\u5efa\u6570\u636e\u5e93\u3002\u5982\u679c\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5219\u4f1a\u5728\u8fde\u63a5\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e4b\u524d\u5148\u5220\u9664\u5e76\u91cd\u65b0\u521b\u5efa\u5b83\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528 <code class=\"option\">--create</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u7684\u6ce8\u91ca\uff08\u5982\u679c\u6709\uff09\u4ee5\u53ca\u8be5\u6570\u636e\u5e93\u4e13\u6709\u7684\u4efb\u4f55\u914d\u7f6e\u53d8\u91cf\u8bbe\u7f6e\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u63d0\u5230\u8be5\u6570\u636e\u5e93\u7684 <code class=\"command\">ALTER DATABASE ... SET ...</code> \u548c <code class=\"command\">ALTER ROLE ... IN DATABASE ... SET ...</code> \u547d\u4ee4\u3002\u9664\u975e\u6307\u5b9a\u4e86 <code class=\"option\">--no-acl</code>\uff0c\u8fd8\u4f1a\u6062\u590d\u6570\u636e\u5e93\u672c\u8eab\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u7531 <code class=\"option\">-d</code> \u6307\u5b9a\u7684\u6570\u636e\u5e93\u4ec5\u7528\u4e8e\u53d1\u51fa\u521d\u59cb\u7684 <code class=\"command\">DROP DATABASE</code> \u548c <code class=\"command\">CREATE DATABASE</code> \u547d\u4ee4\u3002\u6240\u6709\u6570\u636e\u90fd\u4f1a\u6062\u590d\u5230\u4ee5\u5f52\u6863\u4e2d\u8bb0\u5f55\u7684\u540d\u79f0\u547d\u540d\u7684\u6570\u636e\u5e93\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fde\u63a5\u5230\u6570\u636e\u5e93 <em class=\"replaceable\"><code>dbname</code></em>\uff0c\u5e76\u76f4\u63a5\u6062\u590d\u5230\u8be5\u6570\u636e\u5e93\u4e2d\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f\u4e00\u4e2a<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--exit-on-error</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5728\u5411\u6570\u636e\u5e93\u53d1\u9001 SQL \u547d\u4ee4\u65f6\u9047\u5230\u9519\u8bef\uff0c\u5219\u9000\u51fa\u3002\u9ed8\u8ba4\u884c\u4e3a\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u5e76\u5728\u6062\u590d\u7ed3\u675f\u65f6\u663e\u793a\u9519\u8bef\u8ba1\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u751f\u6210\u811a\u672c\u7684\u8f93\u51fa\u6587\u4ef6\uff0c\u6216\u8005\u5728\u4e0e <code class=\"option\">-l</code> \u4e00\u8d77\u4f7f\u7528\u65f6\u6307\u5b9a\u5217\u8868\u8f93\u51fa\u6587\u4ef6\u3002\u4f7f\u7528 <code class=\"literal\">-</code> \u8868\u793a <span class=\"systemitem\">stdout</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>format</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--format=<em class=\"replaceable\"><code>format</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u5f52\u6863\u683c\u5f0f\u3002\u4e0d\u5fc5\u6307\u5b9a\u683c\u5f0f\uff0c\u56e0\u4e3a <span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u786e\u5b9a\u683c\u5f0f\u3002\u5982\u679c\u6307\u5b9a\uff0c\u53ef\u4ee5\u662f\u4ee5\u4e0b\u683c\u5f0f\u4e4b\u4e00\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">c</code><br/></span><span class=\"term\"><code class=\"literal\">custom</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u91c7\u7528 <span class=\"application\">pg_dump</span> \u7684\u81ea\u5b9a\u4e49\u683c\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">d</code><br/></span><span class=\"term\"><code class=\"literal\">directory</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">t</code><br/></span><span class=\"term\"><code class=\"literal\">tar</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f52\u6863\u662f <code class=\"command\">tar</code> \u5f52\u6863\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-I <em class=\"replaceable\"><code>index</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--index=<em class=\"replaceable\"><code>index</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u7d22\u5f15\u7684\u5b9a\u4e49\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-I</code> \u6765\u6062\u590d\u591a\u4e2a\u7d22\u5f15\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-j <em class=\"replaceable\"><code>number-of-jobs</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--jobs=<em class=\"replaceable\"><code>number-of-jobs</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06 <span class=\"application\">pg_restore</span> \u4e2d\u6700\u8017\u65f6\u7684\u6b65\u9aa4\uff0c\u4e5f\u5c31\u662f\u88c5\u8f7d\u6570\u636e\u3001\u521b\u5efa\u7d22\u5f15\u6216\u521b\u5efa\u7ea6\u675f\uff0c\u6700\u591a\u4f7f\u7528 <em class=\"replaceable\"><code>number-of-jobs</code></em> \u4e2a\u5e76\u53d1\u4f1a\u8bdd\u5e76\u884c\u6267\u884c\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u663e\u8457\u7f29\u77ed\u5c06\u5927\u578b\u6570\u636e\u5e93\u6062\u590d\u5230\u8fd0\u884c\u5728\u591a\u5904\u7406\u5668\u673a\u5668\u4e0a\u7684\u670d\u52a1\u5668\u6240\u9700\u7684\u65f6\u95f4\u3002\u5f53\u751f\u6210\u811a\u672c\u800c\u4e0d\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u6570\u636e\u5e93\u670d\u52a1\u5668\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u4f5c\u4e1a\u90fd\u662f\u4e00\u4e2a\u8fdb\u7a0b\u6216\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684\u72ec\u7acb\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u7684\u6700\u4f73\u53d6\u503c\u53d6\u51b3\u4e8e\u670d\u52a1\u5668\u3001\u5ba2\u6237\u7aef\u548c\u7f51\u7edc\u7684\u786c\u4ef6\u914d\u7f6e\u3002\u5f71\u54cd\u56e0\u7d20\u5305\u62ec CPU \u6838\u5fc3\u6570\u548c\u78c1\u76d8\u914d\u7f6e\u3002\u4e00\u4e2a\u8f83\u597d\u7684\u8d77\u70b9\u662f\u670d\u52a1\u5668\u4e0a\u7684 CPU \u6838\u5fc3\u6570\uff0c\u4f46\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684\u503c\u4e5f\u53ef\u80fd\u5e26\u6765\u66f4\u5feb\u7684\u6062\u590d\u901f\u5ea6\u3002\u5f53\u7136\uff0c\u53d6\u503c\u8fc7\u9ad8\u4f1a\u56e0\u4e3a\u9891\u7e41\u4e89\u7528\u800c\u5bfc\u81f4\u6027\u80fd\u4e0b\u964d\u3002</p>\n<p lang=\"zh\">\u53ea\u6709\u81ea\u5b9a\u4e49\u683c\u5f0f\u548c\u76ee\u5f55\u683c\u5f0f\u5f52\u6863\u652f\u6301\u6b64\u9009\u9879\u3002\u8f93\u5165\u5fc5\u987b\u662f\u5e38\u89c4\u6587\u4ef6\u6216\u76ee\u5f55\uff08\u4f8b\u5982\u4e0d\u80fd\u662f\u7ba1\u9053\u6216\u6807\u51c6\u8f93\u5165\uff09\u3002\u53e6\u5916\uff0c\u591a\u4e2a\u4f5c\u4e1a\u4e0d\u80fd\u4e0e <code class=\"option\">--single-transaction</code> \u9009\u9879\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5f52\u6863\u7684\u76ee\u5f55\u3002\u6b64\u64cd\u4f5c\u7684\u8f93\u51fa\u53ef\u7528\u4f5c -L \u9009\u9879\u7684\u8f93\u5165\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -l \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u9650\u5236\u6240\u5217\u51fa\u7684\u9879\u76ee\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>list-file</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--use-list=<em class=\"replaceable\"><code>list-file</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53ea\u6062\u590d list-file \u4e2d\u5217\u51fa\u7684\u5f52\u6863\u5143\u7d20\uff0c\u5e76\u6309\u7167\u5b83\u4eec\u5728\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u987a\u5e8f\u6062\u590d\u3002\u6ce8\u610f\uff0c\u5982\u679c\u5c06 -n \u6216 -t \u7b49\u7b5b\u9009\u9009\u9879\u4e0e -L \u4e00\u8d77\u4f7f\u7528\uff0c\u5b83\u4eec\u4f1a\u8fdb\u4e00\u6b65\u9650\u5236\u6240\u6062\u590d\u7684\u9879\u76ee\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>list-file</code></em> \u901a\u5e38\u662f\u901a\u8fc7\u7f16\u8f91\u5148\u524d <code class=\"option\">-l</code> \u64cd\u4f5c\u7684\u8f93\u51fa\u6765\u521b\u5efa\u7684\u3002\u53ef\u4ee5\u79fb\u52a8\u6216\u5220\u9664\u884c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u5728\u884c\u9996\u653e\u7f6e\u5206\u53f7\uff08<code class=\"literal\">;</code>\uff09\u5c06\u5176\u6ce8\u91ca\u6389\u3002\u793a\u4f8b\u89c1\u4e0b\u6587\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-n</code> \u6765\u6307\u5b9a\u591a\u4e2a\u6a21\u5f0f\u3002\u8fd9\u53ef\u4ee5\u4e0e <code class=\"option\">-t</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u53ea\u6062\u590d\u7279\u5b9a\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-N <em class=\"replaceable\"><code>schema</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--exclude-schema=<em class=\"replaceable\"><code>schema</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u4f4d\u4e8e\u6307\u5b9a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-N</code> \u6765\u6392\u9664\u591a\u4e2a\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5f53\u5bf9\u540c\u4e00\u6a21\u5f0f\u540d\u540c\u65f6\u7ed9\u51fa <code class=\"option\">-n</code> \u548c <code class=\"option\">-N</code> \u65f6\uff0c<code class=\"option\">-N</code> \u4f18\u5148\uff0c\u8be5\u6a21\u5f0f\u4f1a\u88ab\u6392\u9664\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br/></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u8bbe\u7f6e\u5bf9\u8c61\u6240\u6709\u6743\u4ee5\u5339\u914d\u539f\u59cb\u6570\u636e\u5e93\u7684\u547d\u4ee4\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u53d1\u51fa <code class=\"command\">ALTER OWNER</code> \u6216 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u8bed\u53e5\uff0c\u4e3a\u6240\u521b\u5efa\u7684\u6a21\u5f0f\u5143\u7d20\u8bbe\u7f6e\u6240\u6709\u6743\u3002\u9664\u975e\u5bf9\u6570\u636e\u5e93\u7684\u521d\u59cb\u8fde\u63a5\u7531\u8d85\u7ea7\u7528\u6237\u53d1\u8d77\uff08\u6216\u8005\u7531\u811a\u672c\u4e2d\u6240\u6709\u5bf9\u8c61\u7684\u540c\u4e00\u6240\u6709\u8005\u53d1\u8d77\uff09\uff0c\u5426\u5219\u8fd9\u4e9b\u8bed\u53e5\u4f1a\u5931\u8d25\u3002\u4f7f\u7528 <code class=\"option\">-O</code> \u65f6\uff0c\u521d\u59cb\u8fde\u63a5\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f\u7528\u6237\u540d\uff0c\u5e76\u4e14\u8be5\u7528\u6237\u5c06\u62e5\u6709\u6240\u6709\u521b\u5efa\u7684\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--function=<em class=\"replaceable\"><code>function-name(argtype [, ...])</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u51fd\u6570\u3002\u8bf7\u52a1\u5fc5\u6309\u8f6c\u50a8\u6587\u4ef6\u76ee\u5f55\u4e2d\u663e\u793a\u7684\u5f62\u5f0f\u51c6\u786e\u62fc\u5199\u51fd\u6570\u540d\u548c\u53c2\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-P</code> \u6765\u6062\u590d\u591a\u4e2a\u51fd\u6570\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R</code><br/></span><span class=\"term\"><code class=\"option\">--no-reconnect</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u9009\u9879\u5df2\u7ecf\u8fc7\u65f6\uff0c\u4f46\u4ecd\u7136\u88ab\u63a5\u53d7\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\uff0c\u4e0d\u6062\u590d\u6570\u636e\uff0c\u524d\u63d0\u662f\u5f52\u6863\u4e2d\u5b58\u5728\u6a21\u5f0f\u6761\u76ee\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e0d\u80fd\u4e0e <code class=\"option\">--data-only</code> \u6216 <code class=\"option\">--statistics-only</code> \u4e00\u8d77\u4f7f\u7528\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6307\u5b9a <code class=\"option\">--section=pre-data --section=post-data --no-statistics</code>\uff0c\u4f46\u7531\u4e8e\u5386\u53f2\u539f\u56e0\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002</p>\n<p lang=\"zh\">\uff08\u4e0d\u8981\u628a\u5b83\u4e0e <code class=\"option\">--schema</code> \u9009\u9879\u6df7\u6dc6\uff0c\u540e\u8005\u4e2d\u7684<span class=\"quote\">\u201c<span class=\"quote\">schema</span>\u201d</span>\u4e00\u8bcd\u542b\u4e49\u4e0d\u540c\u3002\uff09</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728\u7981\u7528\u89e6\u53d1\u5668\u65f6\u8981\u4f7f\u7528\u7684\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\u3002\u4ec5\u5f53\u4f7f\u7528 <code class=\"option\">--disable-triggers</code> \u65f6\u624d\u76f8\u5173\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t <em class=\"replaceable\"><code>table</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table=<em class=\"replaceable\"><code>table</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u8868\u7684\u5b9a\u4e49\u548c/\u6216\u6570\u636e\u3002\u8fd9\u91cc\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8868</span>\u201d</span>\u5305\u62ec\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-t</code> \u6765\u9009\u62e9\u591a\u4e2a\u8868\u3002\u6b64\u9009\u9879\u53ef\u4ee5\u4e0e <code class=\"option\">-n</code> \u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u6307\u5b9a\u7279\u5b9a\u6a21\u5f0f\u4e2d\u7684\u8868\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5f53\u6307\u5b9a <code class=\"option\">-t</code> \u65f6\uff0c<span class=\"application\">pg_restore</span> \u4e0d\u4f1a\u5c1d\u8bd5\u6062\u590d\u6240\u9009\u8868\u53ef\u80fd\u4f9d\u8d56\u7684\u4efb\u4f55\u5176\u4ed6\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u56e0\u6b64\uff0c\u4e0d\u80fd\u4fdd\u8bc1\u5c06\u7279\u5b9a\u8868\u6062\u590d\u5230\u4e00\u4e2a\u7a7a\u6570\u636e\u5e93\u4e2d\u4e00\u5b9a\u4f1a\u6210\u529f\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u6b64\u6807\u5fd7\u4e0e <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<span class=\"application\">pg_restore</span> \u76ee\u524d\u4e0d\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\uff0c\u4e5f\u4e0d\u80fd\u5728\u5176 <code class=\"option\">-t</code> \u4e2d\u5305\u542b\u6a21\u5f0f\u540d\u3002\u800c\u4e14\uff0c\u867d\u7136 <span class=\"application\">pg_dump</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u4e5f\u4f1a\u8f6c\u50a8\u6240\u9009\u8868\u7684\u9644\u5c5e\u5bf9\u8c61\uff08\u4f8b\u5982\u7d22\u5f15\uff09\uff0c<span class=\"application\">pg_restore</span> \u7684 <code class=\"option\">-t</code> \u6807\u5fd7\u5e76\u4e0d\u5305\u62ec\u8fd9\u4e9b\u9644\u5c5e\u5bf9\u8c61\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u6b64\u6807\u5fd7\u53ea\u5339\u914d\u8868\uff0c\u4e0d\u5339\u914d\u5176\u4ed6\u4efb\u4f55\u7c7b\u578b\u7684\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>trigger</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--trigger=<em class=\"replaceable\"><code>trigger</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u6307\u5b9a\u540d\u79f0\u7684\u89e6\u53d1\u5668\u3002\u53ef\u4ee5\u901a\u8fc7\u591a\u6b21\u6307\u5b9a <code class=\"option\">-T</code> \u6765\u6062\u590d\u591a\u4e2a\u89e6\u53d1\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br/></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8be6\u7ec6\u6a21\u5f0f\u3002\u8fd9\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5c06\u8be6\u7ec6\u7684\u5bf9\u8c61\u6ce8\u91ca\u548c\u5f00\u59cb/\u505c\u6b62\u65f6\u95f4\u8f93\u51fa\u5230\u8f93\u51fa\u6587\u4ef6\uff0c\u5e76\u5c06\u8fdb\u5ea6\u6d88\u606f\u8f93\u51fa\u5230\u6807\u51c6\u9519\u8bef\u3002\u91cd\u590d\u6b64\u9009\u9879\u4f1a\u4f7f\u6807\u51c6\u9519\u8bef\u4e2d\u51fa\u73b0\u989d\u5916\u7684\u8c03\u8bd5\u7ea7\u6d88\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370 <span class=\"application\">pg_restore</span> \u7684\u7248\u672c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br/></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u6062\u590d\u8bbf\u95ee\u6743\u9650\uff08grant/revoke \u547d\u4ee4\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u6062\u590d\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff08\u4e5f\u5c31\u662f\u628a\u53d1\u51fa\u7684\u547d\u4ee4\u5305\u88f9\u5728 <code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code> \u4e2d\uff09\u3002\u8fd9\u53ef\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6267\u884c\u4e0d\u5305\u542b\u6a21\u5f0f\u7684\u6062\u590d\u65f6\u624d\u76f8\u5173\u3002\u5b83\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u53d1\u51fa\u547d\u4ee4\uff0c\u4e34\u65f6\u7981\u7528\u76ee\u6807\u8868\u4e0a\u7684\u89e6\u53d1\u5668\u3002\u5982\u679c\u4f60\u4e0d\u5e0c\u671b\u5728\u6062\u590d\u6570\u636e\u671f\u95f4\u89e6\u53d1\u8868\u4e0a\u7684\u5f15\u7528\u5b8c\u6574\u6027\u68c0\u67e5\u6216\u5176\u4ed6\u89e6\u53d1\u5668\uff0c\u8bf7\u4f7f\u7528\u6b64\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u76ee\u524d\uff0c\u4e3a <code class=\"option\">--disable-triggers</code> \u53d1\u51fa\u7684\u547d\u4ee4\u5fc5\u987b\u4ee5\u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u6267\u884c\u3002\u56e0\u6b64\uff0c\u4f60\u8fd8\u5e94\u901a\u8fc7 <code class=\"option\">-S</code> \u6307\u5b9a\u8d85\u7ea7\u7528\u6237\u7528\u6237\u540d\uff0c\u6216\u8005\u66f4\u597d\u7684\u662f\uff0c\u76f4\u63a5\u4ee5 <span class=\"productname\">PostgreSQL</span> \u8d85\u7ea7\u7528\u6237\u8eab\u4efd\u8fd0\u884c <span class=\"application\">pg_restore</span>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--enable-row-security</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u6062\u590d\u542f\u7528\u4e86\u884c\u5b89\u5168\u6027\u7684\u8868\u5185\u5bb9\u65f6\u624d\u76f8\u5173\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a off\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u6570\u636e\u90fd\u80fd\u6062\u590d\u5230\u8868\u4e2d\u3002\u5982\u679c\u7528\u6237\u6ca1\u6709\u8db3\u591f\u7684\u6743\u9650\u7ed5\u8fc7\u884c\u5b89\u5168\u6027\uff0c\u5c31\u4f1a\u629b\u51fa\u9519\u8bef\u3002\u6b64\u53c2\u6570\u4f1a\u6307\u793a <span class=\"application\">pg_restore</span> \u6539\u4e3a\u5c06<a class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\">row_security</a>\u8bbe\u7f6e\u4e3a on\uff0c\u4ece\u800c\u5141\u8bb8\u7528\u6237\u5c1d\u8bd5\u5728\u542f\u7528\u884c\u5b89\u5168\u6027\u7684\u60c5\u51b5\u4e0b\u6062\u590d\u8868\u5185\u5bb9\u3002\u5982\u679c\u7528\u6237\u65e0\u6743\u5c06\u8f6c\u50a8\u4e2d\u7684\u884c\u63d2\u5165\u8be5\u8868\uff0c\u8fd9\u4ecd\u7136\u53ef\u80fd\u5931\u8d25\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u9009\u9879\u5f53\u524d\u8fd8\u8981\u6c42\u8f6c\u50a8\u91c7\u7528 <code class=\"command\">INSERT</code> \u683c\u5f0f\uff0c\u56e0\u4e3a <code class=\"command\">COPY FROM</code> \u4e0d\u652f\u6301\u884c\u5b89\u5168\u6027\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4ece\u4e2d\u8bfb\u53d6\u6062\u590d\u65f6\u8981\u6392\u9664\u6216\u5305\u542b\u7684\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u3002\u8fd9\u4e9b\u6a21\u5f0f\u6309\u7167\u4e0e\u4e0b\u5217\u9009\u9879\u76f8\u540c\u7684\u89c4\u5219\u89e3\u91ca\uff1a<code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u7528\u4e8e\u5305\u542b\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u7528\u4e8e\u6392\u9664\u67d0\u4e2a\u6a21\u5f0f\u4e2d\u7684\u5bf9\u8c61\uff0c<code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u51fd\u6570\uff0c<code class=\"option\">-I</code>/<code class=\"option\">--index</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u7d22\u5f15\uff0c<code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u7528\u4e8e\u6062\u590d\u6307\u5b9a\u8868\uff0c\u4ee5\u53ca <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u7528\u4e8e\u6062\u590d\u89e6\u53d1\u5668\u3002\u8981\u4ece <code class=\"literal\">STDIN</code> \u8bfb\u53d6\uff0c\u8bf7\u4f7f\u7528 <code class=\"filename\">-</code> \u4f5c\u4e3a\u6587\u4ef6\u540d\u3002<code class=\"option\">--filter</code> \u9009\u9879\u53ef\u4ee5\u4e0e\u4e0a\u9762\u5217\u51fa\u7684\u5305\u542b\u6216\u6392\u9664\u5bf9\u8c61\u7684\u9009\u9879\u7ed3\u5408\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u4e3a\u4e86\u6307\u5b9a\u591a\u4e2a\u8fc7\u6ee4\u6587\u4ef6\u800c\u591a\u6b21\u7ed9\u51fa\u3002</p>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u6bcf\u884c\u5217\u51fa\u4e00\u4e2a\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a</p>\n<pre class=\"synopsis\">{ include | exclude } { function | index | schema | table | trigger } <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u662f\u5305\u542b\u8fd8\u662f\u6392\u9664\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u7b2c\u4e8c\u4e2a\u5173\u952e\u5b57\u6307\u5b9a\u8981\u7528\u8be5\u6a21\u5f0f\u8fc7\u6ee4\u7684\u5bf9\u8c61\u7c7b\u578b\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">function</code>\uff1a\u51fd\u6570\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-P</code>/<code class=\"option\">--function</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">index\uff1a\u7d22\u5f15\uff0c\u4f5c\u7528\u4e0e -I/--indexes \u9009\u9879\u76f8\u540c\u3002\u6b64\u5173\u952e\u5b57\u53ea\u80fd\u4e0e include \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">schema</code>\uff1a\u6a21\u5f0f\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-n</code>/<code class=\"option\">--schema</code> \u548c <code class=\"option\">-N</code>/<code class=\"option\">--exclude-schema</code> \u9009\u9879\u76f8\u540c\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">table</code>\uff1a\u8868\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-t</code>/<code class=\"option\">--table</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><code class=\"literal\">trigger</code>\uff1a\u89e6\u53d1\u5668\uff0c\u4f5c\u7528\u4e0e <code class=\"option\">-T</code>/<code class=\"option\">--trigger</code> \u9009\u9879\u76f8\u540c\u3002\u8be5\u5173\u952e\u5b57\u53ea\u80fd\u4e0e <code class=\"literal\">include</code> \u5173\u952e\u5b57\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u4ee5 <code class=\"literal\">#</code> \u5f00\u5934\u7684\u884c\u88ab\u89c6\u4e3a\u6ce8\u91ca\u5e76\u5ffd\u7565\u3002\u6ce8\u91ca\u4e5f\u53ef\u4ee5\u653e\u5728\u5bf9\u8c61\u5339\u914d\u6a21\u5f0f\u884c\u4e4b\u540e\u3002\u7a7a\u767d\u884c\u540c\u6837\u4f1a\u88ab\u5ffd\u7565\u3002\u6709\u5173\u5982\u4f55\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u52a0\u5f15\u53f7\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528 <code class=\"literal\">DROP ... IF EXISTS</code> \u547d\u4ee4\u5728 <code class=\"option\">--clean</code> \u6a21\u5f0f\u4e0b\u5220\u9664\u5bf9\u8c61\u3002\u8fd9\u4f1a\u6291\u5236\u539f\u672c\u53ef\u80fd\u62a5\u544a\u7684<span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span>\u9519\u8bef\u4fe1\u606f\u3002\u9664\u975e\u540c\u65f6\u6307\u5b9a\u4e86 <code class=\"option\">--clean</code>\uff0c\u5426\u5219\u6b64\u9009\u9879\u65e0\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6ce8\u91ca\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6570\u636e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data-for-failed-tables</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8868\u7684\u521b\u5efa\u547d\u4ee4\u5931\u8d25\uff08\u4f8b\u5982\u56e0\u4e3a\u8868\u5df2\u7ecf\u5b58\u5728\uff09\uff0c\u8868\u6570\u636e\u4ecd\u7136\u4f1a\u88ab\u6062\u590d\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u8fd9\u7c7b\u8868\u7684\u6570\u636e\u4f1a\u88ab\u8df3\u8fc7\u3002\u5982\u679c\u76ee\u6807\u6570\u636e\u5e93\u5df2\u7ecf\u5305\u542b\u6240\u9700\u7684\u8868\u5185\u5bb9\uff0c\u8fd9\u79cd\u884c\u4e3a\u4f1a\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c<span class=\"productname\">PostgreSQL</span> \u6269\u5c55\uff08\u5982 <span class=\"productname\">PostGIS</span>\uff09\u7684\u8f85\u52a9\u8868\u53ef\u80fd\u5df2\u7ecf\u88c5\u8f7d\u5230\u76ee\u6807\u6570\u636e\u5e93\u4e2d\uff1b\u6307\u5b9a\u6b64\u9009\u9879\u53ef\u4ee5\u9632\u6b62\u5411\u8fd9\u4e9b\u8868\u88c5\u8f7d\u91cd\u590d\u6216\u8fc7\u65f6\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4ec5\u5728\u76f4\u63a5\u6062\u590d\u5230\u6570\u636e\u5e93\u65f6\u6709\u6548\uff0c\u800c\u5728\u751f\u6210 SQL \u811a\u672c\u8f93\u51fa\u65f6\u65e0\u6548\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u884c\u5b89\u5168\u6027\u7b56\u7565\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u53d1\u5e03\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u5b89\u5168\u6807\u7b7e\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u8ba2\u9605\u7684\u547d\u4ee4\uff0c\u5373\u4f7f\u5f52\u6863\u4e2d\u5305\u542b\u5b83\u4eec\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u8bbf\u95ee\u65b9\u6cd5\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u4f7f\u7528\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u8bbf\u95ee\u65b9\u6cd5\u521b\u5efa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8f93\u51fa\u7528\u4e8e\u9009\u62e9\u8868\u7a7a\u95f4\u7684\u547d\u4ee4\u3002\u4f7f\u7528\u6b64\u9009\u9879\u65f6\uff0c\u6240\u6709\u5bf9\u8c61\u5728\u6062\u590d\u65f6\u90fd\u4f1a\u521b\u5efa\u5728\u5f53\u65f6\u9ed8\u8ba4\u7684\u8868\u7a7a\u95f4\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u8f6c\u50a8\u8f93\u51fa\u4e2d\u4f7f\u7528\u63d0\u4f9b\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> \u952e\u3002\u8fd9\u53ea\u80fd\u7528\u4e8e SQL \u811a\u672c\u8f93\u51fa\uff0c\u4e5f\u5c31\u662f\u4f7f\u7528 <code class=\"option\">--file</code> \u9009\u9879\u65f6\u3002\u5982\u679c\u672a\u6307\u5b9a\u8be5\u952e\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6309\u9700\u968f\u673a\u751f\u6210\u4e00\u4e2a\u3002\u952e\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u4ee5\u53ca\u5176\u4ed6\u9700\u8981\u53ef\u91cd\u590d\u8f93\u51fa\u7684\u573a\u666f\uff08\u4f8b\u5982\u6bd4\u8f83\u8f6c\u50a8\u6587\u4ef6\uff09\u3002\u4e00\u822c\u4e0d\u5efa\u8bae\u4f7f\u7528\u5b83\uff0c\u56e0\u4e3a\u82e5\u6076\u610f\u670d\u52a1\u5668\u4e8b\u5148\u77e5\u9053\u8be5\u952e\uff0c\u53ef\u80fd\u80fd\u591f\u6ce8\u5165\u4efb\u610f\u4ee3\u7801\uff0c\u5e76\u5728\u8fd0\u884c <span class=\"application\">psql</span> \u5904\u7406\u8f6c\u50a8\u8f93\u51fa\u7684\u673a\u5668\u4e0a\u6267\u884c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--section=<em class=\"replaceable\"><code>sectionname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ec5\u6062\u590d\u6307\u5b9a\u90e8\u5206\u3002\u90e8\u5206\u540d\u79f0\u53ef\u4ee5\u662f <code class=\"option\">pre-data</code>\u3001<code class=\"option\">data</code> \u6216 <code class=\"option\">post-data</code>\u3002\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u6b64\u9009\u9879\u6765\u9009\u62e9\u591a\u4e2a\u90e8\u5206\u3002\u9ed8\u8ba4\u662f\u6062\u590d\u6240\u6709\u90e8\u5206\u3002</p>\n<p lang=\"zh\">\u6570\u636e\u90e8\u5206\u5305\u542b\u5b9e\u9645\u7684\u8868\u6570\u636e\u4ee5\u53ca\u5927\u5bf9\u8c61\u5b9a\u4e49\u3002post-data \u90e8\u5206\u7531\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u3001\u89c4\u5219\u4ee5\u53ca\u9664\u5df2\u9a8c\u8bc1\u68c0\u67e5\u7ea6\u675f\u4e4b\u5916\u7684\u7ea6\u675f\u5b9a\u4e49\u7ec4\u6210\u3002pre-data \u90e8\u5206\u5219\u7531\u6240\u6709\u5176\u4ed6\u6570\u636e\u5b9a\u4e49\u9879\u7ec4\u6210\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u7edf\u8ba1\u4fe1\u606f\uff0c\u5219\u8f93\u51fa\u7528\u4e8e\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\u7684\u547d\u4ee4\u3002\u8fd9\u662f\u9ed8\u8ba4\u884c\u4e3a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ec5\u6062\u590d\u7edf\u8ba1\u4fe1\u606f\uff0c\u4e0d\u6062\u590d\u6a21\u5f0f\uff08\u6570\u636e\u5b9a\u4e49\uff09\u6216\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--strict-names</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8981\u6c42\u6bcf\u4e2a\u6a21\u5f0f\u9650\u5b9a\u7b26\uff08<code class=\"option\">-n</code>/<code class=\"option\">--schema</code>\uff09\u548c\u8868\u9650\u5b9a\u7b26\uff08<code class=\"option\">-t</code>/<code class=\"option\">--table</code>\uff09\u81f3\u5c11\u5339\u914d\u5f85\u6062\u590d\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f/\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--transaction-size=<em class=\"replaceable\"><code>N</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6062\u590d\u4f5c\u4e3a\u4e00\u7cfb\u5217\u4e8b\u52a1\u6267\u884c\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u6700\u591a\u5904\u7406 <em class=\"replaceable\"><code>N</code></em> \u4e2a\u6570\u636e\u5e93\u5bf9\u8c61\u3002\u6b64\u9009\u9879\u9690\u542b <code class=\"option\">--exit-on-error</code>\u3002</p>\n<p lang=\"zh\"><code class=\"option\">--transaction-size</code> \u5728\u9ed8\u8ba4\u884c\u4e3a\uff08\u6bcf\u6761 SQL \u547d\u4ee4\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e0e <code class=\"option\">-1</code>/<code class=\"option\">--single-transaction</code>\uff08\u6240\u6709\u6062\u590d\u5bf9\u8c61\u5171\u7528\u4e00\u4e2a\u4e8b\u52a1\uff09\u4e4b\u95f4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6298\u4e2d\u9009\u62e9\u3002\u867d\u7136 <code class=\"option\">--single-transaction</code> \u7684\u989d\u5916\u5f00\u9500\u6700\u5c0f\uff0c\u4f46\u5bf9\u4e8e\u5927\u578b\u6570\u636e\u5e93\u6765\u8bf4\u53ef\u80fd\u5e76\u4e0d\u73b0\u5b9e\uff0c\u56e0\u4e3a\u8be5\u4e8b\u52a1\u4f1a\u5728\u6bcf\u4e2a\u6062\u590d\u5bf9\u8c61\u4e0a\u83b7\u53d6\u9501\uff0c\u4ece\u800c\u53ef\u80fd\u8017\u5c3d\u670d\u52a1\u5668\u7684\u9501\u8868\u7a7a\u95f4\u3002\u4f7f\u7528 <code class=\"option\">--transaction-size</code> \u5e76\u5c06\u5927\u5c0f\u8bbe\u4e3a\u51e0\u5343\u4e2a\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5728\u9650\u5236\u6240\u9700\u9501\u8868\u7a7a\u95f4\u7684\u540c\u65f6\uff0c\u83b7\u5f97\u51e0\u4e4e\u76f8\u540c\u7684\u6027\u80fd\u6536\u76ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u7b26\u5408 SQL \u6807\u51c6\u7684 <code class=\"command\">SET SESSION AUTHORIZATION</code> \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u4f7f\u7528 <code class=\"command\">ALTER OWNER</code> \u547d\u4ee4\u6765\u786e\u5b9a\u5bf9\u8c61\u6240\u6709\u6743\u3002\u8fd9\u6837\u4f1a\u4f7f\u8f6c\u50a8\u7ed3\u679c\u66f4\u7b26\u5408\u6807\u51c6\uff0c\u4f46\u6839\u636e\u8f6c\u50a8\u4e2d\u5bf9\u8c61\u7684\u5386\u53f2\uff0c\u53ef\u80fd\u65e0\u6cd5\u6b63\u786e\u6062\u590d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5173\u4e8e <span class=\"application\">pg_restore</span> \u547d\u4ee4\u884c\u53c2\u6570\u7684\u5e2e\u52a9\u4fe1\u606f\uff0c\u5e76\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u8fd8\u63a5\u53d7\u4e0b\u5217\u7528\u4e8e\u8fde\u63a5\u53c2\u6570\u7684\u547d\u4ee4\u884c\u53c2\u6570\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGHOST</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u5c1d\u8bd5\u4f7f\u7528 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6b63\u5728\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u6587\u4ef6\u6269\u5c55\u540d\u3002\u9ed8\u8ba4\u503c\u53d6\u81ea <code class=\"envar\">PGPORT</code> \u73af\u5883\u53d8\u91cf\uff08\u5982\u679c\u5df2\u8bbe\u7f6e\uff09\uff0c\u5426\u5219\u4f7f\u7528\u7f16\u8bd1\u65f6\u9ed8\u8ba4\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u4e8e\u8fde\u63a5\u7684\u7528\u6237\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7edd\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u53c8\u65e0\u6cd5\u901a\u8fc7 <code class=\"filename\">.pgpass</code> \u6587\u4ef6\u7b49\u5176\u4ed6\u65b9\u5f0f\u83b7\u5f97\u5bc6\u7801\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u5728\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u7684\u6279\u5904\u7406\u4f5c\u4e1a\u548c\u811a\u672c\u4e2d\uff0c\u6b64\u9009\u9879\u5f88\u6709\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236 <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u6b64\u9009\u9879\u5b9e\u9645\u4e0a\u5e76\u975e\u5fc5\u9700\uff0c\u56e0\u4e3a\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u81ea\u52a8\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\u6765\u53d1\u73b0\u670d\u52a1\u5668\u9700\u8981\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u952e\u5165 <code class=\"option\">-W</code> \u4ee5\u907f\u514d\u8fd9\u4e00\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u662f\u503c\u5f97\u7684\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6267\u884c\u6062\u590d\u65f6\u8981\u4f7f\u7528\u7684\u89d2\u8272\u540d\u3002\u6b64\u9009\u9879\u4f1a\u4f7f <span class=\"application\">pg_restore</span> \u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\u53d1\u51fa <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> \u547d\u4ee4\u3002\u5f53\u5df2\u8ba4\u8bc1\u7528\u6237\uff08\u7531 <code class=\"option\">-U</code> \u6307\u5b9a\uff09\u7f3a\u5c11 <span class=\"application\">pg_restore</span> \u6240\u9700\u7684\u6743\u9650\uff0c\u4f46\u53ef\u4ee5\u5207\u6362\u5230\u5177\u6709\u6240\u9700\u6743\u9650\u7684\u89d2\u8272\u65f6\uff0c\u6b64\u9009\u9879\u4f1a\u5f88\u6709\u7528\u3002\u6709\u4e9b\u5b89\u88c5\u73af\u5883\u7981\u6b62\u76f4\u63a5\u4ee5\u8d85\u7ea7\u7528\u6237\u767b\u5f55\uff0c\u800c\u4f7f\u7528\u6b64\u9009\u9879\u53ef\u4ee5\u5728\u4e0d\u8fdd\u53cd\u8be5\u7b56\u7565\u7684\u60c5\u51b5\u4e0b\u6267\u884c\u6062\u590d\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u8be5\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u4f46\u662f\uff0c\u5f53\u672a\u63d0\u4f9b\u6570\u636e\u5e93\u540d\u65f6\uff0c\u5b83\u4e0d\u4f1a\u8bfb\u53d6 <code class=\"envar\">PGDATABASE</code>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-DIAGNOSTICS\">\n<h2 lang=\"zh\">\u8bca\u65ad</h2>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"option\">-d</code> \u9009\u9879\u6307\u5b9a\u76f4\u63a5\u6570\u636e\u5e93\u8fde\u63a5\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u5185\u90e8\u6267\u884c <acronym class=\"acronym\">SQL</acronym> \u8bed\u53e5\u3002\u5982\u679c\u8fd0\u884c <span class=\"application\">pg_restore</span> \u65f6\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u786e\u4fdd\u4f60\u80fd\u591f\u4f7f\u7528\u4f8b\u5982<a class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a>\u4ece\u8be5\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\u4fe1\u606f\u3002\u6b64\u5916\uff0c<span class=\"application\">libpq</span> \u524d\u7aef\u5e93\u4f7f\u7528\u7684\u4efb\u4f55\u9ed8\u8ba4\u8fde\u63a5\u8bbe\u7f6e\u548c\u73af\u5883\u53d8\u91cf\u4e5f\u90fd\u4f1a\u751f\u6548\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-NOTES\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u5982\u679c\u4f60\u7684\u5b89\u88c5\u5728 <code class=\"literal\">template1</code> \u6570\u636e\u5e93\u4e2d\u6709\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\uff0c\u8bf7\u52a1\u5fc5\u5c06 <span class=\"application\">pg_restore</span> \u7684\u8f93\u51fa\u88c5\u8f7d\u5230\u4e00\u4e2a\u771f\u6b63\u7a7a\u7684\u6570\u636e\u5e93\u4e2d\uff1b\u5426\u5219\u5f88\u53ef\u80fd\u4f1a\u56e0\u4e3a\u8fd9\u4e9b\u9644\u52a0\u5bf9\u8c61\u7684\u91cd\u590d\u5b9a\u4e49\u800c\u62a5\u9519\u3002\u8981\u521b\u5efa\u4e00\u4e2a\u4e0d\u5e26\u4efb\u4f55\u672c\u5730\u6dfb\u52a0\u5185\u5bb9\u7684\u7a7a\u6570\u636e\u5e93\uff0c\u5e94\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u590d\u5236\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">CREATE DATABASE foo WITH TEMPLATE template0;\n</pre>\n<p lang=\"zh\"><span class=\"application\">pg_restore</span> \u7684\u5c40\u9650\u6027\u8be6\u8ff0\u5982\u4e0b\u3002</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5f53\u628a\u6570\u636e\u6062\u590d\u5230\u4e00\u4e2a\u9884\u5148\u5b58\u5728\u7684\u8868\u4e2d\uff0c\u5e76\u4e14\u4f7f\u7528\u4e86 <code class=\"option\">--disable-triggers</code> \u9009\u9879\u65f6\uff0c<span class=\"application\">pg_restore</span> \u4f1a\u5728\u63d2\u5165\u6570\u636e\u524d\u53d1\u51fa\u547d\u4ee4\uff0c\u7981\u7528\u7528\u6237\u8868\u4e0a\u7684\u89e6\u53d1\u5668\uff0c\u7136\u540e\u5728\u6570\u636e\u63d2\u5165\u540e\u518d\u53d1\u51fa\u547d\u4ee4\u91cd\u65b0\u542f\u7528\u5b83\u4eec\u3002\u5982\u679c\u6062\u590d\u5728\u4e2d\u9014\u505c\u6b62\uff0c\u7cfb\u7edf\u76ee\u5f55\u53ef\u80fd\u4f1a\u5904\u4e8e\u9519\u8bef\u72b6\u6001\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">pg_restore</span> \u4e0d\u80fd\u6709\u9009\u62e9\u5730\u6062\u590d\u5927\u5bf9\u8c61\uff1b\u4f8b\u5982\uff0c\u4e0d\u80fd\u53ea\u6062\u590d\u5c5e\u4e8e\u67d0\u4e2a\u7279\u5b9a\u8868\u7684\u5927\u5bf9\u8c61\u3002\u5982\u679c\u5f52\u6863\u4e2d\u5305\u542b\u5927\u5bf9\u8c61\uff0c\u90a3\u4e48\u8981\u4e48\u6240\u6709\u5927\u5bf9\u8c61\u90fd\u4f1a\u88ab\u6062\u590d\uff0c\u8981\u4e48\u5728\u901a\u8fc7 <code class=\"option\">-L</code>\u3001<code class=\"option\">-t</code> \u6216\u5176\u4ed6\u9009\u9879\u6392\u9664\u5b83\u4eec\u65f6\u4e00\u4e2a\u4e5f\u4e0d\u4f1a\u6062\u590d\u3002</p>\n</li>\n</ul>\n</div>\n<p lang=\"zh\">\u5173\u4e8e <span class=\"application\">pg_dump</span> \u7684\u5c40\u9650\u6027\u7684\u7ec6\u8282\u4e5f\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>\u6587\u6863\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u8f6c\u50a8\u6587\u4ef6\u4e2d\u5305\u542b\u4f18\u5316\u5668\u7edf\u8ba1\u4fe1\u606f\uff0c<code class=\"command\">pg_restore</code> \u4f1a\u6062\u590d\u5b83\u4eec\u3002\u5982\u679c\u5e76\u975e\u6240\u6709\u7edf\u8ba1\u4fe1\u606f\u90fd\u5df2\u6062\u590d\uff0c\u90a3\u4e48\u5bf9\u6bcf\u4e2a\u5df2\u6062\u590d\u7684\u8868\u6267\u884c <code class=\"command\">ANALYZE</code> \u53ef\u80fd\u4f1a\u5f88\u6709\u5e2e\u52a9\uff0c\u8fd9\u6837\u4f18\u5316\u5668\u5c31\u80fd\u83b7\u5f97\u6709\u7528\u7684\u7edf\u8ba1\u4fe1\u606f\u3002\u66f4\u591a\u4fe1\u606f\u89c1<a class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3.\u00a0\u66f4\u65b0\u89c4\u5212\u5668\u7edf\u8ba1\u4fe1\u606f\">\u7b2c\u00a024.1.3\u00a0\u8282</a>\u548c<a class=\"xref\" href=\"/docs/18/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6.\u00a0\u81ea\u52a8\u6e05\u7406\u5b88\u62a4\u8fdb\u7a0b\">\u7b2c\u00a024.1.6\u00a0\u8282</a>\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PGRESTORE-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u628a\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">mydb</code> \u7684\u6570\u636e\u5e93\u8f6c\u50a8\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u683c\u5f0f\u8f6c\u50a8\u6587\u4ef6\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dump -Fc mydb &gt; db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u8981\u5220\u9664\u8be5\u6570\u636e\u5e93\u5e76\u4ece\u8f6c\u50a8\u4e2d\u91cd\u65b0\u521b\u5efa\u5b83\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>dropdb mydb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -C -d postgres db.dump</code></strong>\n</pre>\n<p lang=\"zh\">-d \u9009\u9879\u6307\u5b9a\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u662f\u96c6\u7fa4\u4e2d\u4efb\u4f55\u73b0\u6709\u6570\u636e\u5e93\uff1bpg_restore \u4ec5\u7528\u5b83\u6765\u6267\u884c\u4e3a mydb \u521b\u5efa\u6570\u636e\u5e93\u7684 CREATE DATABASE \u547d\u4ee4\u3002\u4f7f\u7528 -C \u65f6\uff0c\u6570\u636e\u59cb\u7ec8\u6062\u590d\u5230\u8f6c\u50a8\u6587\u4ef6\u4e2d\u8bb0\u5f55\u7684\u6570\u636e\u5e93\u540d\u6240\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u8981\u628a\u8be5\u8f6c\u50a8\u6062\u590d\u5230\u4e00\u4e2a\u540d\u4e3a <code class=\"literal\">newdb</code> \u7684\u65b0\u6570\u636e\u5e93\u4e2d\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>createdb -T template0 newdb</code></strong>\n<code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -d newdb db.dump</code></strong>\n</pre>\n<p lang=\"zh\">\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4e0d\u4f7f\u7528 <code class=\"option\">-C</code>\uff0c\u800c\u662f\u76f4\u63a5\u8fde\u63a5\u5230\u8981\u6062\u590d\u5230\u7684\u6570\u636e\u5e93\u3002\u8fd8\u8981\u6ce8\u610f\uff0c\u6211\u4eec\u662f\u4ece <code class=\"literal\">template0</code> \u800c\u4e0d\u662f <code class=\"literal\">template1</code> \u514b\u9686\u8fd9\u4e2a\u65b0\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e00\u5f00\u59cb\u662f\u7a7a\u7684\u3002</p>\n<p lang=\"zh\">\u8981\u91cd\u65b0\u6392\u5217\u6570\u636e\u5e93\u9879\u7684\u987a\u5e8f\uff0c\u9996\u5148\u9700\u8981\u8f6c\u50a8\u5f52\u6863\u7684\u76ee\u5f55\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -l db.dump &gt; db.list</code></strong>\n</pre>\n<p lang=\"zh\">\u5217\u8868\u6587\u4ef6\u7531\u4e00\u4e2a\u5934\u90e8\u548c\u6bcf\u4e2a\u9879\u5404\u5360\u4e00\u884c\u7684\u5185\u5bb9\u7ec4\u6210\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">;\n; Archive created at Mon Sep 14 13:55:39 2009\n;     dbname: DBDEMOS\n;     TOC Entries: 81\n;     Compression: 9\n;     Dump Version: 1.10-0\n;     Format: CUSTOM\n;     Integer: 4 bytes\n;     Offset: 8 bytes\n;     Dumped from database version: 8.3.5\n;     Dumped by pg_dump version: 8.3.8\n;\n;\n; Selected TOC Entries:\n;\n3; 2615 2200 SCHEMA - public pasha\n1861; 0 0 COMMENT - SCHEMA public pasha\n1862; 0 0 ACL - public pasha\n317; 1247 17715 TYPE public composite pasha\n319; 1247 25899 DOMAIN public domain0 pasha\n</pre>\n<p lang=\"zh\">\u5206\u53f7\u8868\u793a\u4e00\u6761\u6ce8\u91ca\u7684\u5f00\u59cb\uff0c\u800c\u884c\u9996\u7684\u6570\u5b57\u8868\u793a\u5206\u914d\u7ed9\u6bcf\u4e2a\u9879\u7684\u5185\u90e8\u5f52\u6863 ID\u3002</p>\n<p lang=\"zh\">\u6587\u4ef6\u4e2d\u7684\u884c\u53ef\u4ee5\u88ab\u6ce8\u91ca\u6389\u3001\u5220\u9664\u5e76\u91cd\u65b0\u6392\u5e8f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">10; 145433 TABLE map_resolutions postgres\n;2; 145344 TABLE species postgres\n;4; 145359 TABLE nt_header postgres\n6; 145402 TABLE species_records postgres\n;8; 145416 TABLE ss_old postgres\n</pre>\n<p lang=\"zh\">\u53ef\u4ee5\u5c06\u8fd9\u6837\u7684\u6587\u4ef6\u4f5c\u4e3a <span class=\"application\">pg_restore</span> \u7684\u8f93\u5165\uff0c\u8fd9\u6837\u5b83\u5c31\u53ea\u4f1a\u6309\u8be5\u987a\u5e8f\u6062\u590d\u9879 10 \u548c 6\uff1a</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_restore -L db.list db.dump</code></strong>\n</pre>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></a>, <a class=\"xref\" href=\"https://pg.center/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgrestore.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgrestore.html", "method": "same-major semantic node", "sha256": "3ac2e6b9f506d8d1d2a1b8d626ac72d0bd4878a84c30f78d8d8e2cc9c4fe19c1", "language": "zh", "matched_nodes": ["#APP-PGRESTORE/div[10]/h2[0]", "#APP-PGRESTORE/div[2]/p[1]", "#APP-PGRESTORE/div[3]/h2[0]", "#APP-PGRESTORE/div[4]/div[4]/h3[0]", "#APP-PGRESTORE/div[4]/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[1]", "#APP-PGRESTORE/div[4]/p[2]", "#APP-PGRESTORE/div[4]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[13]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/div[1]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[15]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[17]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[19]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[23]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[25]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[27]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[29]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[31]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[33]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[35]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[37]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/h3[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[1]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[2]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/div[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[39]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[3]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[41]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[43]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[45]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[49]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[51]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[53]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/div[4]/ul[0]/li[4]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[3]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[55]/p[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[57]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[59]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[61]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[63]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[65]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[67]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[69]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[71]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[73]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[75]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[77]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[79]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[7]/p[2]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[81]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[83]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[85]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[87]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[89]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[0]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[91]/p[1]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[93]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[95]", "#APP-PGRESTORE/div[5]/div[2]/dl[0]/dd[9]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[11]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[1]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[3]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[5]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[7]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[0]", "#APP-PGRESTORE/div[5]/div[4]/dl[0]/dd[9]/p[1]", "#APP-PGRESTORE/div[5]/p[1]", "#APP-PGRESTORE/div[5]/p[3]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESTORE/div[6]/div[1]/dl[0]/dd[3]", "#APP-PGRESTORE/div[6]/h2[0]", "#APP-PGRESTORE/div[6]/p[2]", "#APP-PGRESTORE/div[7]/h2[0]", "#APP-PGRESTORE/div[7]/p[1]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[0]", "#APP-PGRESTORE/div[8]/div[4]/ul[0]/li[1]", "#APP-PGRESTORE/div[8]/h2[0]", "#APP-PGRESTORE/div[8]/p[1]", "#APP-PGRESTORE/div[8]/p[3]", "#APP-PGRESTORE/div[8]/p[5]", "#APP-PGRESTORE/div[8]/p[6]", "#APP-PGRESTORE/div[9]/h2[0]", "#APP-PGRESTORE/div[9]/p[11]", "#APP-PGRESTORE/div[9]/p[13]", "#APP-PGRESTORE/div[9]/p[14]", "#APP-PGRESTORE/div[9]/p[16]", "#APP-PGRESTORE/div[9]/p[1]", "#APP-PGRESTORE/div[9]/p[3]", "#APP-PGRESTORE/div[9]/p[6]", "#APP-PGRESTORE/div[9]/p[8]", "#APP-PGRESTORE/div[9]/p[9]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_restore \u2014 restore a PostgreSQL database from an archive file created by pg_dump", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/related/0/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive.", "/versions/18/tables/0/rows/1/summary": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.", "/versions/18/tables/0/rows/2/summary": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it.", "/versions/18/tables/0/rows/3/summary": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/18/tables/0/rows/4/summary": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration.", "/versions/18/tables/0/rows/5/summary": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout .", "/versions/18/tables/0/rows/6/summary": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following:", "/versions/18/tables/0/rows/7/summary": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches.", "/versions/18/tables/0/rows/8/summary": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server.", "/versions/18/tables/0/rows/9/summary": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored.", "/versions/18/tables/0/rows/11/summary": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table.", "/versions/18/tables/0/rows/12/summary": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches.", "/versions/18/tables/0/rows/13/summary": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects.", "/versions/18/tables/0/rows/14/summary": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches.", "/versions/18/tables/0/rows/15/summary": "This option is obsolete but still accepted for backwards compatibility.", "/versions/18/tables/0/rows/16/summary": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive.", "/versions/18/tables/0/rows/17/summary": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used.", "/versions/18/tables/0/rows/18/summary": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema.", "/versions/18/tables/0/rows/19/summary": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches.", "/versions/18/tables/0/rows/20/summary": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.", "/versions/18/tables/0/rows/21/summary": "Print the pg_restore version and exit.", "/versions/18/tables/0/rows/22/summary": "Prevent restoration of access privileges (grant/revoke commands).", "/versions/18/tables/0/rows/23/summary": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error .", "/versions/18/tables/0/rows/24/summary": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.", "/versions/18/tables/0/rows/25/summary": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table.", "/versions/18/tables/0/rows/26/summary": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.", "/versions/18/tables/0/rows/27/summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "/versions/18/tables/0/rows/28/summary": "Do not output commands to restore comments, even if the archive contains them.", "/versions/18/tables/0/rows/29/summary": "Do not output commands to restore data, even if the archive contains them.", "/versions/18/tables/0/rows/30/summary": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them.", "/versions/18/tables/0/rows/31/summary": "Do not output commands to restore row security policies, even if the archive contains them.", "/versions/18/tables/0/rows/32/summary": "Do not output commands to restore publications, even if the archive contains them.", "/versions/18/tables/0/rows/33/summary": "Do not output commands to restore schema (data definitions), even if the archive contains them.", "/versions/18/tables/0/rows/34/summary": "Do not output commands to restore security labels, even if the archive contains them.", "/versions/18/tables/0/rows/35/summary": "Do not output commands to restore statistics, even if the archive contains them.", "/versions/18/tables/0/rows/36/summary": "Do not output commands to restore subscriptions, even if the archive contains them.", "/versions/18/tables/0/rows/37/summary": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.", "/versions/18/tables/0/rows/38/summary": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.", "/versions/18/tables/0/rows/39/summary": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters.", "/versions/18/tables/0/rows/40/summary": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections.", "/versions/18/tables/0/rows/41/summary": "Output commands to restore statistics, if the archive contains them. This is the default.", "/versions/18/tables/0/rows/42/summary": "Restore only the statistics, not schema (data definitions) or data.", "/versions/18/tables/0/rows/43/summary": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored.", "/versions/18/tables/0/rows/44/summary": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error .", "/versions/18/tables/0/rows/45/summary": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly.", "/versions/18/tables/0/rows/46/summary": "Show help about pg_restore command line arguments, and exit.", "/versions/18/tables/0/rows/47/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.", "/versions/18/tables/0/rows/48/summary": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.", "/versions/18/tables/0/rows/49/summary": "User name to connect as.", "/versions/18/tables/0/rows/50/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/51/summary": "Force pg_restore to prompt for a password before connecting to a database.", "/versions/18/tables/0/rows/52/summary": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Default connection parameters", "/versions/18/tables/1/rows/1/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "2f452cf6e4d5139505a00d4783baee42387d624c77832a31aec8b0c1a1f921c4"}, "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Restore only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are restored, if present in the archive. This option is similar to, but for historical reasons not identical to, specifying --section=data ."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified."}, {"names": ["-C", "--create"], "signature": "-C --create", "description": "Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Connect to database dbname and restore directly into the database. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--exit-on-error"], "signature": "-e --exit-on-error", "description": "Exit if an error is encountered while sending SQL commands to the database. The default is to continue and to display a count of errors at the end of the restoration."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Specify output file for generated script, or for the listing when used with -l . Use - for stdout ."}, {"names": ["-F format", "--format= format"], "signature": "-F format --format= format", "description": "Specify format of the archive. It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: c custom The archive is in the custom format of pg_dump . d directory The archive is a directory archive. t tar The archive is a tar archive."}, {"names": ["-I index", "--index= index"], "signature": "-I index --index= index", "description": "Restore definition of named index only. Multiple indexes may be specified with multiple -I switches."}, {"names": ["-j number-of-jobs", "--jobs= number-of-jobs"], "signature": "-j number-of-jobs --jobs= number-of-jobs", "description": "Run the most time-consuming steps of pg_restore \u2014 those that load data, create indexes, or create constraints \u2014 concurrently, using up to number-of-jobs concurrent sessions. This option can dramatically reduce the time to restore a large database to a server running on a multiprocessor machine. This option is ignored when emitting a script rather than connecting directly to a database server. Each job is one process or one thread, depending on the operating system, and uses a separate connection to the server. The optimal value for this option depends on the hardware setup of the server, of the client, and of the network. Factors include the number of CPU cores and the disk setup. A good place to start is the number of CPU cores on the server, but values larger than that can also lead to faster restore times in many cases. Of course, values that are too high will lead to decreased performance because of thrashing. Only the custom and directory archive formats are supported with this option. The input must be a regular file or directory (not, for example, a pipe or standard input). Also, multiple jobs cannot be used together with the option --single-transaction ."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List the table of contents of the archive. The output of this operation can be used as input to the -L option. Note that if filtering switches such as -n or -t are used with -l , they will restrict the items listed."}, {"names": ["-L list-file", "--use-list= list-file"], "signature": "-L list-file --use-list= list-file", "description": "Restore only those archive elements that are listed in list-file , and restore them in the order they appear in the file. Note that if filtering switches such as -n or -t are used with -L , they will further restrict the items restored. list-file is normally created by editing the output of a previous -l operation. Lines can be moved or removed, and can also be commented out by placing a semicolon ( ; ) at the start of the line. See below for examples."}, {"names": ["-n schema", "--schema= schema"], "signature": "-n schema --schema= schema", "description": "Restore only objects that are in the named schema. Multiple schemas may be specified with multiple -n switches. This can be combined with the -t option to restore just a specific table."}, {"names": ["-N schema", "--exclude-schema= schema"], "signature": "-N schema --exclude-schema= schema", "description": "Do not restore objects that are in the named schema. Multiple schemas to be excluded may be specified with multiple -N switches. When both -n and -N are given for the same schema name, the -N switch wins and the schema is excluded."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "description": "Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O , any user name can be used for the initial connection, and this user will own all the created objects."}, {"names": ["-P function-name(argtype [, ...])", "--function= function-name(argtype [, ...])"], "signature": "-P function-name(argtype [, ...]) --function= function-name(argtype [, ...])", "description": "Restore the named function only. Be careful to spell the function name and arguments exactly as they appear in the dump file's table of contents. Multiple functions may be specified with multiple -P switches."}, {"names": ["-R", "--no-reconnect"], "signature": "-R --no-reconnect", "description": "This option is obsolete but still accepted for backwards compatibility."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Restore only the schema (data definitions), not data, to the extent that schema entries are present in the archive. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data --no-statistics . (Do not confuse this with the --schema option, which uses the word \u201c schema \u201d in a different meaning.)"}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "description": "Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used."}, {"names": ["-t table", "--table= table"], "signature": "-t table --table= table", "description": "Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation."}, {"names": ["-T trigger", "--trigger= trigger"], "signature": "-T trigger --trigger= trigger", "description": "Restore named trigger only. Multiple triggers may be specified with multiple -T switches."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_restore to output detailed object comments and start/stop times to the output file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_restore version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent restoration of access privileges (grant/revoke commands)."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "Execute the restore as a single transaction (that is, wrap the emitted commands in BEGIN / COMMIT ). This ensures that either all the commands complete successfully, or no changes are applied. This option implies --exit-on-error ."}, {"names": ["--disable-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when performing a restore without schema. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser."}, {"names": ["--enable-row-security"], "signature": "--enable-row-security", "description": "This option is relevant only when restoring the contents of a table which has row security. By default, pg_restore will set row_security to off, to ensure that all data is restored in to the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_restore to set row_security to on instead, allowing the user to attempt to restore the contents of the table with row security enabled. This might still fail if the user does not have the right to insert the rows from the dump into the table. Note that this option currently also requires the dump be in INSERT format, as COPY FROM does not support row security."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "description": "Specify a filename from which to read patterns for objects excluded or included from restore. The patterns are interpreted according to the same rules as -n / --schema for including objects in schemas, -N / --exclude-schema for excluding objects in schemas, -P / --function for restoring named functions, -I / --index for restoring named indexes, -t / --table for restoring named tables or -T / --trigger for restoring triggers. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: { include | exclude } { function | index | schema | table | trigger } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: function : functions, works like the -P / --function option. This keyword can only be used with the include keyword. index : indexes, works like the -I / --indexes option. This keyword can only be used with the include keyword. schema : schemas, works like the -n / --schema and -N / --exclude-schema options. table : tables, works like the -t / --table option. This keyword can only be used with the include keyword. trigger : triggers, works like the -T / --trigger option. This keyword can only be used with the include keyword. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns."}, {"names": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not output commands to restore comments, even if the archive contains them."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not output commands to restore data, even if the archive contains them."}, {"names": ["--no-data-for-failed-tables"], "signature": "--no-data-for-failed-tables", "description": "By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not output commands to restore row security policies, even if the archive contains them."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not output commands to restore publications, even if the archive contains them."}, {"names": ["--no-schema"], "signature": "--no-schema", "description": "Do not output commands to restore schema (data definitions), even if the archive contains them."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not output commands to restore security labels, even if the archive contains them."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not output commands to restore statistics, even if the archive contains them."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not output commands to restore subscriptions, even if the archive contains them."}, {"names": ["--no-table-access-method"], "signature": "--no-table-access-method", "description": "Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."}, {"names": ["--no-tablespaces"], "signature": "--no-tablespaces", "description": "Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."}, {"names": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "description": "Use the provided string as the psql \\restrict key in the dump output. This can only be specified for SQL script output, i.e., when the --file option is used. If no restrict key is specified, pg_restore will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output."}, {"names": ["--section= sectionname"], "signature": "--section= sectionname", "description": "Only restore the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to restore all sections. The data section contains actual table data as well as large-object definitions. Post-data items consist of definitions of indexes, triggers, rules and constraints other than validated check constraints. Pre-data items consist of all other data definition items."}, {"names": ["--statistics"], "signature": "--statistics", "description": "Output commands to restore statistics, if the archive contains them. This is the default."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "description": "Restore only the statistics, not schema (data definitions) or data."}, {"names": ["--strict-names"], "signature": "--strict-names", "description": "Require that each schema ( -n / --schema ) and table ( -t / --table ) qualifier match at least one schema/table in the file to be restored."}, {"names": ["--transaction-size= N"], "signature": "--transaction-size= N", "description": "Execute the restore as a series of transactions, each processing up to N database objects. This option implies --exit-on-error . --transaction-size offers an intermediate choice between the default behavior (one transaction per SQL command) and -1 / --single-transaction (one transaction for all restored objects). While --single-transaction has the least overhead, it may be impractical for large databases because the transaction will take a lock on each restored object, possibly exhausting the server's lock table space. Using --transaction-size with a size of a few thousand objects offers nearly the same performance benefits while capping the amount of lock table space needed."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "description": "Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_restore command line arguments, and exit."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force pg_restore to prompt for a password before connecting to a database. This option is never essential, since pg_restore will automatically prompt for a password if the server demands password authentication. However, pg_restore will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt."}, {"names": ["--role= rolename"], "signature": "--role= rolename", "description": "Specifies a role name to be used to perform the restore. This option causes pg_restore to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_restore , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows restores to be performed without violating the policy."}], "synopsis": ["pg_restore [ connection-option ...] [ option ...] [ filename ]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "bd6f4ae67c44e7910aa300beb77d5bbe563ed23a586f2889963b7389840c0f97", "manual_language": "zh"}, "comparison": {"left": "10", "right": "11", "status": "changed", "diff": "--- PostgreSQL 10\n+++ PostgreSQL 11\n@@ -15,7 +15,7 @@\n       \"signature\": \"-a --data-only\"\n     },\n     {\n-      \"description\": \"Clean (drop) database objects before recreating them. (Unless --if-exists is used, this might generate some harmless error messages, if any objects were not present in the destination database.)\",\n+      \"description\": \"Before restoring database objects, issue commands to DROP all the objects that will be restored. This option is useful for overwriting an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported, unless --if-exists is also specified.\",\n       \"names\": [\n         \"-c\",\n         \"--clean\"\n@@ -23,7 +23,7 @@\n       \"signature\": \"-c --clean\"\n     },\n     {\n-      \"description\": \"Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive.\",\n+      \"description\": \"Create the database before restoring into it. If --clean is also specified, drop and recreate the target database before connecting to it. With --create , pg_restore also restores the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also restored, unless --no-acl is specified. When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands. All data is restored into the database name that appears in the archive.\",\n       \"names\": [\n         \"-C\",\n         \"--create\"\n@@ -151,7 +151,7 @@\n       \"signature\": \"-S username --superuser= username\"\n     },\n     {\n-      \"description\": \"Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation.\",\n+      \"description\": \"Restore definition and/or data of only the named table. For this purpose, \u201c table \u201d includes views, materialized views, sequences, and foreign tables. Multiple tables can be selected by writing multiple -t switches. This option can be combined with the -n option to specify table(s) in a particular schema. Note When -t is specified, pg_restore makes no attempt to restore any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that a specific-table restore into a clean database will succeed. Note This flag does not behave identically to the -t flag of pg_dump . There is not currently any provision for wild-card matching in pg_restore , nor can you include a schema name within its -t . And, while pg_dump 's -t flag will also dump subsidiary objects (such as indexes) of the selected table(s), pg_restore 's -t flag does not include such subsidiary objects. Note In versions prior to PostgreSQL 9.6, this flag matched only tables, not any other type of relation.\",\n       \"names\": [\n         \"-t table\",\n         \"--table= table\"\n@@ -200,7 +200,7 @@\n       \"signature\": \"-1 --single-transaction\"\n     },\n     {\n-      \"description\": \"This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser.\",\n+      \"description\": \"This option is relevant only when performing a data-only restore. It instructs pg_restore to execute commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So you should also specify a superuser name with -S or, preferably, run pg_restore as a PostgreSQL superuser.\",\n       \"names\": [\n         \"--disable-triggers\"\n       ],\n@@ -214,11 +214,18 @@\n       \"signature\": \"--enable-row-security\"\n     },\n     {\n-      \"description\": \"Use conditional commands (i.e., add an IF EXISTS clause) when cleaning database objects. This option is not valid unless --clean is also specified.\",\n+      \"description\": \"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.\",\n       \"names\": [\n         \"--if-exists\"\n       ],\n       \"signature\": \"--if-exists\"\n+    },\n+    {\n+      \"description\": \"Do not output commands to restore comments, even if the archive contains them.\",\n+      \"names\": [\n+        \"--no-comments\"\n+      ],\n+      \"signature\": \"--no-comments\"\n     },\n     {\n       \"description\": \"By default, table data is restored even if the creation command for the table failed (e.g., because it already exists). With this option, data for such a table is skipped. This behavior is useful if the target database already contains the desired table contents. For example, auxiliary tables for PostgreSQL extensions such as PostGIS might already be loaded in the target database; specifying this option prevents duplicate or obsolete data from being loaded into them. This option is effective only when restoring directly into a database, not when producing SQL script output.\","}}