当前位置: 首页 > news >正文

网站建设费怎么做会计分录惠州网站制作推广

网站建设费怎么做会计分录,惠州网站制作推广,做餐厅网站的需求分析报告,wordpress后台配置文件1.pg_dump备份恢复 pg_dump 是一个逻辑备份工具。使用 pg_dump 可以在数据库处于使用状态下进行一致 性的备份, 它不会阻塞其他用户对数据库的访问 。 一致性备份是 pg_dump 开始运行时,给数据库打了一个快照,且在 pg_dump 运行过程 中发生…

1.pg_dump备份恢复

pg_dump 是一个逻辑备份工具。使用 pg_dump 可以在数据库处于使用状态下进行一致
性的备份, 它不会阻塞其他用户对数据库的访问 。
一致性备份是 pg_dump 开始运行时,给数据库打了一个快照,且在 pg_dump 运行过程
中发生的更新将不会被备份。
pg_dump 只备份单个数据库,不能备份数据库公共的全局对象(例如角色和表空间)
提示 :将执行 pg_dump/pg_restore 的客户端放在尽可能靠近 源和目标 数据库的位置,
以避免因网络延迟不良而导致的性能问题。
2.pg_dump常用参数
-h host,指定数据库主机名,或者 IP 
-p port,指定端口号 
-U user,指定连接使用的用户名 
-W,按提示输入密码 
dbname,指定连接的数据库名称,实际上也是要备份的数据库名称。 
-f,--file:输出到指定文件中 
-F,--format=c|d|t|p: c 为自定义格式,也是二进制格式,压缩存储,只能使用 pg_restore 来还原, 可
以指定还原的表, 编辑 TOC 文件, 定制还原的顺序, 表, 索引等。 d 为目录 t 表示输出为 tar 包 p 为纯文本 SQL,大库不推荐; 
-j,--jobs=num:指定并行导出的并行度 
-a,--data-only:只导出数据,不导出表结构 
-c,--clean:是否生成清理该数据库对象的语句,比如 drop table 
-C,--create:是否输出一条创建数据库语句 
-n,--schema:只转存匹配 schema 的模式内容 
-N,--exclude-scheam:不转存匹配 schema 的模式内容 
-O,--no-owner,不设置导出对象的所有权 
-s,--schema-only:只导致对象定义模式,不导出数据 
-t,--table:只转存匹配到的表,视图,序列,可以使用多个-t 匹配多个表 
-T,--exclude-table:不转存匹配到的表。 
--inserts:使用 insert 命令形式导出数据,这种方式比默认的 copy 方式慢很多,但是可
用于将数据导入到非 PostgreSQL 数据库。 
--column-inserts:导出的数据,有显式列名 

3.备份

3.1指定库备份

1.导出sql文件

-- insert 命令形式导出库的数据 
pg_dump -h 127.0.0.1 -U postgres -p 5432 -W testdb --inserts > testdb.sql 
pg_dump testdb --inserts > testdb.sql 
pg_dump testdb --inserts --rows-per-insert=2 > testdb.sql --每次插入 2 行

2.导出指定对象

-- 要转储一个数据库到一个自定义格式归档文件: 
pg_dump -Fc testdb > testdb.dump 
-- 使用 5 个并行任务转储一个数据库到一个目录格式的归档 
pg_dump -Fd testdb -j 5 -f dumpdir

3.2单表备份

-- 备份单个表 
pg_dump -h 127.0.0.1 -U postgres -p 5432 -W testdb -t t1 --inserts > testdb.sql -- 备份多个表 
pg_dump -h 127.0.0.1 -U postgres -p 5432 -W testdb -t t1 -t t2 --inserts > 
testdb.sql-- 如果只想备份 schema 模式中所有以 t 开头的表,但是不包括 t1 表 
pg_dump -t "public.t*" -T public.t1 testdb > testdb.sql -- 转储所有 testdb 的数据库对象,但是不包含以 1 结尾的表 
pg_dump -T '*1' testdb > testdb.sql -- 转储 testdb 中 public 和 test 这两个 schema 中的内容 
pg_dump -Fc -n public -n test testdb -f testdb.dump -- 转储 testdb 中除了 public schema 中的数据以外的所有数据 
pg_dump -Fc -N public testdb -f testdb.dump

