{"id":160599,"date":"2024-11-03T23:26:20","date_gmt":"2024-11-03T15:26:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/160599\/"},"modified":"2024-11-03T23:26:21","modified_gmt":"2024-11-03T15:26:21","slug":"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-%e6%96%b0%e5%bb%ba%e9%a1%9e%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/160599\/","title":{"rendered":"OceanBase \u6559\u7a0b\uff1aOceanBase \u65b0\u5efa\u985e\u578b"},"content":{"rendered":"<h1 id=\"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-%e6%96%b0%e5%bb%ba%e9%a1%9e%e5%9e%8b-gHuuPBoREY\">OceanBase \u6559\u7a0b\uff1aOceanBase \u65b0\u5efa\u985e\u578b<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u5eab\u6280\u8853\u4e2d\uff0cOceanBase \u4f5c\u70ba\u4e00\u6b3e\u9ad8\u6027\u80fd\u7684\u5206\u4f48\u5f0f\u6578\u64da\u5eab\uff0c\u8d8a\u4f86\u8d8a\u53d7\u5230\u958b\u767c\u8005\u548c\u4f01\u696d\u7684\u9752\u775e\u3002\u5b83\u4e0d\u50c5\u652f\u6301\u9ad8\u4e26\u767c\u7684\u4e8b\u52d9\u8655\u7406\uff0c\u9084\u5177\u5099\u826f\u597d\u7684\u64f4\u5c55\u6027\u548c\u5bb9\u932f\u80fd\u529b\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 OceanBase \u4e2d\u5275\u5efa\u65b0\u7684\u6578\u64da\u985e\u578b\uff0c\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u5229\u7528\u9019\u4e00\u5f37\u5927\u7684\u6578\u64da\u5eab\u7cfb\u7d71\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-oceanbase%ef%bc%9f-gHuuPBoREY\">\u4ec0\u9ebc\u662f OceanBase\uff1f<\/h2>\n<p>OceanBase \u662f\u7531\u963f\u91cc\u5df4\u5df4\u958b\u767c\u7684\u4e00\u6b3e\u5206\u4f48\u5f0f\u6578\u64da\u5eab\uff0c\u65e8\u5728\u89e3\u6c7a\u5927\u898f\u6a21\u6578\u64da\u5b58\u5132\u548c\u8655\u7406\u7684\u9700\u6c42\u3002\u5b83\u652f\u6301 SQL \u8a9e\u8a00\uff0c\u4e26\u4e14\u517c\u5bb9 MySQL \u548c Oracle \u7684\u8a9e\u6cd5\uff0c\u9019\u4f7f\u5f97\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u4e0a\u624b\u3002OceanBase \u7684\u67b6\u69cb\u8a2d\u8a08\u4f7f\u5176\u80fd\u5920\u5728\u591a\u500b\u7bc0\u9ede\u4e4b\u9593\u5206\u6563\u6578\u64da\uff0c\u5f9e\u800c\u63d0\u9ad8\u4e86\u7cfb\u7d71\u7684\u53ef\u7528\u6027\u548c\u6027\u80fd\u3002<\/p>\n<h2 id=\"%e6%96%b0%e5%bb%ba%e9%a1%9e%e5%9e%8b%e7%9a%84%e5%bf%85%e8%a6%81%e6%80%a7-gHuuPBoREY\">\u65b0\u5efa\u985e\u578b\u7684\u5fc5\u8981\u6027<\/h2>\n<p>\u5728 OceanBase \u4e2d\uff0c\u6578\u64da\u985e\u578b\u7684\u5b9a\u7fa9\u5c0d\u65bc\u6578\u64da\u7684\u5b58\u5132\u548c\u64cd\u4f5c\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u5275\u5efa\u81ea\u5b9a\u7fa9\u985e\u578b\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u66f4\u9748\u6d3b\u5730\u8655\u7406\u7279\u5b9a\u7684\u696d\u52d9\u9700\u6c42\u3002\u4f8b\u5982\uff0c\u7576\u9700\u8981\u5b58\u5132\u8907\u96dc\u7684\u6578\u64da\u7d50\u69cb\u6642\uff0c\u81ea\u5b9a\u7fa9\u985e\u578b\u53ef\u4ee5\u5e6b\u52a9\u7c21\u5316\u6578\u64da\u7684\u7ba1\u7406\u548c\u67e5\u8a62\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-oceanbase-%e4%b8%ad%e5%89%b5%e5%bb%ba%e6%96%b0%e9%a1%9e%e5%9e%8b-gHuuPBoREY\">\u5982\u4f55\u5728 OceanBase \u4e2d\u5275\u5efa\u65b0\u985e\u578b<\/h2>\n<p>\u5728 OceanBase \u4e2d\u5275\u5efa\u65b0\u985e\u578b\u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\uff0c\u4ee5\u4e0b\u662f\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-1%ef%bc%9a%e9%80%a3%e6%8e%a5%e5%88%b0-oceanbase-%e6%95%b8%e6%93%9a%e5%ba%ab-gHuuPBoREY\">\u6b65\u9a5f 1\uff1a\u9023\u63a5\u5230 OceanBase \u6578\u64da\u5eab<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u4f7f\u7528\u652f\u6301\u7684\u5ba2\u6236\u7aef\u5de5\u5177\uff08\u5982 MySQL \u5ba2\u6236\u7aef\uff09\u9023\u63a5\u5230 OceanBase \u6578\u64da\u5eab\u3002\u4ee5\u4e0b\u662f\u9023\u63a5\u7684\u57fa\u672c\u547d\u4ee4\uff1a<\/p>\n<pre><code>mysql -h  -P  -u  -p<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-2%ef%bc%9a%e5%89%b5%e5%bb%ba%e6%96%b0%e9%a1%9e%e5%9e%8b-gHuuPBoREY\">\u6b65\u9a5f 2\uff1a\u5275\u5efa\u65b0\u985e\u578b<\/h3>\n<p>\u4f7f\u7528 SQL \u8a9e\u53e5\u5275\u5efa\u65b0\u985e\u578b\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5275\u5efa\u4e00\u500b\u540d\u70ba `address` \u7684\u81ea\u5b9a\u7fa9\u985e\u578b\uff1a<\/p>\n<pre><code>CREATE TYPE address AS (\n    street VARCHAR(100),\n    city VARCHAR(50),\n    zip_code VARCHAR(10)\n);<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u5275\u5efa\u4e86\u4e00\u500b\u5305\u542b\u8857\u9053\u3001\u57ce\u5e02\u548c\u90f5\u653f\u7de8\u78bc\u7684\u8907\u5408\u985e\u578b\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f-3%ef%bc%9a%e4%bd%bf%e7%94%a8%e6%96%b0%e9%a1%9e%e5%9e%8b-gHuuPBoREY\">\u6b65\u9a5f 3\uff1a\u4f7f\u7528\u65b0\u985e\u578b<\/h3>\n<p>\u5275\u5efa\u985e\u578b\u5f8c\uff0c\u60a8\u53ef\u4ee5\u5728\u8868\u4e2d\u4f7f\u7528\u5b83\u3002\u4f8b\u5982\uff0c\u4ee5\u4e0b SQL \u8a9e\u53e5\u5c55\u793a\u4e86\u5982\u4f55\u5728\u4e00\u500b\u540d\u70ba `users` \u7684\u8868\u4e2d\u4f7f\u7528 `address` \u985e\u578b\uff1a<\/p>\n<pre><code>CREATE TABLE users (\n    id INT PRIMARY KEY,\n    name VARCHAR(50),\n    home_address address\n);<\/code><\/pre>\n<p>\u9019\u6a23\uff0c`home_address` \u5217\u5c31\u53ef\u4ee5\u5b58\u5132 `address` \u985e\u578b\u7684\u6578\u64da\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-gHuuPBoREY\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<ul>\n<li>\u78ba\u4fdd\u5728\u5275\u5efa\u985e\u578b\u4e4b\u524d\uff0c\u60a8\u5df2\u7d93\u5145\u5206\u8003\u616e\u4e86\u696d\u52d9\u9700\u6c42\uff0c\u4ee5\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u4fee\u6539\u3002<\/li>\n<li>\u81ea\u5b9a\u7fa9\u985e\u578b\u7684\u4f7f\u7528\u53ef\u80fd\u6703\u5f71\u97ff\u67e5\u8a62\u6027\u80fd\uff0c\u56e0\u6b64\u5728\u8a2d\u8a08\u6642\u9700\u8b39\u614e\u8003\u616e\u3002<\/li>\n<li>\u5728 OceanBase \u4e2d\uff0c\u985e\u578b\u7684\u4fee\u6539\u548c\u522a\u9664\u53ef\u80fd\u6703\u5f71\u97ff\u5230\u4f9d\u8cf4\u65bc\u8a72\u985e\u578b\u7684\u8868\u548c\u6578\u64da\uff0c\u56e0\u6b64\u5728\u9032\u884c\u9019\u4e9b\u64cd\u4f5c\u6642\u9700\u7279\u5225\u5c0f\u5fc3\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-gHuuPBoREY\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u672c\u6587\u7684\u4ecb\u7d39\uff0c\u6211\u5011\u4e86\u89e3\u4e86\u5982\u4f55\u5728 OceanBase \u4e2d\u5275\u5efa\u65b0\u7684\u6578\u64da\u985e\u578b\uff0c\u9019\u5c0d\u65bc\u958b\u767c\u8005\u5728\u8655\u7406\u8907\u96dc\u6578\u64da\u7d50\u69cb\u6642\u975e\u5e38\u6709\u5e6b\u52a9\u3002\u638c\u63e1\u9019\u4e9b\u6280\u80fd\u5f8c\uff0c\u60a8\u53ef\u4ee5\u66f4\u9748\u6d3b\u5730\u8a2d\u8a08\u6578\u64da\u5eab\u7d50\u69cb\uff0c\u5f9e\u800c\u63d0\u9ad8\u61c9\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u7dad\u8b77\u6027\u3002\u5982\u679c\u60a8\u9700\u8981\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684 OceanBase \u90e8\u7f72\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684\u670d\u52d9\uff0c\u8b93\u60a8\u7684\u6578\u64da\u5eab\u904b\u884c\u66f4\u52a0\u9806\u66a2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 OceanBase \u4e2d\u5275\u5efa\u65b0\u985e\u578b\uff0c\u638c\u63e1\u6578\u64da\u5eab\u8a2d\u8a08\u6280\u5de7\uff0c\u63d0\u5347\u6578\u64da\u7ba1\u7406\u6548\u7387\u3002\u7acb\u5373\u958b\u59cb\u60a8\u7684\u6559\u7a0b\uff01<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-160599","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=160599"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160599\/revisions"}],"predecessor-version":[{"id":160600,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160599\/revisions\/160600"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=160599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=160599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=160599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}