如何用命令打开postgresql数据库

如何用命令打开postgresql数据库,第1张

F:\PostgreSQL\9.2\bin>psql.exe -h localhost -U postgres -d Test -p 5432psql (9.2.4)输入 "help" 来获取帮助信息.Test=#Test=# help您正在使用psql, 这是一种用于访问PostgreSQL的命令行界面键入: \copyright 显示发行条款 \h 显示 SQL 命令的说明 \? 显示 pgsql 命令的说明 \g 或者以分号()结尾以执行查询 \q 退出注: 数据库名称区分大小写的。使用某些有密码的用户的情况下, 会提示输入密码.F:\PostgreSQL\9.2\bin>psql.exe -h localhost -U test -d Test -p 5432用户 test 的口令:psql (9.2.4)输入 "help" 来获取帮助信息.Test=#

如将一Shapfile文件“c:\road.shp”导入到数据表“road”中,数据库为“sjzmap”。

1、运行“命令提示符”。

2、切换至PostgreSQL数据库安装目录中的bin目录下。

3、执行此目录下的shp2pgsql命令:“shp2pgsql c:\road.shp road >c:\road.sql”。

4、如将此文件直接导入数据库(不推荐):“shp2pgsql -c c:\road.shp road sjzmap | psql -d sjzmap”。

5、使用pgAdmin3 选择数据库,再导入表。

注:

Drops the database table before creating a new table with the data in the Shape file.

Appends data from the Shape file into the database table. Note that to use this option to load multiple files, the files must have the same attributes and same data types.

Creates a new table and populates it from the Shape file.

Only produces the table creation SQL code, without adding any actual data. This can be used if you need to completely separate the table creation and data loading steps.

Use the PostgreSQL "dump" format for the output data. This can be combined with -a, -c and -d. It is much faster to load than the default "insert" SQL format. Use this for very large data sets.

Creates and populates the geometry tables with the specified SRID.

Keep identifiers' case (column, schema and attributes). Note that attributes in Shapefile are all UPPERCASE.

Coerce all integers to standard 32-bit integers, do not create 64-bit bigints, even if the DBF header signature appears to warrant it.

Create a GiST index on the geometry column.

Output WKT format, for use with older (0.x) versions of PostGIS. Note that this will introduce coordinate drifts and will drop M values from shapefiles.

Specify encoding of the input data (dbf file). When used, all attributes of the dbf are converted from the specified encoding to UTF8. The resulting SQL output will contain a command, so that the backend will be able to reconvert from UTF8 to whatever encoding the database is configured to use internally.


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/6756230.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-27
下一篇 2023-03-27

发表评论

登录后才能评论

评论列表(0条)

保存