openGauss这么多工具?到底要选哪个?(164)

29 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

示例6:执行gs_dump,仅导出依赖于指定表testtable的视图信息。然后创建新的testtable表,再恢复依赖其上的视图。

  • 备份仅依赖于testtable的视图。

    gs_dump -s -p 37300 postgres -t PUBLIC.testtable --include-depend-objs --exclude-self -f backup/MPPDB_backup.sql -F p
    gs_dump[port='37300'][postgres][2018-06-15 14:12:54]: The total objects number is 331.
    gs_dump[port='37300'][postgres][2018-06-15 14:12:54]: [100.00%] 331 objects have been dumped.
    gs_dump[port='37300'][postgres][2018-06-15 14:12:54]: dump database postgres successfully
    gs_dump[port='37300'][postgres][2018-06-15 14:12:54]: total time: 327  ms
    
  • 修改testtable名称。

    gsql -p 37300 postgres -r -c "ALTER TABLE PUBLIC.testtable RENAME TO testtable_bak;"
    
  • 创建新的testtable表。

    CREATE TABLE PUBLIC.testtable(a int, b int, c int);
    
  • 还原依赖于testtable的视图。

    gsql -p 37300 postgres -r -f backup/MPPDB_backup.sql
    

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/