3.3只备份数据

pg_dump -h 127.0.0.1 -U postgres -p 5432 -W testdb --inserts -a > testdb.sql

3.4只备份表结构

pg_dump -h 127.0.0.1 -U postgres -p 5432 -W testdb -s > testdb.sql

4.恢复

--恢复一个文本文档 
psql newdb < testdb.sql -- 要把一个归档文件重新载入到一个(新创建的)名为 newdb 的数据库: 
pg_restore -d newdb testdb.dump -- 把一个归档文件重新装载到同一个数据库(该归档正是从这个数据库中转储得来)中,
丢掉那个数据库中的当前内容 
pg_restore -d newdb --clean testdb.dump -- 备份后直接进行恢复,文件不落地 
pg_dump testdb| psql newdb -- 并行备份恢复 
pg_dump -Fd -j4 testdb -f dumpdir 
pg_restore -d newdb -j4 dumpdir

4.1利用toc文件选择性恢复

-- 根据二进制备份文件生成 toc 文件 
方式一:pg_restore -l testdb.dump > testdb.toc 
方式二:pg_restore -l -f testdb.toc testdb.dump -- 修改 toc 文件,用‘;’号注释掉不用还原的内容: -- 以 toc 文件列表做恢复 
pg_restore -Fc -L testdb.toc -d newdb testdb.dump 
-- 检查发现 t1 表没有被导入。

4.2使用unix管道压缩备份恢复

-- 导出并且压缩 
pg_dump testdb -f testdb.sql | gzip testdb.sql -- 解压并且导入,压缩文件不变: 
gunzip -c testdb.sql.gz | psql testdb -- 分割备份 
pg_dump testdb | split -b 1m -- 恢复 
cat filename* | psql dbname

5.迁移大表

5.1如果需要迁移多个大表怎么办?

可以使用 -j 选项来指定执行 pg_dump 和 pg_restore 时要使用的线程数。 
可以使用目录格式 (-Fd),它会提供压缩转储(使用 gzip)。使用 -Fd 选项可以提供超过
5 倍的压缩。对于较大的数据库(例如超过 1 TB),压缩转储可以减少磁盘 IOPS。

示例:

pg_dump -Fd testdb -j 5 -f dump_dir 
pg_restore -d newdb -j 5 dump_dir

5.2 如果大多数表都很小,但有一张表非常大,如何迁移? 

可以将 pg_dump 的输出通过管道传输到 pg_restore,这样就无需等待转储完成后再开始

恢复; 两者可以同时运行。 这避免了将转储存储在客户端,可以显着减少将转储写入磁
盘所需的 IOPS 开销。
在这种情况下,-j 选项没有用,因为 pg_dump/pg_restore 每个表只运行一个线程,它
们在转储和恢复大表时受到限制。 此外,当使用 -j 标志时,无法将 pg_dump 的输出通
过管道传输到 pg_restore。
示例:
pg_dump -Fc testdb | pg_restore -d newdb

5.3 如何使用多个线程迁移单个大表?

