{"id":8786,"date":"2022-02-23T10:24:49","date_gmt":"2022-02-23T02:24:49","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=8786"},"modified":"2022-02-23T10:26:33","modified_gmt":"2022-02-23T02:26:33","slug":"gbase-8a%e6%9f%a5%e7%9c%8b%e5%92%8c%e5%bc%ba%e8%a1%8c%e9%87%8a%e6%94%besql%e6%8c%81%e6%9c%89%e9%94%81%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/8786","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u67e5\u770b\u548c\u5f3a\u884c\u91ca\u653eSQL\u6301\u6709\u9501\u7684\u65b9\u6cd5"},"content":{"rendered":"\n<p>GBase 8a\u5728\u6267\u884c\u65f6\u3002\u4e3a\u907f\u514d\u5e76\u53d1\u51b2\u7a81\u4fdd\u8bc1\u4e00\u81f4\u6027\uff0c\u4f1a\u6301\u6709\u4e00\u4e9b\u9501\u6765\u4fdd\u8bc1\u81ea\u5df1\u9700\u8981\u7684\u8d44\u6e90\u5728\u6267\u884c\u671f\u95f4\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u9501\u5728SQL\u6267\u884c\u5b8c\u6bd5\u540e\u4f1a\u81ea\u52a8\u91ca\u653e\u6389\u3002\u5728\u67d0\u4e9b\u7279\u6b8a\u573a\u666f\u4e0b\uff0c\u7279\u522b\u662f\u4e00\u4e9b\u8001\u7248\u672c\u96c6\u7fa4\uff0c\u51fa\u73b0\u9700\u8981\u5f3a\u884c\u91ca\u653e\u6389\u9501\u7684\u9700\u6c42\uff0c\u6bd4\u5982SQL\u957f\u65f6\u95f4\u65e0\u6cd5\u7ed3\u675f\uff0c\u800c\u8be5SQL\u6301\u6709\u7684\u9501\u53c8\u5bfc\u81f4\u5176\u5b83\u7684SQL\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\uff0c\u540c\u65f6\u73af\u5883\u53c8\u4e0d\u80fd\u91cd\u542f\u8282\u70b9\u670d\u52a1\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u672c\u6587\u7684\u65b9\u6cd5\u5f3a\u884c\u91ca\u653eSQL\u6301\u6709\u7684\u9501\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8eDDL,DML\u7c7b\u7684SQL,\u4e00\u822c\u8981\u914d\u5408failover\u6e05\u7406\uff1a<a href=\"https:\/\/www.gbase8.cn\/8757\">GBase 8a\u67e5\u770b\u548c\u6e05\u7406\u6545\u969c\u6062\u590d\u72b6\u6001Failover\u7684\u65b9\u6cd5<\/a><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55\u5bfc\u822a<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b2142e06b2\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2b2142e06b2\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E5%8F%82%E8%80%83\" >\u53c2\u8003<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E6%9E%84%E9%80%A0%E9%94%81%E7%9A%84%E6%B5%8B%E8%AF%95%E5%9C%BA%E6%99%AF\" >\u6784\u9020\u9501\u7684\u6d4b\u8bd5\u573a\u666f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E6%9F%A5%E7%9C%8BSQL%E6%8C%81%E6%9C%89%E7%9A%84%E9%94%81\" >\u67e5\u770bSQL\u6301\u6709\u7684\u9501<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E9%80%9A%E8%BF%87SQL%E6%9F%A5%E7%9C%8B%E9%94%81\" >\u901a\u8fc7SQL\u67e5\u770b\u9501<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E9%80%9A%E8%BF%87gcadmin%E6%9F%A5%E7%9C%8B%E9%94%81\" >\u901a\u8fc7gcadmin\u67e5\u770b\u9501<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E9%80%9A%E8%BF%87python%E6%9F%A5%E7%9C%8B%E9%94%81\" >\u901a\u8fc7python\u67e5\u770b\u9501<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E9%80%9A%E8%BF%87python%E6%B8%85%E7%90%86%E9%94%81%E7%9A%84%E6%96%B9%E6%B3%95\" >\u901a\u8fc7python\u6e05\u7406\u9501\u7684\u65b9\u6cd5<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E6%8E%A5%E5%8F%A3\" >\u63a5\u53e3<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E6%89%A7%E8%A1%8C%E6%95%88%E6%9E%9C\" >\u6267\u884c\u6548\u679c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.gbase8.cn\/en\/8786\/#%E6%80%BB%E7%BB%93\" >\u603b\u7ed3<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%8F%82%E8%80%83\"><\/span>\u53c2\u8003<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/24\">GBase8a MPP Cluster\u67e5\u770b\u96c6\u7fa4\u9501&nbsp;<mark>showloc<\/mark>k<\/a><br><a href=\"https:\/\/www.gbase8.cn\/8757\">GBase 8a\u67e5\u770b\u548c\u6e05\u7406\u6545\u969c\u6062\u590d\u72b6\u6001Failover\u7684\u65b9\u6cd5<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9E%84%E9%80%A0%E9%94%81%E7%9A%84%E6%B5%8B%E8%AF%95%E5%9C%BA%E6%99%AF\"><\/span>\u6784\u9020\u9501\u7684\u6d4b\u8bd5\u573a\u666f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u4e0b\u901a\u8fc7lock table\u8bed\u53e5\u6784\u9020\u4e86\u4e00\u4e2a\u6301\u6709\u9501\u7684SQL\u573a\u666f\uff0c\u8fde\u63a5\u8282\u70b9\u4e3a201\u3002<\/p>\n\n\n\n<p>\u96c6\u7fa4\u7248\u672c\uff1a8.6.2.43-R33.129391<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# gcadmin\nCLUSTER STATE:  ACTIVE\nCLUSTER MODE:   NORMAL\n\n=================================================================\n|             GBASE COORDINATOR CLUSTER INFORMATION             |\n=================================================================\n|   NodeName   |     IpAddress     |gcware |gcluster |DataState |\n-----------------------------------------------------------------\n| coordinator1 |    10.0.2.201     | OPEN  |  OPEN   |    0     |\n-----------------------------------------------------------------\n=============================================================\n|              GBASE DATA CLUSTER INFORMATION               |\n=============================================================\n|NodeName |     IpAddress     |gnode |syncserver |DataState |\n-------------------------------------------------------------\n|  node1  |    10.0.2.201     | OPEN |   OPEN    |    0     |\n-------------------------------------------------------------\n|  node2  |    10.0.2.202     | OPEN |   OPEN    |    0     |\n-------------------------------------------------------------\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; lock table t1 write;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.01)\n\ngbase&gt; show processlist;\n+-----+-----------------+-----------+--------+---------+-------+-----------------------------+------------------+\n| Id  | User            | Host      | db     | Command | Time  | State                       | Info             |\n+-----+-----------------+-----------+--------+---------+-------+-----------------------------+------------------+\n|   1 | event_scheduler | localhost | NULL   | Daemon  | 42262 | Waiting for next activation | NULL             |\n| 258 | root            | localhost | testdb | Query   |     0 | NULL                        | show processlist |\n+-----+-----------------+-----------+--------+---------+-------+-----------------------------+------------------+\n2 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8BSQL%E6%8C%81%E6%9C%89%E7%9A%84%E9%94%81\"><\/span>\u67e5\u770bSQL\u6301\u6709\u7684\u9501<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%80%9A%E8%BF%87SQL%E6%9F%A5%E7%9C%8B%E9%94%81\"><\/span>\u901a\u8fc7SQL\u67e5\u770b\u9501<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u53ef\u4ee5\u901a\u8fc7show detail processlist\u67e5\u770bSQL\u5f53\u524d\u6301\u6709\u7684\u9501\uff0c\u9700\u8981\u7684\u9501\u7b49\u4fe1\u606f\u3002\u8be6\u60c5\u8bf7\u53c2\u8003 <\/p>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/65\">GBase8a \u663e\u793a\u96c6\u7fa4\u6b63\u5728\u8dd1\u7684SQL\u8fdb\u7a0bshow [full | detail] processlist<\/a><\/p>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230ID=258\u7684\u8fde\u63a5\u6301\u6709\u76843\u4e2a\u9501\uff0c\u7528\u5206\u53f7\u5206\u5272\uff1atestdb;testdb.t1;testdb.t1580D5F90-B287-4199-B057-E6FBD44B5BFA<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; show detail processlist;\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n| Id  | Tid   | User            | Host      | db     | Command | Time  | State                       | Lock                                                           | Wait | Info                    |\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n|   1 | 18648 | event_scheduler | localhost | NULL   | Daemon  | 42525 | Waiting for next activation | NULL                                                           | NULL | NULL                    |\n| 259 |  9985 | root            | localhost | testdb | Query   |     0 | NULL                        | testdb;testdb.t1;testdb.t1580D5F90-B287-4199-B057-E6FBD44B5BFA | NULL | show detail processlist |\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n2 rows in set (Elapsed: 00:00:00.00)\n\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%80%9A%E8%BF%87gcadmin%E6%9F%A5%E7%9C%8B%E9%94%81\"><\/span>\u901a\u8fc7gcadmin\u67e5\u770b\u9501<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7\u547d\u4ee4\u884c\u7684gcadmin showlock\u67e5\u770b\u9501\uff0c\u8be6\u60c5\u8bf7\u53c2\u8003<\/p>\n\n\n\n<p><a href=\"https:\/\/www.gbase8.cn\/24\">GBase8a MPP Cluster\u67e5\u770b\u96c6\u7fa4\u9501&nbsp;<mark>showloc<\/mark>k<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# gcadmin showlock\n +===================================================================================================================+\n |                                                   GCLUSTER LOCK                                                   |\n +===================================================================================================================+\n +---------------------------------------------+----------+-------------------------------+--------------+------+----+\n |                  Lock name                  |  owner   |            content            | create time  |orphan|type|\n +---------------------------------------------+----------+-------------------------------+--------------+------+----+\n |                   testdb                    |10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985)|20220223090419|FALSE | S  |\n +---------------------------------------------+----------+-------------------------------+--------------+------+----+\n |testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa|10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985)|20220223090419|FALSE | E  |\n +---------------------------------------------+----------+-------------------------------+--------------+------+----+\n |                  testdb.t1                  |10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985)|20220223090419|FALSE | S  |\n +---------------------------------------------+----------+-------------------------------+--------------+------+----+\n Total : 3\n&#91;root@rh6-1 ~]#\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%80%9A%E8%BF%87python%E6%9F%A5%E7%9C%8B%E9%94%81\"><\/span>\u901a\u8fc7python\u67e5\u770b\u9501<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>\u901a\u8fc7python\u63a5\u53e3\uff0c\u4ecegcware.getlocks\u62ff\u5230\u9501\u3002\u524d\u9762gcadmin showlock\u7684\u4fe1\u606f\u5c31\u662f\u4ece\u8fd9\u91cc\u83b7\u5f97\u7136\u540e\u683c\u5f0f\u5316\u8f93\u51fa\u7684\u3002\u8bf7\u5173\u6ce8\u5176\u4e2d\u7684<\/p>\n\n\n\n<p>name\uff1a\u9501\u540d\u5b57<br>lockid\uff1a\u9501ID\uff0c\u8fd9\u4e2a\u5728showlock\u91cc\u6ca1\u6709\u663e\u793a\u51fa\u6765\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@rh6-1 ubas]$ python\nPython 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)\n&#91;GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n&gt;&gt;&gt; import gcware\n&gt;&gt;&gt; help('gcware')\n\n&gt;&gt;&gt; gcware.getlocks()\n({'create time': '20220223090419', 'name': 'testdb', 'lockid': 1612718352306798592, 'orphan': 'FALSE', 'content': 'LOCK_Lock_Tables: 259(LWP:9985)', 'owner': '10.0.2.201', 'type': 'SHARE'}, {'create time': '20220223090419', 'name': 'testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa', 'lockid': 8587815309107265537, 'orphan': 'FALSE', 'content': 'LOCK_Lock_Tables: 259(LWP:9985)', 'owner': '10.0.2.201', 'type': 'EXCLUSIVE'}, {'create time': '20220223090419', 'name': 'testdb.t1', 'lockid': 7728385150517510147, 'orphan': 'FALSE', 'content': 'LOCK_Lock_Tables: 259(LWP:9985)', 'owner': '10.0.2.201', 'type': 'SHARE'})\n&gt;&gt;&gt;\n<\/code><\/pre>\n\n\n\n<p>\u6839\u636e\u9501\u540d\u5b57\uff0c\u4ece\u91cc\u9762\u627e\u5230\u5bf9\u5e94\u7684lockid, \u7528\u4e8e\u6e05\u7406\u9501\u7684\u53c2\u6570\u3002\u5148\u627e\u5de5\u5177\u683c\u5f0f\u5316\u4e00\u4e0b\uff0c\u65b9\u4fbf\u89c2\u770b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\t'create time': '20220223090419',\n\t'name': 'testdb',\n\t'lockid': 1612718352306798592,\n\t'orphan': 'FALSE',\n\t'content': 'LOCK_Lock_Tables: 259(LWP:9985)',\n\t'owner': '10.0.2.201',\n\t'type': 'SHARE'\n}, {\n\t'create time': '20220223090419',\n\t'name': 'testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa',\n\t'lockid': 8587815309107265537,\n\t'orphan': 'FALSE',\n\t'content': 'LOCK_Lock_Tables: 259(LWP:9985)',\n\t'owner': '10.0.2.201',\n\t'type': 'EXCLUSIVE'\n}, {\n\t'create time': '20220223090419',\n\t'name': 'testdb.t1',\n\t'lockid': 7728385150517510147,\n\t'orphan': 'FALSE',\n\t'content': 'LOCK_Lock_Tables: 259(LWP:9985)',\n\t'owner': '10.0.2.201',\n\t'type': 'SHARE'\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%80%9A%E8%BF%87python%E6%B8%85%E7%90%86%E9%94%81%E7%9A%84%E6%96%B9%E6%B3%95\"><\/span>\u901a\u8fc7python\u6e05\u7406\u9501\u7684\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6211\u4eec\u5c1d\u8bd5\u91ca\u653e\u4e00\u4e2a\u6392\u5b83\u9501<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\t'create time': '20220223090419',\n\t<span class=\"has-inline-color has-luminous-vivid-orange-color\">'name': 'testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa',\n\t'lockid': 8587815309107265537,<\/span>\n\t'orphan': 'FALSE',\n\t'content': 'LOCK_Lock_Tables: 259(LWP:9985)',\n\t'owner': '10.0.2.201',\n\t'type': 'EXCLUSIVE'<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%8E%A5%E5%8F%A3\"><\/span>\u63a5\u53e3<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>gcware.unlocktableforce(name,lockid)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%89%A7%E8%A1%8C%E6%95%88%E6%9E%9C\"><\/span>\u6267\u884c\u6548\u679c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; gcware.unlocktableforce('testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa',8587815309107265537);\n0\n&gt;&gt;&gt; <\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u9501\u786e\u5b9e\u5c11\u4e86\u4e00\u4e2a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# gcadmin showlock\n +===============================================================================+\n |                                 GCLUSTER LOCK                                 |\n +===============================================================================+\n +---------+----------+-------------------------------+--------------+------+----+\n |Lock name|  owner   |            content            | create time  |orphan|type|\n +---------+----------+-------------------------------+--------------+------+----+\n | testdb  |10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985)|20220223090419|FALSE | S  |\n +---------+----------+-------------------------------+--------------+------+----+\n |testdb.t1|10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985)|20220223090419|FALSE | S  |\n +---------+----------+-------------------------------+--------------+------+----+\n Total : 2\n<\/code><\/pre>\n\n\n\n<p>\u518d\u5f00\u4e00\u4e2a\u8fde\u63a5\uff0c\u5c1d\u8bd5\u62ff\u5230\u9501\u3002\u53d1\u73b0\u53ef\u4ee5\u6b63\u5e38\u62ff\u5230Lock table write, \u4f46show detail processlist\u7684\u6301\u6709\u9501\u4fe1\u606f\u5e76\u6ca1\u6709\u5237\u65b0\uff0c\u6000\u7591....<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@rh6-1 ubas]$ gccli testdb\n\nGBase client 8.6.2.43-R33.129391. Copyright (c) 2004-2022, GBase.  All Rights Reserved.\n\ngbase&gt; lock table t1 write;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.01)\n\ngbase&gt; show detail processlist;\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n| Id  | Tid   | User            | Host      | db     | Command | Time  | State                       | Lock                                                           | Wait | Info                    |\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n|   1 | 18648 | event_scheduler | localhost | NULL   | Daemon  | 46724 | Waiting for next activation | NULL                                                           | NULL | NULL                    |\n| 259 |  9985 | root            | localhost | testdb | Sleep   |    74 |                             | testdb;testdb.t1;testdb.t1580D5F90-B287-4199-B057-E6FBD44B5BFA | NULL | NULL                    |\n| 267 | 10695 | root            | localhost | testdb | Query   |     0 | NULL                        | testdb;testdb.t1;testdb.t1580D5F90-B287-4199-B057-E6FBD44B5BFA | NULL | show detail processlist |\n+-----+-------+-----------------+-----------+--------+---------+-------+-----------------------------+----------------------------------------------------------------+------+-------------------------+\n3 rows in set (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u9501\u6ca1\u6709\u91ca\u653e\uff0c\u4f1a\u4e00\u76f4\u5361\u5728\u8fd9\u91cc<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; lock table t1 write;\n^CQuery aborted by Ctrl+C\nERROR 1100 (HY000): Table 'testdb.t1' was not locked with LOCK TABLES\ngbase&gt;\n<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u5b9e\u9645\u7684\u9501\u60c5\u51b5\uff0c\u5df2\u7ecf\u66f4\u65b0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@rh6-1 ~]# gcadmin showlock\n +====================================================================================================================+\n |                                                   GCLUSTER LOCK                                                    |\n +====================================================================================================================+\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |                  Lock name                  |  owner   |            content             | create time  |orphan|type|\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |                   testdb                    |10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985) |20220223090419|FALSE | S  |\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |                   testdb                    |10.0.2.201|LOCK_Lock_Tables: 267(LWP:10695)|20220223101414|FALSE | S  |\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |testdb.t1580d5f90-b287-4199-b057-e6fbd44b5bfa|10.0.2.201|LOCK_Lock_Tables: 267(LWP:10695)|20220223101414|FALSE | E  |\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |                  testdb.t1                  |10.0.2.201|LOCK_Lock_Tables: 259(LWP:9985) |20220223090419|FALSE | S  |\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n |                  testdb.t1                  |10.0.2.201|LOCK_Lock_Tables: 267(LWP:10695)|20220223101414|FALSE | S  |\n +---------------------------------------------+----------+--------------------------------+--------------+------+----+\n Total : 5\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>\u603b\u7ed3<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>SQL\u6301\u6709\u7684\u9501\u662f\u4e3a\u4e86\u4e00\u81f4\u6027\uff0c\u5f3a\u884c\u6e05\u7406\u9501\u53ef\u80fd\u5bfc\u81f4\u4e0d\u53ef\u9884\u671f\u7684\u7ed3\u679c\uff0c\u6bd4\u5982\u6570\u636e\u9519\u8bef\uff0c\u6240\u4ee5\u53ea\u6709\u5728\u6ca1\u6709\u5176\u5b83\u65b9\u6cd5\u89e3\u51b3\uff0c\u4e14\u80fd\u901a\u8fc7\u5176\u5b83\u624b\u6bb5\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\u7684\u60c5\u51b5\u4e0b(\u6bd4\u5982\u624b\u5de5\u68c0\u67e5\u548c\u540c\u6b65\u6570\u636e\uff09\uff0c\u624d\u80fd\u5f3a\u884c\u6e05\u7406\u9501\u3002<\/p>\n\n\n\n<p>\u8bf7\u614e\u91cd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u5728\u6267\u884c\u65f6\u3002\u4e3a\u907f\u514d\u5e76\u53d1\u51b2\u7a81\u4fdd\u8bc1\u4e00\u81f4\u6027\uff0c\u4f1a\u6301\u6709\u4e00\u4e9b\u9501\u6765\u4fdd\u8bc1\u81ea\u5df1\u9700\u8981\u7684\u8d44\u6e90\u5728\u6267\u884c\u671f\u95f4\u4e0d\u4f1a\u51fa\u73b0\u95ee\u9898\u3002\u9501\u5728SQL\u6267\u884c\u5b8c\u6bd5\u540e\u4f1a\u81ea\u52a8\u91ca\u653e\u6389\u3002\u5728\u67d0\u4e9b\u7279\u6b8a\u573a\u666f\u4e0b\uff0c\u7279\u522b\u662f\u4e00\u4e9b\u8001\u7248\u672c\u96c6\u7fa4\uff0c\u51fa\u73b0\u9700\u8981\u5f3a\u884c\u91ca\u653e\u6389\u9501\u7684\u9700\u6c42\uff0c\u6bd4\u5982SQL\u957f\u65f6\u95f4\u65e0\u6cd5\u7ed3\u675f\uff0c\u800c\u8be5SQL\u6301\u6709\u7684\u9501\u53c8\u5bfc\u81f4\u5176\u5b83\u7684SQL\u65e0\u6cd5\u6b63\u5e38\u8fd0\u884c\uff0c\u540c\u65f6\u73af\u5883\u53c8\u4e0d\u80fd\u91cd\u542f\u8282\u70b9\u670d\u52a1\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u672c\u6587\u7684\u65b9\u6cd5\u5f3a\u884c\u91ca\u653eSQL\u6301\u6709\u7684\u9501\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[51],"class_list":["post-8786","post","type-post","status-publish","format-standard","hentry","category-gbase8a","tag-51"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/8786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=8786"}],"version-history":[{"count":30,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/8786\/revisions"}],"predecessor-version":[{"id":8818,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/8786\/revisions\/8818"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=8786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=8786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=8786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}