From 06097e22951c7991bd156cf07573ffd7f502e18d Mon Sep 17 00:00:00 2001 From: Wllove Date: Wed, 10 Aug 2022 11:41:21 +0800 Subject: [PATCH 01/11] add blog --- content/zh/post/wllove/gs_restore.md | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 content/zh/post/wllove/gs_restore.md diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md new file mode 100644 index 00000000..9fe55b71 --- /dev/null +++ b/content/zh/post/wllove/gs_restore.md @@ -0,0 +1,67 @@ ++++ +title = "openGauss社区入门(git使用基础)" +date = "2020-05-30" +tags = ["openGauss社区开发入门"] +archives = "2020-05" +author = "wllove" +summary = "gs_restore导入数据" +img = "" +times = "17:30" ++++ +gs_restore命令基本用法 +gs_restore具备如下两种功能。 +1.导入至数据库 +如果指定了数据库,则数据将被导入到指定的数据库中。其中,并行导入必须指定连接数据库的密码。导入时生成列会自动更新,并像普通列一样保存。 +2.导入至脚本文件 +如果未指定导入数据库,则创建包含重建数据库所需的SQL语句脚本,并将其写入至文件或者标准输出。该脚本文件等效于gs_dump导出的纯文本格式文件。 +gs_restore工具在导入时,允许用户选择需要导入的内容,并支持在数据导入前对等待导入的内容进行排序。 + +gs_restore示例 +gs_restore -U jack /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c +常用参数说明 +-U 连接数据库的用户名。 +-W 指定用户连接的密码。 +如果主机的认证策略是trust,则不会对数据库管理员进行密码验证,即无需输入-W选项; +如果没有-W选项,并且不是数据库管理员,会提示用户输入密码。 +-d 连接数据库dbname,并直接将数据导入到该数据库中。 +-p 指定服务器所侦听的TCP端口或本地Unix域套接字后缀,以确保连接。 +-e 当发送SQL语句到数据库时如果出现错误,则退出。默认状态下会忽略错误任务并继续执行导入,且在导入后会显示一系列错误信息。 +-c 在重新创建数据库对象前,清理(删除)已存在于将要导入的数据库中的数据库对象。 +-s 只导入模式定义,不导入数据。当前的序列值也不会被导入。 + +gs_restore常见用法 +示例一:执行gs_restore,导入指定MPPDB_backup.dmp文件(自定义归档格式)中postgres数据库的数据和对象定义。 +、、、 +gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb +Password: +gs_restore[2017-07-21 19:16:26]: restore operation successful +gs_restore: total time: 13053 ms +、、、 +示例二:执行gs_restore,导入指定MPPDB_backup.tar文件(tar归档格式)中postgres数据库的数据和对象定义。 +、、、 +gs_restore backup/MPPDB_backup.tar -p 8000 -d backupdb +gs_restore[2017-07-21 19:21:32]: restore operation successful +gs_restore[2017-07-21 19:21:32]: total time: 21203 ms +、、、 +示例三:执行gs_restore,导入指定MPPDB_backup目录文件(目录归档格式)中postgres数据库的数据和对象定义。 +、、、 +gs_restore backup/MPPDB_backup -p 8000 -d backupdb +gs_restore[2017-07-21 19:26:46]: restore operation successful +gs_restore[2017-07-21 19:26:46]: total time: 21003 ms +、、、 +示例四:执行gs_restore,将postgres数据库的所有对象的定义导入至backupdb数据库。导入前,数据库存在完整的定义和数据,导入后,backupdb数据库只存在所有对象定义,表没有数据。 +、、、 +gs_restore /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c +Password: +gs_restore[2017-07-21 19:46:27]: restore operation successful +gs_restore[2017-07-21 19:46:27]: total time: 32993 ms +、、、 +示例五:执行gs_restore,导入MPPDB_backup.dmp文件中hr模式下表hr.staffs的定义。在导入之前,hr.staffs表不存在,需要确保存在hr的schema。 +、、、 +gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb -e -c -s -n hr -t staffs +gs_restore[2017-07-21 19:56:29]: restore operation successful +gs_restore[2017-07-21 19:56:29]: total time: 21000 ms +、、、 + + + -- Gitee From cf866db256a6b152244f8ff0078cbb843f9d595b Mon Sep 17 00:00:00 2001 From: wllove Date: Wed, 10 Aug 2022 09:07:38 +0000 Subject: [PATCH 02/11] update content/zh/post/wllove/gs_restore.md. --- content/zh/post/wllove/gs_restore.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 9fe55b71..1186dd38 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -1,12 +1,12 @@ +++ -title = "openGauss社区入门(git使用基础)" +title = "gs_restore导入数据" date = "2020-05-30" -tags = ["openGauss社区开发入门"] -archives = "2020-05" +tags = ["gs_restore导入数据"] +archives = "2020-08" author = "wllove" summary = "gs_restore导入数据" img = "" -times = "17:30" +times = "15:30" +++ gs_restore命令基本用法 gs_restore具备如下两种功能。 -- Gitee From b3b43ba749c6a120be23300b34108ce433c56463 Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 9 Sep 2022 06:26:45 +0000 Subject: [PATCH 03/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 1186dd38..c6cc41c3 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -5,7 +5,6 @@ tags = ["gs_restore导入数据"] archives = "2020-08" author = "wllove" summary = "gs_restore导入数据" -img = "" times = "15:30" +++ gs_restore命令基本用法 @@ -30,38 +29,40 @@ gs_restore -U jack /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e - -s 只导入模式定义,不导入数据。当前的序列值也不会被导入。 gs_restore常见用法 + 示例一:执行gs_restore,导入指定MPPDB_backup.dmp文件(自定义归档格式)中postgres数据库的数据和对象定义。 -、、、 + gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb Password: gs_restore[2017-07-21 19:16:26]: restore operation successful gs_restore: total time: 13053 ms -、、、 + 示例二:执行gs_restore,导入指定MPPDB_backup.tar文件(tar归档格式)中postgres数据库的数据和对象定义。 -、、、 + gs_restore backup/MPPDB_backup.tar -p 8000 -d backupdb gs_restore[2017-07-21 19:21:32]: restore operation successful gs_restore[2017-07-21 19:21:32]: total time: 21203 ms -、、、 + 示例三:执行gs_restore,导入指定MPPDB_backup目录文件(目录归档格式)中postgres数据库的数据和对象定义。 -、、、 + gs_restore backup/MPPDB_backup -p 8000 -d backupdb gs_restore[2017-07-21 19:26:46]: restore operation successful gs_restore[2017-07-21 19:26:46]: total time: 21003 ms -、、、 + + 示例四:执行gs_restore,将postgres数据库的所有对象的定义导入至backupdb数据库。导入前,数据库存在完整的定义和数据,导入后,backupdb数据库只存在所有对象定义,表没有数据。 -、、、 + gs_restore /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c Password: gs_restore[2017-07-21 19:46:27]: restore operation successful gs_restore[2017-07-21 19:46:27]: total time: 32993 ms -、、、 + 示例五:执行gs_restore,导入MPPDB_backup.dmp文件中hr模式下表hr.staffs的定义。在导入之前,hr.staffs表不存在,需要确保存在hr的schema。 -、、、 + gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb -e -c -s -n hr -t staffs gs_restore[2017-07-21 19:56:29]: restore operation successful gs_restore[2017-07-21 19:56:29]: total time: 21000 ms -、、、 + -- Gitee From f9aa23bdae55f05d2b8bdb375cb5d1bf77d36c47 Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 9 Sep 2022 06:27:31 +0000 Subject: [PATCH 04/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index c6cc41c3..27a96c23 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -16,16 +16,25 @@ gs_restore具备如下两种功能。 gs_restore工具在导入时,允许用户选择需要导入的内容,并支持在数据导入前对等待导入的内容进行排序。 gs_restore示例 + gs_restore -U jack /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c + 常用参数说明 + -U 连接数据库的用户名。 + -W 指定用户连接的密码。 如果主机的认证策略是trust,则不会对数据库管理员进行密码验证,即无需输入-W选项; 如果没有-W选项,并且不是数据库管理员,会提示用户输入密码。 + -d 连接数据库dbname,并直接将数据导入到该数据库中。 + -p 指定服务器所侦听的TCP端口或本地Unix域套接字后缀,以确保连接。 + -e 当发送SQL语句到数据库时如果出现错误,则退出。默认状态下会忽略错误任务并继续执行导入,且在导入后会显示一系列错误信息。 + -c 在重新创建数据库对象前,清理(删除)已存在于将要导入的数据库中的数据库对象。 + -s 只导入模式定义,不导入数据。当前的序列值也不会被导入。 gs_restore常见用法 -- Gitee From 719174c81a65a19ad2be2bf0208157f3825197b4 Mon Sep 17 00:00:00 2001 From: wllove Date: Sun, 18 Sep 2022 12:13:43 +0000 Subject: [PATCH 05/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 27a96c23..bf6f0835 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -1,8 +1,8 @@ +++ title = "gs_restore导入数据" -date = "2020-05-30" +date = "2022-08-30" tags = ["gs_restore导入数据"] -archives = "2020-08" +archives = "2022-08" author = "wllove" summary = "gs_restore导入数据" times = "15:30" @@ -17,7 +17,9 @@ gs_restore工具在导入时,允许用户选择需要导入的内容,并支 gs_restore示例 +、、、 gs_restore -U jack /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c +、、、 常用参数说明 @@ -41,37 +43,46 @@ gs_restore常见用法 示例一:执行gs_restore,导入指定MPPDB_backup.dmp文件(自定义归档格式)中postgres数据库的数据和对象定义。 +、、、 gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb Password: gs_restore[2017-07-21 19:16:26]: restore operation successful gs_restore: total time: 13053 ms +、、、 示例二:执行gs_restore,导入指定MPPDB_backup.tar文件(tar归档格式)中postgres数据库的数据和对象定义。 +、、、 gs_restore backup/MPPDB_backup.tar -p 8000 -d backupdb gs_restore[2017-07-21 19:21:32]: restore operation successful gs_restore[2017-07-21 19:21:32]: total time: 21203 ms +、、、 示例三:执行gs_restore,导入指定MPPDB_backup目录文件(目录归档格式)中postgres数据库的数据和对象定义。 +、、、 gs_restore backup/MPPDB_backup -p 8000 -d backupdb gs_restore[2017-07-21 19:26:46]: restore operation successful gs_restore[2017-07-21 19:26:46]: total time: 21003 ms +、、、 示例四:执行gs_restore,将postgres数据库的所有对象的定义导入至backupdb数据库。导入前,数据库存在完整的定义和数据,导入后,backupdb数据库只存在所有对象定义,表没有数据。 +、、、 gs_restore /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c Password: gs_restore[2017-07-21 19:46:27]: restore operation successful gs_restore[2017-07-21 19:46:27]: total time: 32993 ms +、、、 示例五:执行gs_restore,导入MPPDB_backup.dmp文件中hr模式下表hr.staffs的定义。在导入之前,hr.staffs表不存在,需要确保存在hr的schema。 +、、、 gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb -e -c -s -n hr -t staffs gs_restore[2017-07-21 19:56:29]: restore operation successful gs_restore[2017-07-21 19:56:29]: total time: 21000 ms - +、、、 -- Gitee From a00427ef0ca6bcfb16051cb126774915b3e42cd3 Mon Sep 17 00:00:00 2001 From: wllove Date: Sun, 18 Sep 2022 12:15:19 +0000 Subject: [PATCH 06/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index bf6f0835..eb12d8b1 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -9,9 +9,13 @@ times = "15:30" +++ gs_restore命令基本用法 gs_restore具备如下两种功能。 -1.导入至数据库 + +1.导入至数据库 + 如果指定了数据库,则数据将被导入到指定的数据库中。其中,并行导入必须指定连接数据库的密码。导入时生成列会自动更新,并像普通列一样保存。 -2.导入至脚本文件 + +2.导入至脚本文件 + 如果未指定导入数据库,则创建包含重建数据库所需的SQL语句脚本,并将其写入至文件或者标准输出。该脚本文件等效于gs_dump导出的纯文本格式文件。 gs_restore工具在导入时,允许用户选择需要导入的内容,并支持在数据导入前对等待导入的内容进行排序。 -- Gitee From fac01c30b3334058c705ba6146050e93643aec8f Mon Sep 17 00:00:00 2001 From: wllove Date: Sun, 18 Sep 2022 12:29:39 +0000 Subject: [PATCH 07/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index eb12d8b1..263191c6 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -1,11 +1,11 @@ +++ -title = "gs_restore导入数据" -date = "2022-08-30" -tags = ["gs_restore导入数据"] -archives = "2022-08" -author = "wllove" -summary = "gs_restore导入数据" -times = "15:30" +title = "gs_restore导入数据" +date = "2022-08-30" +tags = ["gs_restore导入数据"] +archives = "2022-08" +author = "wllove" +summary = "gs_restore导入数据" +times = "15:30" +++ gs_restore命令基本用法 gs_restore具备如下两种功能。 @@ -21,9 +21,9 @@ gs_restore工具在导入时,允许用户选择需要导入的内容,并支 gs_restore示例 -、、、 +``` gs_restore -U jack /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c -、、、 +``` 常用参数说明 @@ -47,46 +47,46 @@ gs_restore常见用法 示例一:执行gs_restore,导入指定MPPDB_backup.dmp文件(自定义归档格式)中postgres数据库的数据和对象定义。 -、、、 +``` gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb Password: gs_restore[2017-07-21 19:16:26]: restore operation successful gs_restore: total time: 13053 ms -、、、 +``` 示例二:执行gs_restore,导入指定MPPDB_backup.tar文件(tar归档格式)中postgres数据库的数据和对象定义。 -、、、 +``` gs_restore backup/MPPDB_backup.tar -p 8000 -d backupdb gs_restore[2017-07-21 19:21:32]: restore operation successful gs_restore[2017-07-21 19:21:32]: total time: 21203 ms -、、、 +``` 示例三:执行gs_restore,导入指定MPPDB_backup目录文件(目录归档格式)中postgres数据库的数据和对象定义。 -、、、 +``` gs_restore backup/MPPDB_backup -p 8000 -d backupdb gs_restore[2017-07-21 19:26:46]: restore operation successful gs_restore[2017-07-21 19:26:46]: total time: 21003 ms -、、、 +``` 示例四:执行gs_restore,将postgres数据库的所有对象的定义导入至backupdb数据库。导入前,数据库存在完整的定义和数据,导入后,backupdb数据库只存在所有对象定义,表没有数据。 -、、、 +``` gs_restore /home/omm/backup/MPPDB_backup.tar -p 8000 -d backupdb -s -e -c Password: gs_restore[2017-07-21 19:46:27]: restore operation successful gs_restore[2017-07-21 19:46:27]: total time: 32993 ms -、、、 +``` 示例五:执行gs_restore,导入MPPDB_backup.dmp文件中hr模式下表hr.staffs的定义。在导入之前,hr.staffs表不存在,需要确保存在hr的schema。 -、、、 +``` gs_restore backup/MPPDB_backup.dmp -p 8000 -d backupdb -e -c -s -n hr -t staffs gs_restore[2017-07-21 19:56:29]: restore operation successful gs_restore[2017-07-21 19:56:29]: total time: 21000 ms -、、、 +``` -- Gitee From 5bf65b294e1455399c2a17f92c537a9c07018493 Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 23 Sep 2022 07:14:36 +0000 Subject: [PATCH 08/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 263191c6..57b0eb7d 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -4,6 +4,7 @@ date = "2022-08-30" tags = ["gs_restore导入数据"] archives = "2022-08" author = "wllove" +img = "" summary = "gs_restore导入数据" times = "15:30" +++ -- Gitee From b0625391f1a3371a5bd7d361480337cba118b309 Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 23 Sep 2022 08:31:33 +0000 Subject: [PATCH 09/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 57b0eb7d..b96962f7 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -4,7 +4,7 @@ date = "2022-08-30" tags = ["gs_restore导入数据"] archives = "2022-08" author = "wllove" -img = "" +img = "/zh/post/wllove/title/title.jpg" summary = "gs_restore导入数据" times = "15:30" +++ -- Gitee From 7c7a0fecbc78b471c666bf9ec98c4e7adca45e70 Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 23 Sep 2022 10:00:13 +0000 Subject: [PATCH 10/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index b96962f7..89b70a33 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -4,7 +4,7 @@ date = "2022-08-30" tags = ["gs_restore导入数据"] archives = "2022-08" author = "wllove" -img = "/zh/post/wllove/title/title.jpg" +img = "/zh/post/wllove/title/title.png" summary = "gs_restore导入数据" times = "15:30" +++ -- Gitee From 98c3785f5e3d9b001e0e57f6dd0235dbc006fbeb Mon Sep 17 00:00:00 2001 From: wllove Date: Fri, 14 Oct 2022 00:58:29 +0000 Subject: [PATCH 11/11] update content/zh/post/wllove/gs_restore.md. Signed-off-by: wllove --- content/zh/post/wllove/gs_restore.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/zh/post/wllove/gs_restore.md b/content/zh/post/wllove/gs_restore.md index 89b70a33..b267ba4b 100644 --- a/content/zh/post/wllove/gs_restore.md +++ b/content/zh/post/wllove/gs_restore.md @@ -1,4 +1,4 @@ -+++ ++++ title = "gs_restore导入数据" date = "2022-08-30" tags = ["gs_restore导入数据"] @@ -7,9 +7,10 @@ author = "wllove" img = "/zh/post/wllove/title/title.png" summary = "gs_restore导入数据" times = "15:30" -+++ -gs_restore命令基本用法 -gs_restore具备如下两种功能。 ++++ + +gs_restore命令基本用法 +gs_restore具备如下两种功能。 1.导入至数据库 -- Gitee