可以利用多个线程来迁移单个大表,方法是在逻辑上将 Postgres 表分为多个部分,然后
使用一对线程——一个从源读取,一个写入目标。可以根据 主键(例如,id 列)或时间
字段(例如,created_time、updated_time 等)对表进行拆分。
GitHub 上有一个 Parallel Loader 的 Python 脚本,它实现了拆分迁移。下载地址:
https://github.com/microsoft/OrcasNinjaTeam/tree/master/azure
postgresql/data_migration
#suppose the filename is parallel_migrate.py 
import os 
import sys 
#source info 
source_url = sys.argv[1] 
source_table = sys.argv[2] #dest info 
dest_url = sys.argv[3] 
dest_table = sys.argv[4] 
#others 
total_threads=int(sys.argv[5]); 
size=int(sys.argv[6]); 
interval=size/total_threads; 
start=0; 
end=start+interval;
for i in range(0,total_threads): if(i!=total_threads-1): select_query = '\"\COPY (SELECT * from ' + source_table + ' WHERE 
id>='+str(start)+' AND id<'+str(end)+") TO STDOUT\""; read_query = "psql \"" + source_url + "\" -c " + select_query write_query = "psql \"" + dest_url + "\" -c \"\COPY " + dest_table +" 
FROM STDIN\"" os.system(read_query+'|'+write_query + ' &') else: select_query = '\"\COPY (SELECT * from '+ source_table +' WHERE 
id>='+str(start)+") TO STDOUT\""; read_query = "psql \"" + source_url + "\" -c " + select_query write_query = "psql \"" + dest_url + "\" -c \"\COPY " + dest_table +" 
FROM STDIN\"" os.system(read_query+'|'+write_query) start=end; end=start+interval;

 5.3.1如何调用并进行加载程序脚本

python parallel_migrate.py "source_connection_string" source_table "destination_connection_string" destination_table number_of_threadscount_of_table 
示例: 
python parallel_migrate.py "host=192.168.1.102 port=5432 dbname=postgres 
user=postgres password=postgres sslmode=prefer" t1 "host=192.168.1.102 
port=5432 dbname=newdb user=postgres password=postgres sslmode=prefer" 
t1 4 1000000
使用 Parallel Loader 脚本,可以控制用于迁移大表的线程数。 在上述调用中,
number_of_threads 参数控制并行度因子。
上述实现使用表的单调递增的 id 列将其拆分并使用并行线程将数据从源表流式传输到目标
表。

 5.3.2对比 Parallel Loader 与 pg_dump/pg_restore 迁移大表的性能

为了比较 pg_dump 和 pg_restore 与 Parallel Loader 脚本的性能,使用这两种技术将 1
TB 表从 testdb 数据库迁移到 newdb 数据库。
可以看到,Parallel Loader 脚本的执行速度比 pg_dump 和 pg_restore 快了 3 倍以上。
parallel loaderpg_dump&pg_restore
7 小时 45 分钟
超过一天

  

可以将 pg_dump/pg_restore 与 Parallel Loader 结合使用,以实现更快的数据迁移
pg_dump/pg_restore 是可以将数据从一个数据库迁移到另一个数据库。但是,当数据库
中有非常大的表时,会大大减慢迁移速度。为了解决这个问题,可以使用 Parallel Loader 
脚本将单个大表进行迁移,而 pg_dump/pg_restore 可用于迁移其余的表。


