pg_dump

用于备份单个PostgreSQL数据库的核心实用程序

pg_dump 是一个用于将单个PostgreSQL数据库备份为SQL脚本、TAR存档或自定义存档文件的核心实用程序

pg_dump 一直存在于PostgreSQL中。

更改历史记录

开发中

示例

单个表(包括定义和内容)的纯文本转储示例输出

$ pg_dump -Fp -d 'host=localhost dbname=app user=appuser' --table=app.language 
--
-- PostgreSQL database dump
--

-- Dumped from database version 12.5
-- Dumped by pg_dump version 14devel

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: language; Type: TABLE; Schema: app; Owner: appuser
--

CREATE TABLE app.language (
    lang_id character(2) NOT NULL,
    name_english character varying(64),
    name_native character varying(64),
    CONSTRAINT language_lang_id_check CHECK ((lang_id ~ '^[a-z]{2}$'::text))
);


ALTER TABLE app.language OWNER TO app;

--
-- Data for Name: language; Type: TABLE DATA; Schema: app; Owner: appuser
--

COPY app.language (lang_id, name_english, name_native) FROM stdin;
en      English English
de      German  Deutsch
ja      Japanese        日本語
th      Thai    ไทย
\.


--
-- Name: language language_pkey; Type: CONSTRAINT; Schema: app; Owner: appuser
--

ALTER TABLE ONLY app.language
    ADD CONSTRAINT language_pkey PRIMARY KEY (lang_id);

--
-- PostgreSQL database dump complete
--

分类

备份核心实用程序数据导入/导出

另请参阅

pg_dumpallpg_restoretest_pg_dump

反馈

针对 "pg_dump" 提交任何评论、建议或更正 在此处