我創建使用pg_dump的一個錶轉儲:如何將表從轉儲還原到數據庫?
pg_dump -h server1 -U postgres -t np_points gisurfo > D:\np_point.sql
我進去後PSQL說:
-f D:\np_point.sql
,但得到的非標準PostgreSQL的表的列表。
接下來,我嘗試exequte np_point.sql在pgAdmin的和得到錯誤:
ERROR: Syntax error (near: "1")
LINE 78: 1 Сухово 75244822005 75644000 Челябинская обл. Нязепетровски...
它的這個SQL,我得到錯誤的片段:
COPY np_point (gid, full_name, okato, oktmo, obl_name, region_nam, the_geom) FROM stdin;
1 Сухово 75244822005 75644000 Челябинская обл. Нязепетровский район 0101000020E6100000312A7936BD9F4D402A3C580DE9FF4B40
如何從SQL文件恢復表?
UPDATE
的PostgreSQL 8.4
和SQL文件的第一部分。
PostgreSQL database dump
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: np_point; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE np_point (
gid integer NOT NULL,
full_name character varying(254),
okato character varying(254),
oktmo character varying(254),
obl_name character varying(254),
region_nam character varying(254),
the_geom geometry,
CONSTRAINT enforce_dims_the_geom CHECK ((st_ndims(the_geom) = 2)),
CONSTRAINT enforce_geotype_the_geom CHECK (((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))),
CONSTRAINT enforce_srid_the_geom CHECK ((st_srid(the_geom) = 4326))
);
哪個版本的postgres?您要從哪個數據庫導入並導入數據庫的屬性是什麼?模式是什麼樣子的數據庫你傾倒和導入? – wich 2013-03-13 07:04:18
@wich:我更新問題。請看看它。它你想看到什麼? – 2013-03-13 07:32:35
你在目的地數據庫安裝了posgis嗎? – francs 2013-03-13 07:40:07