Postgresql 中数据库的备份
来源:互联网 发布:java获取useragent 编辑:程序博客网 时间:2024/06/03 10:01
Postgresql中数据库的备份有多种形式:
1、利用图形化界面进行备份
2、利用命令进行备份
利用图形化界面备份简单易操作,但不稳定。可以利用命令进行备份.
Examples
To dump a database called mydb
into a SQL-script file:
$
pg_dump mydb > db.sql
To reload such a script into a (freshly created) database named newdb
:
$
psql -d newdb -f db.sql
To dump a database into a custom-format archive file:
$
pg_dump -Fc mydb > db.dump
To reload an archive file into a (freshly created) database named newdb
:
$
pg_restore -d newdb db.dump
To dump a single table named mytab
:
$
pg_dump -t mytab mydb > db.sql
To dump all tables whose names start with emp
in the detroit
schema, except for the table named employee_log
:
$
pg_dump -t 'detroit.emp*' -T detroit.employee_log mydb > db.sql
To dump all schemas whose names start with east
or west
and end in gsm
, excluding any schemas whose names contain the word test
:
$
pg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb > db.sql
The same, using regular expression notation to consolidate the switches:
$
pg_dump -n '(east|west)*gsm' -N '*test*' mydb > db.sql
To dump all database objects except for tables whose names begin with ts_
:
$
pg_dump -T 'ts_*' mydb > db.sql
To specify an upper-case or mixed-case name in -t
and related switches, you need to double-quote the name; else it will be folded to lower case (see Patterns). But double quotes are special to the shell, so in turn they must be quoted. Thus, to dump a single table with a mixed-case name, you need something like
$
pg_dump -t '"MixedCaseName"' mydb > mytab.sql
以上命令在执行的过程中需要加上常用连接数据库的命令
例如:利用自定义格式进行备份
pg_dump -h localhost -U wyh -d -Fc databasename >d:/databasename.dump
- Postgresql 中数据库的备份
- PostgreSQL数据库备份及备份中遇到的问题
- Postgresql的dump数据库备份与还原
- postgresql数据库的备份和还原
- postgresql 数据库的备份与还原
- postgresql数据库备份
- postgresql 数据库备份
- postgresQL备份数据库shell
- postgresql的基本使用,以及数据库的备份与恢复
- PostgreSQL数据库导入备份数据
- Postgresql 数据库备份与恢复
- 备份和恢复PostgreSQL数据库
- postgresql数据库、表备份语句
- PostgreSQL数据库备份与恢复
- PostgreSQL数据库完美备份恢复
- PostgreSQL数据库批处理自动备份
- PostgreSQL数据库备份与恢复
- PostgreSQL数据库完美备份恢复
- 刚刚想起来bing
- MMC 不能打开文件 SQL Server Enterprise Manager.MSC的解决方法
- 姚博文 js解决 automation 服务器不能创建对象
- AIX 中 Paging Space 使用率过高的分析与解决
- 最小生成树----Kruskal算法
- Postgresql 中数据库的备份
- 几款常见的HTML可视化编辑器
- 用JAVASCRIPT从弹出的窗口中获取值
- 调用ArcMap的符号库管理窗口
- WEB开发中的JAVA字符编码经验总结
- 剖析XP系统核心之 ----ntdll.dll
- 编程珠玑番外篇-C.正则表达式精义-1
- 结对编程的理解
- 向SDE中添加图层(删除图层)