创建,参见\h create user 删除,参见\h drop user 查看现有用户列表: select usename from pg_user;创建、删除、查看现有的数据库列表: 创建,参见\h create database 删除,参见\h drop database 查看,如下 select datname from pg_database;备份与恢复: SQL转储: 通过pg_dump, pg_dumpall 命令将数据导出到一个文本中,具体使用见\h pg_dump \h pg_dumpall.详情见: http://database.chinaunix.net/a2010/0831/1097/000001097274.shtml
这些是报错信息的一部分: bash: 2c1: command not found bash: 2c1: command not found bash: 2c1: command not found bash: 2c1: command not found bash: 2cVT1021: command not found bash: 2c1: command not found bash: 2cVT1021: command not found bash: 2cVT1021: command not found bash: 2cVT1021: command not found bash: 2c1: command not found bash: 2cVT1021: command not found bash: 2c1: command not found bash: 2c1: command not found bash: 2c1: command not found bash: 2c1: command not found bash: 2cVT1021: command not found bash: 2c1: command not found bash: 2cVT102VT102VT102: command not found
psql:/var/pod_db_1.3.backup:1325: invalid command \赝? psql:/var/pod_db_1.3.backup:1328: \connect: could not translate host name "t巯蚒彖健牫璘绨芀nw?騞额i蛎s沸责&?薔ryR﹕.b/]? to address: Name or service not known ^[[?1;2c!> 1;2cVT102VT102VT102VT1021;2cVT1021;2c1;2cVT1021;2c1;2cVT102VT102VT102c1;2cVT102VT102VT102VT1021;2cVT1021;2c1;2cVT1021;2c You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. You are currently not connected to a database. 这个也是
删除,参见\h drop user
查看现有用户列表:
select usename from pg_user;创建、删除、查看现有的数据库列表:
创建,参见\h create database
删除,参见\h drop database
查看,如下
select datname from pg_database;备份与恢复:
SQL转储:
通过pg_dump, pg_dumpall 命令将数据导出到一个文本中,具体使用见\h pg_dump \h pg_dumpall.详情见:
http://database.chinaunix.net/a2010/0831/1097/000001097274.shtml
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2cVT1021: command not found
bash: 2c1: command not found
bash: 2cVT1021: command not found
bash: 2cVT1021: command not found
bash: 2cVT1021: command not found
bash: 2c1: command not found
bash: 2cVT1021: command not found
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2c1: command not found
bash: 2cVT1021: command not found
bash: 2c1: command not found
bash: 2cVT102VT102VT102: command not found
psql:/var/pod_db_1.3.backup:1328: \connect: could not translate host name "t巯蚒彖健牫璘绨芀nw?騞额i蛎s沸责&?薔ryR﹕.b/]? to address: Name or service not known
^[[?1;2c!> 1;2cVT102VT102VT102VT1021;2cVT1021;2c1;2cVT1021;2c1;2cVT102VT102VT102c1;2cVT102VT102VT102VT1021;2cVT1021;2c1;2cVT1021;2c
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
You are currently not connected to a database.
这个也是
这里有备份还原的,楼主看过了吗?
这样恢复也出错误!!用图形化界面就可以恢复在linux下老出错
pg_dump 把一个数据库转储为纯文本文件或者是其它格式. 用法:
pg_dump [选项]... [数据库名字] 一般选项:
-f, --file=文件名 输出文件名
-F, --format=c|t|p 输出文件格式 (定制, tar, 明文)
-i, --ignore-version 当服务器的版本号与 pg_dump 的版本号不匹配时
仍继续运行
-v, --verbose 详细模式
-Z, --compress=0-9 被压缩格式的压缩级别
--help 显示此帮助信息, 然后退出
--version 输出版本信息, 然后退出 控制输出内容选项:
-a, --data-only 只转储数据,不包括模式
-b, --blobs 在转储中包括大对象
-c, --clean 先清楚(删除)预先的模式,再建立
-C, --create 在转储中包括命令,以便创建数据库
-d, --inserts 象 INSERT 一样的转储数据, 相当于 COPY, 命令
-D, --column-inserts 象 INSERT 带字段名字命令一样转储数据
-n, --schema=SCHEMA 只转储指定名称的模式
-o, --oids 在转储中包括 OID
-O, --no-owner 在明文格式中, 忽略恢复对象所属者 -s, --schema-only 只转储模式, 不包括数据
-S, --superuser=NAME 在明文格式中, 使用指定的超级用户
名称
-t, --table=TABLE 只转储指定名称的表
-x, --no-privileges 不要转储权限 (grant/revoke)
-X disable-dollar-quoting, --disable-dollar-quoting
取消美元 (符号) 引号, 使用 SQL 标准引号
-X disable-triggers, --disable-triggers
在只恢复数据的过程中取消触发器
-X use-set-session-authorization, --use-set-session-authorization
使用 SESSION AUTHORIZATION 命令代替
OWNER TO 命令 联接选项:
-h, --host=主机名 数据库服务器的主机名或套接字目录
-p, --port=端口号 数据库服务器的端口号
-U, --username=名字 以指定的数据库用户联接
-W, --password 强制口令提示 (自动) 如果没有提供数据库名字, 那么使用 PGDATABASE 环境变量
的数值. 详细资料请看 doc\html\backup.html 文件!
============
C:\PostgreSQL\bin> pg_restore --help
pg_restore 从一个归档中恢复一个由 pg_dump 创建的 PostgreSQL 数据库. 用法:
pg_restore [选项]... [文件名] 一般选项:
-d, --dbname=名字 连接数据库名字
-f, --file=文件名 输出文件名
-F, --format=c|t 指定备份文件格式
-i, --ignore-version 当服务器版本不匹配时继续运行
-l, --list 打印归档文件的 TOC 概述
-v, --verbose 详细模式
--help 显示此帮助信息, 然后退出
--version 输出版本信息, 然后退出 恢复控制选项:
-a, --data-only 只恢复数据, 不包括模式
-c, --clean 先清楚(删除)预先的模式,再建立
-C, --create 创建目标数据库
-I, --index=名称 恢复指定名称的索引
-L, --use-list=文件名 从这个文件中使用指定的内容表排序
输出
-O, --no-owner 忽略恢复对象所属者
-P, --function=名字(参数)
恢复指定名字的函数
-s, --schema-only 只恢复模式, 不包括数据
-S, --superuser=NAME 使用指定的超级用户来取消
触发器
-t, --table=NAME 恢复指定命字的表
-T, --trigger=NAME 恢复指定命字的触发器
-x, --no-privileges 跳过处理权限的恢复 (grant/revoke)
-X disable-triggers, --disable-triggers
在只恢复数据的过程中取消触发器
-X use-set-session-authorization, --use-set-session-authorization
使用 SESSION AUTHORIZATION 命令代替
OWNER TO 命令 联接选项:
-h, --host=主机名 数据库服务器的主机名或套接字目录
-p, --port=端口号 数据库服务器的端口号
-U, --username=名字 以指定的数据库用户联接
-W, --password 强制口令提示 (自动)
-e, --exit-on-error 发生错误退出, 默认为继续 如果没有提供输入文件名, 则使用标准输入. 请参见 “PG安装目录”\doc\html\app-pgdump.html 及 “PG安装目录”\doc\html\app-pgrestore.html 楼主参考下:
http://button.javaeye.com/blog/225289对postgresql 我也不太熟;也是按照文档里来的