wyzxzws 发表于 2013-1-30 01:34:43

psql数据导入

第一步:
C:\Program Files\PostgreSQL\8.3\bin>psql -U 用户名 数据库名
第二步:
C:\Program Files\PostgreSQL\8.3\bin>psql -U postgres dc
Password for user postgres:
第三步:
C:\Program Files\PostgreSQL\8.3\bin>psql -U postgres dc
Password for user postgres:
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type:\copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

dc=#
第四步:
C:\Program Files\PostgreSQL\8.3\bin>psql -U postgres dc
Password for user postgres:
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type:\copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

dc=# \i C:/dc.sql
。。。。。。。。。。。。。。。

C:\Program Files\PostgreSQL\8.3\bin>psql -U postgres dc
Password for user postgres:
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type:\copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

dc=# \i C:/dc.sql
SET
SET
SET
SET
SET
SET
psql:C:/dc.sql:16: ERROR:language "plpgsql" already exists
ALTER LANGUAGE
SET
SET
SET
psql:C:/dc.sql:38: ERROR:relation "dcda" already exists
ALTER TABLE
psql:C:/dc.sql:52: ERROR:relation "dcdesktopannouncement_id_seq" already exist
s
ALTER TABLE
ALTER SEQUENCE
setval
--------
   12
(1 row)

psql:C:/dc.sql:78: ERROR:relation "dctype" already exists
ALTER TABLE
psql:C:/dc.sql:92: ERROR:relation "dctype_id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
setval
--------
   13
(1 row)

psql:C:/dc.sql:119: ERROR:relation "dcuser" already exists
ALTER TABLE
psql:C:/dc.sql:133: ERROR:relation "user_id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
setval
--------
      1
(1 row)

ALTER TABLE
ALTER TABLE
ALTER TABLE
psql:C:/dc.sql:190: ERROR:duplicate key value violates unique constraint "pkda
"
CONTEXT:COPY dcda, line 1: "1 wwww    鈥媤www 2010-02-19 18:37:58.734+08
f       1"
psql:C:/dc.sql:211: ERROR:duplicate key value violates unique constraint "pk_d
ctype"
CONTEXT:COPY dctype, line 1: "1       骞冲彴鍏憡"
psql:C:/dc.sql:220: ERROR:duplicate key value violates unique constraint "pk_u
ser"
CONTEXT:COPY dcuser, line 1: "1       admin   123456"
psql:C:/dc.sql:228: ERROR:multiple primary keys for table "dctype" are not all
owed
psql:C:/dc.sql:236: ERROR:multiple primary keys for table "dcuser" are not all
owed
psql:C:/dc.sql:244: ERROR:multiple primary keys for table "dcda" are not allow
ed
psql:C:/dc.sql:252: ERROR:constraint "fpk_dcda_dctype" for relation "dcda" alr
eady exists
REVOKE
REVOKE
GRANT
GRANT
dc=#结束了!!!
页: [1]
查看完整版本: psql数据导入