{"id":160063,"date":"2024-11-03T19:58:18","date_gmt":"2024-11-03T11:58:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/160063\/"},"modified":"2024-11-03T19:58:19","modified_gmt":"2024-11-03T11:58:19","slug":"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-alter-sequence","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/160063\/","title":{"rendered":"OceanBase \u6559\u7a0b\uff1aOceanBase ALTER SEQUENCE"},"content":{"rendered":"<h1 id=\"oceanbase-%e6%95%99%e7%a8%8b%ef%bc%9aoceanbase-alter-sequence-WByxaSvrmv\">OceanBase \u6559\u7a0b\uff1aOceanBase ALTER SEQUENCE<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\u4e2d\uff0c\u5e8f\u5217\uff08Sequence\uff09\u662f\u4e00\u7a2e\u975e\u5e38\u91cd\u8981\u7684\u6578\u64da\u7d50\u69cb\uff0c\u7279\u5225\u662f\u5728\u9700\u8981\u751f\u6210\u552f\u4e00\u6a19\u8b58\u7b26\u7684\u60c5\u6cc1\u4e0b\u3002OceanBase \u4f5c\u70ba\u4e00\u500b\u9ad8\u6027\u80fd\u7684\u5206\u4f48\u5f0f\u6578\u64da\u5eab\uff0c\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u5e8f\u5217\u7ba1\u7406\u529f\u80fd\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5982\u4f55\u4f7f\u7528 OceanBase \u7684 ALTER SEQUENCE \u8a9e\u53e5\u4f86\u4fee\u6539\u5e8f\u5217\u7684\u5c6c\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af%e5%ba%8f%e5%88%97%ef%bc%88sequence%ef%bc%89%ef%bc%9f-WByxaSvrmv\">\u4ec0\u9ebc\u662f\u5e8f\u5217\uff08Sequence\uff09\uff1f<\/h2>\n<p>\u5e8f\u5217\u662f\u4e00\u7a2e\u6578\u64da\u5eab\u5c0d\u8c61\uff0c\u7528\u65bc\u751f\u6210\u552f\u4e00\u7684\u6574\u6578\u503c\u3002\u9019\u4e9b\u503c\u901a\u5e38\u7528\u4f5c\u4e3b\u9375\u6216\u5176\u4ed6\u9700\u8981\u552f\u4e00\u6a19\u8b58\u7684\u5834\u666f\u3002OceanBase \u652f\u6301\u591a\u7a2e\u5e8f\u5217\u64cd\u4f5c\uff0c\u5305\u62ec\u5275\u5efa\u3001\u522a\u9664\u548c\u4fee\u6539\u5e8f\u5217\u3002<\/p>\n<h2 id=\"alter-sequence-%e8%aa%9e%e6%b3%95-WByxaSvrmv\">ALTER SEQUENCE \u8a9e\u6cd5<\/h2>\n<p>ALTER SEQUENCE \u8a9e\u53e5\u7528\u65bc\u4fee\u6539\u5df2\u5b58\u5728\u7684\u5e8f\u5217\u7684\u5c6c\u6027\u3002\u5176\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>ALTER SEQUENCE sequence_name\n    [ INCREMENT BY increment_value ]\n    [ MINVALUE min_value | NO MINVALUE ]\n    [ MAXVALUE max_value | NO MAXVALUE ]\n    [ CYCLE | NO CYCLE ]\n    [ CACHE cache_size | NO CACHE ]\n    [ RESTART WITH restart_value ];<\/code><\/pre>\n<h2 id=\"alter-sequence-%e7%9a%84%e5%8f%83%e6%95%b8%e8%a7%a3%e9%87%8b-WByxaSvrmv\">ALTER SEQUENCE \u7684\u53c3\u6578\u89e3\u91cb<\/h2>\n<ul>\n<li><strong>sequence_name<\/strong>: \u8981\u4fee\u6539\u7684\u5e8f\u5217\u540d\u7a31\u3002<\/li>\n<li><strong>INCREMENT BY<\/strong>: \u6bcf\u6b21\u751f\u6210\u65b0\u503c\u6642\u7684\u589e\u91cf\u3002<\/li>\n<li><strong>MINVALUE<\/strong>: \u5e8f\u5217\u7684\u6700\u5c0f\u503c\u3002<\/li>\n<li><strong>MAXVALUE<\/strong>: \u5e8f\u5217\u7684\u6700\u5927\u503c\u3002<\/li>\n<li><strong>CYCLE<\/strong>: \u6307\u5b9a\u5e8f\u5217\u5728\u9054\u5230\u6700\u5927\u503c\u5f8c\u662f\u5426\u91cd\u65b0\u958b\u59cb\u3002<\/li>\n<li><strong>CACHE<\/strong>: \u6307\u5b9a\u5e8f\u5217\u5728\u5167\u5b58\u4e2d\u7de9\u5b58\u7684\u503c\u7684\u6578\u91cf\u3002<\/li>\n<li><strong>RESTART WITH<\/strong>: \u6307\u5b9a\u5e8f\u5217\u7684\u4e0b\u4e00\u500b\u503c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e7%af%84%e4%be%8b-WByxaSvrmv\">\u4f7f\u7528\u7bc4\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u4f7f\u7528 ALTER SEQUENCE \u7684\u7bc4\u4f8b\uff0c\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u540d\u70ba <code>my_sequence<\/code> \u7684\u5e8f\u5217\uff0c\u6211\u5011\u5e0c\u671b\u5c07\u5176\u589e\u91cf\u8a2d\u7f6e\u70ba 5\uff0c\u4e26\u5c07\u6700\u5c0f\u503c\u8a2d\u7f6e\u70ba 1\uff1a<\/p>\n<pre><code>ALTER SEQUENCE my_sequence\n    INCREMENT BY 5\n    MINVALUE 1;<\/code><\/pre>\n<p>\u5982\u679c\u6211\u5011\u5e0c\u671b\u5728\u5e8f\u5217\u9054\u5230\u6700\u5927\u503c\u5f8c\u91cd\u65b0\u958b\u59cb\uff0c\u53ef\u4ee5\u9019\u6a23\u8a2d\u7f6e\uff1a<\/p>\n<pre><code>ALTER SEQUENCE my_sequence\n    MAXVALUE 100\n    CYCLE;<\/code><\/pre>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-WByxaSvrmv\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u4f7f\u7528 ALTER SEQUENCE \u6642\uff0c\u6709\u5e7e\u9ede\u9700\u8981\u6ce8\u610f\uff1a<\/p>\n<ul>\n<li>\u4fee\u6539\u5e8f\u5217\u7684\u5c6c\u6027\u4e0d\u6703\u5f71\u97ff\u5df2\u7d93\u751f\u6210\u7684\u503c\u3002<\/li>\n<li>\u5982\u679c\u5e8f\u5217\u5df2\u7d93\u9054\u5230\u6700\u5927\u503c\uff0c\u4e26\u4e14\u8a2d\u7f6e\u4e86 CYCLE\uff0c\u5247\u4e0b\u4e00\u6b21\u751f\u6210\u7684\u503c\u5c07\u6703\u662f\u6700\u5c0f\u503c\u3002<\/li>\n<li>\u5728\u9ad8\u4f75\u767c\u74b0\u5883\u4e2d\uff0c\u5e8f\u5217\u7684\u751f\u6210\u53ef\u80fd\u6703\u51fa\u73fe\u8df3\u865f\u73fe\u8c61\uff0c\u9019\u662f\u7531\u65bc\u591a\u500b\u8acb\u6c42\u540c\u6642\u8a2a\u554f\u5e8f\u5217\u6240\u81f4\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-WByxaSvrmv\">\u7e3d\u7d50<\/h2>\n<p>OceanBase \u7684 ALTER SEQUENCE \u8a9e\u53e5\u63d0\u4f9b\u4e86\u9748\u6d3b\u7684\u65b9\u5f0f\u4f86\u7ba1\u7406\u5e8f\u5217\uff0c\u5e6b\u52a9\u958b\u767c\u8005\u6839\u64da\u9700\u6c42\u8abf\u6574\u5e8f\u5217\u7684\u5c6c\u6027\u3002\u7121\u8ad6\u662f\u589e\u91cf\u3001\u6700\u5c0f\u503c\u9084\u662f\u6700\u5927\u503c\u7684\u8a2d\u7f6e\uff0c\u90fd\u80fd\u5920\u6eff\u8db3\u4e0d\u540c\u5834\u666f\u4e0b\u7684\u9700\u6c42\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u6578\u64da\u8655\u7406\u7684\u61c9\u7528\u4f86\u8aaa\uff0c\u638c\u63e1\u9019\u4e9b\u57fa\u672c\u64cd\u4f5c\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\u6709\u8208\u8da3\uff0c\u6216\u60f3\u4e86\u89e3\u66f4\u591a\u95dc\u65bc <a href=\"https:\/\/server.hk\">\u96f2\u4f3a\u670d\u5668<\/a> \u7684\u8cc7\u8a0a\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8a73\u7d30\u8cc7\u6599\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to use the ALTER SEQUENCE command in OceanBase to modify sequence properties effectively in this comprehensive tutorial.<\/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-160063","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160063","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=160063"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160063\/revisions"}],"predecessor-version":[{"id":160064,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/160063\/revisions\/160064"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=160063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=160063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=160063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}