postgresql 数据库schema 复制

------ 
--- 导出 
pg_dump -h *.*.*.*  -p 5432 -d you_databasename -n you_schema -f you_sqlfile.sql

---- 替换schema 名称
sed -i 's/^SET search_path = oldyou_schemaname, pg_catalog;$/SET search_path = newyou_schemaname, pg_catalog;/' you_sqlfile.sql

---- 没跑过
----sed -i 's/^oldyou_schemaname.$/newyou_schemaname./' you_sqlfile.sql

---- 导入指定数据库下
psql -d you_databasename -U postgres -f you_sqlfile.sql

  

    原文作者:PostgreSQL
    原文地址: https://www.cnblogs.com/jackicalSong/p/8716186.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