{"id":5740,"date":"2024-11-14T12:23:37","date_gmt":"2024-11-14T04:23:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5740\/"},"modified":"2024-11-14T12:23:37","modified_gmt":"2024-11-14T04:23:37","slug":"oracle%e5%ad%97%e7%ac%a6%e9%9b%86%e6%80%8e%e4%b9%88%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5740\/","title":{"rendered":"oracle\u5b57\u7b26\u96c6\u600e\u4e48\u4fee\u6539"},"content":{"rendered":"<blockquote><p>\n  \u8981\u4fee\u6539 oracle \u5b57\u7b26\u96c6\uff0c\u53ef\u4ee5\u6309\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a\u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6\uff1aalter database character set \u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6\uff1aalter table modify\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053021481944638.jpg\" class=\"aligncenter\" title=\"oracle\u5b57\u7b26\u96c6\u600e\u4e48\u4fee\u6539\u63d2\u56fe\" alt=\"oracle\u5b57\u7b26\u96c6\u600e\u4e48\u4fee\u6539\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4fee\u6539 Oracle \u5b57\u7b26\u96c6<\/strong><\/p>\n<p>Oracle \u6570\u636e\u5e93\u4f7f\u7528\u5b57\u7b26\u96c6\u5b58\u50a8\u548c\u5904\u7406\u6570\u636e\u3002\u5b57\u7b26\u96c6\u5b9a\u4e49\u6570\u636e\u5e93\u4e2d\u5b57\u7b26\u7684\u7f16\u7801\u65b9\u5f0f\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u4fee\u6539\u6570\u636e\u5e93\u6216\u7279\u5b9a\u8868\u6216\u5217\u7684\u5b57\u7b26\u96c6\u3002<\/p>\n<p><strong>\u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6<\/strong><\/p>\n<p>\u8981\u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/li>\n<\/ol>\n<pre>ALTER DATABASE CHARACTER SET &lt;\u65b0\u5b57\u7b26\u96c6&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u5c06\u6570\u636e\u5e93\u5b57\u7b26\u96c6\u66f4\u6539\u4e3a UTF-8\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre>ALTER DATABASE CHARACTER SET UTF8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u786e\u8ba4\u66f4\u6539\uff1a<\/li>\n<\/ol>\n<pre>SELECT value FROM v$nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6<\/strong><\/p>\n<p>\u8981\u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/li>\n<li>\u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/li>\n<\/ol>\n<pre>ALTER TABLE &lt;\u8868\u540d\u79f0&gt; MODIFY &lt;\u5217\u540d\u79f0&gt; &lt;\u65b0\u5b57\u7b26\u96c6&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u5c06\u540d\u4e3a &#8220;my_table&#8221; \u7684\u8868\u4e2d\u5217 &#8220;my_column&#8221; \u7684\u5b57\u7b26\u96c6\u66f4\u6539\u4e3a UTF-8\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre>ALTER TABLE my_table MODIFY my_column UTF8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u786e\u8ba4\u66f4\u6539\uff1a<\/li>\n<\/ol>\n<pre>SELECT character_set_name FROM user_tab_cols WHERE table_name = 'my_table' AND column_name = 'my_column'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li>\u4fee\u6539\u5b57\u7b26\u96c6\u662f\u4e00\u4e2a\u7834\u574f\u6027\u7684\u64cd\u4f5c\uff0c\u9700\u8981\u5c0f\u5fc3\u64cd\u4f5c\u3002<\/li>\n<li>\u5728\u66f4\u6539\u5b57\u7b26\u96c6\u4e4b\u524d\uff0c\u5f3a\u70c8\u5efa\u8bae\u5907\u4efd\u6570\u636e\u5e93\u3002<\/li>\n<li>\u5b57\u7b26\u96c6\u66f4\u6539\u53ef\u80fd\u4f1a\u5f71\u54cd\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u6b64\u5728\u8fdb\u884c\u66f4\u6539\u4e4b\u524d\u6d4b\u8bd5\u5e94\u7528\u7a0b\u5e8f\u81f3\u5173\u91cd\u8981\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5b57\u7b26\u96c6\u600e\u4e48\u4fee\u6539\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u4fee\u6539 oracle \u5b57\u7b26\u96c6\uff0c\u53ef\u4ee5\u6309\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a\u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6\uff1aalter database character set \u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6\uff1aalter table modify \u5982\u4f55\u4fee\u6539 Oracle \u5b57\u7b26\u96c6 Oracle \u6570\u636e\u5e93\u4f7f\u7528\u5b57\u7b26\u96c6\u5b58\u50a8\u548c\u5904\u7406\u6570\u636e\u3002\u5b57\u7b26\u96c6\u5b9a\u4e49\u6570\u636e\u5e93\u4e2d\u5b57\u7b26\u7684\u7f16\u7801\u65b9\u5f0f\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u4fee\u6539\u6570\u636e\u5e93\u6216\u7279\u5b9a\u8868\u6216\u5217\u7684\u5b57\u7b26\u96c6\u3002 \u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6 \u8981\u4fee\u6539\u6570\u636e\u5e93\u5b57\u7b26\u96c6\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002 \u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a ALTER DATABASE CHARACTER SET &lt;\u65b0\u5b57\u7b26\u96c6&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u5c06\u6570\u636e\u5e93\u5b57\u7b26\u96c6\u66f4\u6539\u4e3a UTF-8\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a ALTER DATABASE CHARACTER SET UTF8 \u767b\u5f55\u540e\u590d\u5236 \u786e\u8ba4\u66f4\u6539\uff1a SELECT value FROM v$nls_database_parameters WHERE parameter = &#8216;NLS_CHARACTERSET&#8217; \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6 \u8981\u4fee\u6539\u8868\u6216\u5217\u5b57\u7b26\u96c6\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002 \u8fd0\u884c\u4ee5\u4e0b\u8bed\u53e5\uff1a ALTER TABLE &lt;\u8868\u540d\u79f0&gt; MODIFY &lt;\u5217\u540d\u79f0&gt; &lt;\u65b0\u5b57\u7b26\u96c6&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u5c06\u540d\u4e3a &#8220;my_table&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5740","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5740"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5740\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}