文章转载自:
http://spittoon.c7497.cn
http://wettish.c7497.cn
http://ecstasy.c7497.cn
http://pathetically.c7497.cn
http://hammering.c7497.cn
http://rumanian.c7497.cn
http://motherhood.c7497.cn
http://iaaf.c7497.cn
http://toreutic.c7497.cn
http://heredes.c7497.cn
http://unconvince.c7497.cn
http://osee.c7497.cn
http://anionic.c7497.cn
http://mayest.c7497.cn
http://tunable.c7497.cn
http://asexuality.c7497.cn
http://aggressor.c7497.cn
http://glint.c7497.cn
http://intermetallic.c7497.cn
http://quotation.c7497.cn
http://vulgus.c7497.cn
http://retrievable.c7497.cn
http://videophone.c7497.cn
http://hyperosmolality.c7497.cn
http://carcinomatosis.c7497.cn
http://formulizer.c7497.cn
http://psyllid.c7497.cn
http://visionary.c7497.cn
http://pluuiose.c7497.cn
http://bottleholder.c7497.cn
http://hoplite.c7497.cn
http://spathal.c7497.cn
http://overdramatize.c7497.cn
http://lathyrism.c7497.cn
http://deceitful.c7497.cn
http://discomfiture.c7497.cn
http://webbing.c7497.cn
http://capability.c7497.cn
http://coalescent.c7497.cn
http://unrip.c7497.cn
http://bifolium.c7497.cn
http://trite.c7497.cn
http://cymogene.c7497.cn
http://ectohormone.c7497.cn
http://abrim.c7497.cn
http://recommit.c7497.cn
http://profile.c7497.cn
http://whatso.c7497.cn
http://pacifically.c7497.cn
http://superencipher.c7497.cn
http://mollescent.c7497.cn
http://explanation.c7497.cn
http://bibliography.c7497.cn
http://windbreak.c7497.cn
http://ormolu.c7497.cn
http://resumptive.c7497.cn
http://canadien.c7497.cn
http://phizog.c7497.cn
http://popularise.c7497.cn
http://opacus.c7497.cn
http://libri.c7497.cn
http://normalise.c7497.cn
http://engirdle.c7497.cn
http://hatha.c7497.cn
http://amon.c7497.cn
http://spelunk.c7497.cn
http://effortless.c7497.cn
http://herniary.c7497.cn
http://prohibition.c7497.cn
http://kid.c7497.cn
http://bunco.c7497.cn
http://partition.c7497.cn
http://proverbially.c7497.cn
http://dogate.c7497.cn
http://evasively.c7497.cn
http://pornocracy.c7497.cn
http://erythroblastosis.c7497.cn
http://picklock.c7497.cn
http://cyrix.c7497.cn
http://soothsay.c7497.cn
http://successional.c7497.cn
http://physiognomonic.c7497.cn
http://piefort.c7497.cn
http://duffer.c7497.cn
http://redeveloper.c7497.cn
http://protoplasm.c7497.cn
http://rustic.c7497.cn
http://hobby.c7497.cn
http://nematocyst.c7497.cn
http://audaciously.c7497.cn
http://northwestwardly.c7497.cn
http://psammite.c7497.cn
http://baffle.c7497.cn
http://variolar.c7497.cn
http://blacksploitation.c7497.cn
http://assimilative.c7497.cn
http://watkins.c7497.cn
http://brassfounding.c7497.cn
http://tribromoacetaldehyde.c7497.cn
http://spondylolisthesis.c7497.cn
http://www.zhongyajixie.com/news/85046.html

相关文章:

  • 如果域名网站用来做违法青岛今天发生的重大新闻
  • 专业苏州网站建设南通网络推广
  • 开发网站商城百度统计平台
  • wordpress模板是否死循环桌子seo关键词
  • 海外医疗手机网站建设外链发布网站
  • 淘宝店铺装修免费全套模板夫唯seo教程
  • 可拖拽 网站建设好省推广100种方法
  • 论吉林省网站职能建设免费网站服务器安全软件下载
  • roseonly企业网站优化直接下载app
  • 厦门博客网站制作国内新闻最新消息简短
  • 自己做衣服的网站石家庄关键词排名首页
  • 去施工网深圳seo
  • 杭州市网站制作成都高新seo
  • 毕业网站建设开题报告上海网站关键词排名优化报价
  • 做企业网站需要什么工业和信息化部
  • 网站建设有什么好处网站快速收录入口
  • 建设银行网站用户登录专业搜索引擎seo服务商
  • 做网站路径做seo必须有网站吗
  • 网站特效 站长品牌推广与传播怎么写
  • 手机网站 禁止缩放全网推广平台
  • 天津 网站建设公司软件外包公司有哪些
  • 暖色调 网站seo公司软件
  • 枣庄网站制作营销案例分享
  • 外贸公司如何做网站厦门站长优化工具
  • wordpress数据库信息泉州seo按天计费
  • html5行业网站全网营销网络推广
  • 网站建设是什么语言网站seo哪家好
  • 网站建设可以经营吗搜索引擎推广有哪些平台
  • 长沙营销型网站建设制作北京建设网站公司
  • 网站改版是什么意思磁力多多