{"id":31,"date":"2026-01-21T11:03:02","date_gmt":"2026-01-21T03:03:02","guid":{"rendered":"https:\/\/yuriblog.online\/?p=31"},"modified":"2026-01-27T16:58:58","modified_gmt":"2026-01-27T08:58:58","slug":"gs_restore-%e6%8a%a5%e9%94%99","status":"publish","type":"post","link":"https:\/\/yuriblog.online\/index.php\/2026\/01\/21\/gs_restore-%e6%8a%a5%e9%94%99\/","title":{"rendered":"gs_restore \u62a5\u9519"},"content":{"rendered":"\n<p id=\"u05f14e0b\">gs_restore -p 8000 -U erp_gk_dev -W &#8216;HmDEB!skJPeW3G7W&#8217; -d erpdata_gk_dev -j 4 -F c -v erp_gk_dev_20250813_bak.dump &gt; imp_erp_gk_dev_20250813_bak.log<\/p>\n\n\n\n<p id=\"u06d5565a\">\u5982\u679c\u6062\u590d\u65f6\u6709\u7c7b\u4f3c\u62a5\u9519<\/p>\n\n\n\n<p id=\"ue6038179\">restoring data for table &#8220;gwrcistest.demo_user&#8221; table demo_user complete data imported ! launching item 8801 TABLE DATA sync_mdm_customer_area Error from TOC entry 7798; 2604 1114378 DEFAULT id gwrcistest could not execute query: ERROR: permission denied to set parameter &#8220;session_replication_role&#8221; Command was: SET session_replication_role = replica;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"QJ2QO\">\u4e00\u3001\u4e3a\u4ec0\u4e48\u4f1a\u4ea7\u751f\u8fd9\u4e2a\u62a5\u9519<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"xZ6Uk\">\u6839\u672c\u539f\u56e0<\/h3>\n\n\n\n<p id=\"u0fa5e4f6\">1.\u5907\u4efd\u8868\u4e0a\u5b9a\u4e49\u4e86\u89e6\u53d1\u5668<\/p>\n\n\n\n<p id=\"u991ad8d8\">2.\u6062\u590d\u64cd\u4f5c\u5305\u542b\u6570\u636e\u5bfc\u5165<\/p>\n\n\n\n<p id=\"u0db0b807\">3.\u7528\u6237\u662f\u666e\u901a\u7528\u6237\uff0c\u6ca1\u6709sysadmin\u6743\u9650<\/p>\n\n\n\n<p id=\"u22ec3763\">\u5fc5\u987b\u540c\u65f6\u6ee1\u8db3\u4ee5\u4e0a\u4e09\u70b9\u6761\u4ef6\u624d\u4f1a\u4ea7\u751f\u8fd9\u4e2a\u62a5\u9519<\/p>\n\n\n\n<p id=\"ufed5514b\">\u5982\u679c\u5bfc\u5165\u7684\u8868\u6709\u89e6\u53d1\u5668\u5e76\u4e14\u6062\u590d\u6570\u636e gs_restore \u5728\u6062\u590d\u65f6\u4f1a\u6307\u5b9asession_replication_role = replica \u5728\u6062\u590d\u5b8c\u6210\u540e\u8bbe\u7f6esession_replication_role =<strong> <\/strong>origin\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u8bbe\u7f6e <code>SET session_replication_role<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Z6rja\">\u4e8c\u3001.session_replication_role\u662f\u4ec0\u4e48<\/h2>\n\n\n\n<p id=\"u0c0b1d24\">\u5b98\u65b9\u6587\u6863\u89e3\u91ca<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cdn.nlark.com\/yuque\/0\/2026\/png\/59814236\/1768896043221-4e15b3d2-7c29-4a4f-89ee-20e66957a7b2.png\" alt=\"\" title=\"\"\/><\/figure>\n\n\n\n<p id=\"u2dcd5e4f\"><code>session_replication_role<\/code> \u662f PostgreSQL\/GaussDB \u7684\u4e00\u4e2a<strong>\u4f1a\u8bdd\u7ea7\u53c2\u6570<\/strong>\uff0c\u7528\u4e8e\u63a7\u5236\u89e6\u53d1\u5668\u548c\u89c4\u5219\u7684\u884c\u4e3a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>\u6a21\u5f0f<\/strong><\/td><td><strong>\u89e6\u53d1\u5668\u72b6\u6001<\/strong><\/td><td><strong>\u4f7f\u7528\u573a\u666f<\/strong><\/td><\/tr><tr><td><strong>origin<\/strong><\/td><td>\u2705 \u542f\u7528<\/td><td>\u6b63\u5e38\u4e1a\u52a1\u64cd\u4f5c<\/td><\/tr><tr><td><strong>replica<\/strong><\/td><td>\u274c \u7981\u7528<\/td><td>\u6570\u636e\u6062\u590d\u3001\u590d\u5236<\/td><\/tr><tr><td><strong>local<\/strong><\/td><td>\u26a0\ufe0f \u68c0\u67e5<\/td><td>\u6781\u5c11\u4f7f\u7528<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p id=\"u042a92e7\">.\u5982\u4f55\u89e3\u51b3<\/p>\n\n\n\n<p id=\"ub1e9c941\"><code>gs_restore<\/code><strong>\u5728\u5bfc\u5165\u6570\u636e\u8868\u65f6<\/strong> \u4f1a\u5c1d\u8bd5\u8bbe\u7f6e <code>session_replication_role = replica<\/code>\uff0c\u4ee5<strong>\u7981\u7528\u89e6\u53d1\u5668<\/strong>\u907f\u514d\u6570\u636e\u5bfc\u5165\u8fc7\u7a0b\u4e2d\u7684\u89e6\u53d1\u5668\u5e72\u6270\uff0c\u4f46\u60a8\u7684\u7528\u6237\u6743\u9650\u4e0d\u8db3<\/p>\n\n\n\n<p id=\"u274555fa\">\u5728\u5bfc\u5165\u4e4b\u524d\u6388\u4e88sysadmin\u6743\u9650\uff0c\u5bfc\u5165\u540e\u518d\u56de\u6536<\/p>\n\n\n\n<p id=\"ud4f17a44\">ALTER USER gwrcistest WITH SYSADMIN;<\/p>\n\n\n\n<p id=\"u9bf6215c\">ALTER USER gwrcistest NOSYSADMIN;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gs_restore -p 8000 -U erp_gk_dev -W &#8216;HmDEB!skJPeW [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,24],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-domestic-databases","category-gaussdb"],"_links":{"self":[{"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":2,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/posts\/31\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuriblog.online\/index.php\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}