{"id":91254,"date":"2024-10-18T19:41:20","date_gmt":"2024-10-18T11:41:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/91254\/"},"modified":"2024-10-18T19:41:20","modified_gmt":"2024-10-18T11:41:20","slug":"ora-30079-%e7%95%b6%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%89-timestamp-with-local-time-zone-%e5%88%97%e6%99%82%ef%bc%8c%e7%84%a1%e6%b3%95%e6%9b%b4%e6%94%b9%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82%e5%8d%80-ora","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/91254\/","title":{"rendered":"ORA-30079: \u7576\u6578\u64da\u5eab\u6709 TIMESTAMP WITH LOCAL TIME ZONE \u5217\u6642\uff0c\u7121\u6cd5\u66f4\u6539\u6578\u64da\u5eab\u6642\u5340 ORACLE \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406"},"content":{"rendered":"<h1 id=\"ora-30079-%e7%95%b6%e6%95%b8%e6%93%9a%e5%ba%ab%e6%9c%89-timestamp-with-local-time-zone-%e5%88%97%e6%99%82%ef%bc%8c%e7%84%a1%e6%b3%95%e6%9b%b4%e6%94%b9%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82%e5%8d%80-ora-sknDyWoBXf\">ORA-30079: \u7576\u6578\u64da\u5eab\u6709 TIMESTAMP WITH LOCAL TIME ZONE \u5217\u6642\uff0c\u7121\u6cd5\u66f4\u6539\u6578\u64da\u5eab\u6642\u5340 ORACLE \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406<\/h1>\n<p>\u5728\u4f7f\u7528 Oracle \u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u548c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u4ee3\u78bc\uff0c\u5176\u4e2d\u4e4b\u4e00\u4fbf\u662f <code>ORA-30079<\/code>\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u51fa\u73fe\u5728\u5617\u8a66\u66f4\u6539\u6578\u64da\u5eab\u6642\u5340\u6642\uff0c\u800c\u6578\u64da\u5eab\u4e2d\u5b58\u5728 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u3001\u5f71\u97ff\u4ee5\u53ca\u5982\u4f55\u9032\u884c\u6545\u969c\u4fee\u5fa9\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a4%e5%8e%9f%e5%9b%a0-sknDyWoBXf\">\u932f\u8aa4\u539f\u56e0<\/h2>\n<p>\u7576\u6578\u64da\u5eab\u4e2d\u5b58\u5728 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u6642\uff0cOracle \u6703\u81ea\u52d5\u6839\u64da\u6578\u64da\u5eab\u7684\u6642\u5340\u4f86\u5b58\u5132\u548c\u6aa2\u7d22\u6642\u9593\u6233\u3002\u9019\u610f\u5473\u8457\uff0c\u7576\u4f60\u5617\u8a66\u66f4\u6539\u6578\u64da\u5eab\u7684\u6642\u5340\u8a2d\u7f6e\u6642\uff0cOracle \u6703\u6aa2\u67e5\u6240\u6709\u7684\u6642\u9593\u6233\u5217\uff0c\u4e26\u767c\u73fe\u9019\u4e9b\u5217\u7684\u5b58\u5728\uff0c\u5f9e\u800c\u5f15\u767c <code>ORA-30079<\/code> \u932f\u8aa4\u3002<\/p>\n<p>\u5177\u9ad4\u4f86\u8aaa\uff0c\u9019\u500b\u932f\u8aa4\u7684\u51fa\u73fe\u662f\u56e0\u70ba Oracle \u4e0d\u5141\u8a31\u5728\u6709 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u7684\u60c5\u6cc1\u4e0b\u66f4\u6539\u6578\u64da\u5eab\u7684\u6642\u5340\u8a2d\u7f6e\uff0c\u4ee5\u907f\u514d\u6578\u64da\u4e0d\u4e00\u81f4\u7684\u554f\u984c\u3002<\/p>\n<h2 id=\"%e5%bd%b1%e9%9f%bf-sknDyWoBXf\">\u5f71\u97ff<\/h2>\n<p>\u9019\u500b\u932f\u8aa4\u6703\u5c0d\u6578\u64da\u5eab\u7684\u904b\u884c\u9020\u6210\u5f71\u97ff\uff0c\u7279\u5225\u662f\u5728\u9700\u8981\u8abf\u6574\u6642\u5340\u4ee5\u9069\u61c9\u696d\u52d9\u9700\u6c42\u7684\u60c5\u6cc1\u4e0b\u3002\u82e5\u7121\u6cd5\u66f4\u6539\u6642\u5340\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u6642\u9593\u6233\u7684\u986f\u793a\u4e0d\u6b63\u78ba\uff0c\u9032\u800c\u5f71\u97ff\u5230\u5831\u544a\u3001\u6578\u64da\u5206\u6790\u53ca\u5176\u4ed6\u4f9d\u8cf4\u65bc\u6b63\u78ba\u6642\u9593\u6233\u7684\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9%e6%ad%a5%e9%a9%9f-sknDyWoBXf\">\u6545\u969c\u4fee\u5fa9\u6b65\u9a5f<\/h2>\n<p>\u8981\u89e3\u6c7a <code>ORA-30079<\/code> \u932f\u8aa4\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e6%95%b8%e6%93%9a%e5%ba%ab%e7%9a%84%e7%95%b6%e5%89%8d%e6%99%82%e5%8d%80-sknDyWoBXf\">1. \u6aa2\u67e5\u6578\u64da\u5eab\u7684\u7576\u524d\u6642\u5340<\/h3>\n<pre><code>SELECT DBTIMEZONE FROM DUAL;<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u8fd4\u56de\u7576\u524d\u6578\u64da\u5eab\u7684\u6642\u5340\u8a2d\u7f6e\u3002\u4e86\u89e3\u7576\u524d\u6642\u5340\u5f8c\uff0c\u53ef\u4ee5\u6c7a\u5b9a\u662f\u5426\u9700\u8981\u66f4\u6539\u3002<\/p>\n<h3>2. \u6aa2\u67e5 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217<\/h3>\n<pre><code>SELECT COLUMN_NAME, DATA_TYPE FROM USER_TAB_COLUMNS WHERE DATA_TYPE = 'TIMESTAMP WITH LOCAL TIME ZONE';<\/code><\/pre>\n<p>\u9019\u689d\u67e5\u8a62\u5c07\u5217\u51fa\u6240\u6709\u7684 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u3002\u78ba\u5b9a\u9019\u4e9b\u5217\u7684\u5b58\u5728\u5f8c\uff0c\u60a8\u9700\u8981\u8003\u616e\u5982\u4f55\u8655\u7406\u5b83\u5011\u3002<\/p>\n<h3 id=\"3-%e8%bd%89%e6%8f%9b%e6%95%b8%e6%93%9a%e9%a1%9e%e5%9e%8b-sknDyWoBXf\">3. \u8f49\u63db\u6578\u64da\u985e\u578b<\/h3>\n<p>\u5982\u679c\u9700\u8981\u66f4\u6539\u6578\u64da\u5eab\u7684\u6642\u5340\uff0c\u60a8\u53ef\u4ee5\u8003\u616e\u5c07 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u8f49\u63db\u70ba\u5176\u4ed6\u6578\u64da\u985e\u578b\uff0c\u4f8b\u5982 <code>TIMESTAMP<\/code> \u6216 <code>DATE<\/code>\u3002\u9019\u6a23\u53ef\u4ee5\u907f\u514d <code>ORA-30079<\/code> \u932f\u8aa4\u3002<\/p>\n<pre><code>ALTER TABLE your_table_name \nMODIFY your_column_name TIMESTAMP;<\/code><\/pre>\n<h3 id=\"4-%e6%9b%b4%e6%94%b9%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82%e5%8d%80-sknDyWoBXf\">4. \u66f4\u6539\u6578\u64da\u5eab\u6642\u5340<\/h3>\n<p>\u5728\u78ba\u4fdd\u6c92\u6709 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u5f8c\uff0c\u53ef\u4ee5\u5b89\u5168\u5730\u66f4\u6539\u6578\u64da\u5eab\u7684\u6642\u5340\u8a2d\u7f6e\uff1a<\/p>\n<pre><code>ALTER DATABASE SET TIME_ZONE = '\u65b0\u6642\u5340';<\/code><\/pre>\n<h3 id=\"5-%e6%81%a2%e5%be%a9%e5%8e%9f%e5%a7%8b%e6%95%b8%e6%93%9a%e9%a1%9e%e5%9e%8b%ef%bc%88%e5%a6%82%e9%9c%80%e8%a6%81%ef%bc%89-sknDyWoBXf\">5. \u6062\u5fa9\u539f\u59cb\u6578\u64da\u985e\u578b\uff08\u5982\u9700\u8981\uff09<\/h3>\n<p>\u5982\u679c\u60a8\u5728\u66f4\u6539\u6642\u5340\u5f8c\u9700\u8981\u6062\u5fa9\u539f\u59cb\u7684 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\uff0c\u53ef\u4ee5\u518d\u6b21\u57f7\u884c\u8f49\u63db\u64cd\u4f5c\uff1a<\/p>\n<pre><code>ALTER TABLE your_table_name \nMODIFY your_column_name TIMESTAMP WITH LOCAL TIME ZONE;<\/code><\/pre>\n<h2 id=\"%e7%b5%90%e8%ab%96-sknDyWoBXf\">\u7d50\u8ad6<\/h2>\n<p>\u5728 Oracle \u6578\u64da\u5eab\u4e2d\uff0c<code>ORA-30079<\/code> \u932f\u8aa4\u662f\u7531\u65bc\u5b58\u5728 <code>TIMESTAMP WITH LOCAL TIME ZONE<\/code> \u5217\u800c\u7121\u6cd5\u66f4\u6539\u6578\u64da\u5eab\u6642\u5340\u6240\u5f15\u8d77\u7684\u3002\u901a\u904e\u6aa2\u67e5\u7576\u524d\u6642\u5340\u3001\u8b58\u5225\u76f8\u95dc\u5217\u3001\u8f49\u63db\u6578\u64da\u985e\u578b\u4ee5\u53ca\u6700\u7d42\u66f4\u6539\u6642\u5340\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u6c7a\u9019\u4e00\u554f\u984c\u3002\u9019\u4e9b\u6b65\u9a5f\u4e0d\u50c5\u80fd\u5e6b\u52a9\u60a8\u4fee\u5fa9\u932f\u8aa4\uff0c\u9084\u80fd\u78ba\u4fdd\u6578\u64da\u7684\u4e00\u81f4\u6027\u548c\u6e96\u78ba\u6027\u3002<\/p>\n<p>\u5982\u9700\u9032\u4e00\u6b65\u4e86\u89e3\u5982\u4f55\u5728\u9999\u6e2f\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u74b0\u5883\u4e2d\u7ba1\u7406 Oracle \u6578\u64da\u5eab\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u6c7a ORA-30079 \u932f\u8aa4\uff0c\u7576\u6578\u64da\u5eab\u5305\u542b TIMESTAMP WITH LOCAL TIME ZONE \u5217\u6642\uff0c\u7121\u6cd5\u66f4\u6539\u6642\u5340\u7684\u6545\u969c\u4fee\u5fa9\u8207\u9060\u7a0b\u8655\u7406\u6307\u5357\u3002<\/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-91254","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91254","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=91254"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91254\/revisions"}],"predecessor-version":[{"id":91255,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/91254\/revisions\/91255"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=91254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=91254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=91254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}