{"id":6103,"date":"2024-11-14T09:15:59","date_gmt":"2024-11-14T01:15:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6103\/"},"modified":"2024-11-14T09:15:59","modified_gmt":"2024-11-14T01:15:59","slug":"oracle%e5%a6%82%e4%bd%95%e5%88%a0%e9%99%a4%e4%b8%bb%e9%94%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6103\/","title":{"rendered":"oracle\u5982\u4f55\u5220\u9664\u4e3b\u952e"},"content":{"rendered":"<blockquote><p>\n  \u8981\u5220\u9664 oracle \u4e2d\u7684\u4e3b\u952e\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u5220\u9664\u5f15\u7528\u5916\u952e\u7ea6\u675f\uff1b2. \u5220\u9664\u4e3b\u952e\u7ea6\u675f\uff1b3. \u5982\u6709\u5fc5\u8981\uff0c\u6dfb\u52a0\u65b0\u4e3b\u952e\u7ea6\u675f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/12\/2024061223211882593.jpg\" class=\"aligncenter\" title=\"oracle\u5982\u4f55\u5220\u9664\u4e3b\u952e\u63d2\u56fe\" alt=\"oracle\u5982\u4f55\u5220\u9664\u4e3b\u952e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5220\u9664 Oracle \u4e2d\u7684\u4e3b\u952e<\/strong><\/p>\n<p>\u5728 Oracle \u6570\u636e\u5e93\u4e2d\u5220\u9664\u4e3b\u952e\u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u6dfb\u52a0\u5916\u952e\u7ea6\u675f<\/strong><\/p>\n<p>\u5982\u679c\u8981\u5220\u9664\u7684\u4e3b\u952e\u6709\u5916\u952e\u5f15\u7528\uff0c\u5219\u9700\u8981\u9996\u5148\u5728\u5f15\u7528\u8868\u4e2d\u5220\u9664\u5916\u952e\u7ea6\u675f\u3002\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>ALTER TABLE [\u5f15\u7528\u8868\u540d] DROP CONSTRAINT [\u5916\u952e\u7ea6\u675f\u540d]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5220\u9664\u4e3b\u952e\u7ea6\u675f<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u5220\u9664\u4e3b\u952e\u7ea6\u675f\uff1a<\/p>\n<pre>ALTER TABLE [\u8868\u540d] DROP CONSTRAINT [\u4e3b\u952e\u7ea6\u675f\u540d]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u6dfb\u52a0\u65b0\u4e3b\u952e\u7ea6\u675f<\/strong><\/p>\n<p>\u5982\u679c\u9700\u8981\uff0c\u53ef\u4ee5\u6dfb\u52a0\u65b0\u7684\u4e3b\u952e\u7ea6\u675f\uff1a<\/p>\n<pre>ALTER TABLE [\u8868\u540d] ADD CONSTRAINT [\u65b0\u4e3b\u952e\u7ea6\u675f\u540d] PRIMARY KEY ([\u5217\u540d1], [\u5217\u540d2], ...)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u8868\u4e2d\u6709\u591a\u4e2a\u4e3b\u952e\u5217\uff0c\u8bf7\u5c06\u5b83\u4eec\u5168\u90e8\u5217\u5728 ALTER TABLE \u8bed\u53e5\u4e2d\u3002<\/li>\n<li>\u5982\u679c\u8868\u4e0d\u5b58\u5728\u4e3b\u952e\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u6dfb\u52a0\u4e00\u4e2a\uff1a<\/li>\n<\/ul>\n<pre>ALTER TABLE [\u8868\u540d] ADD PRIMARY KEY ([\u5217\u540d1], [\u5217\u540d2], ...)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5220\u9664\u4e3b\u952e\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\u5220\u9664 oracle \u4e2d\u7684\u4e3b\u952e\uff0c\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a1. \u5220\u9664\u5f15\u7528\u5916\u952e\u7ea6\u675f\uff1b2. \u5220\u9664\u4e3b\u952e\u7ea6\u675f\uff1b3. \u5982\u6709\u5fc5\u8981\uff0c\u6dfb\u52a0\u65b0\u4e3b\u952e\u7ea6\u675f\u3002 \u5982\u4f55\u5220\u9664 Oracle \u4e2d\u7684\u4e3b\u952e \u5728 Oracle \u6570\u636e\u5e93\u4e2d\u5220\u9664\u4e3b\u952e\u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u6dfb\u52a0\u5916\u952e\u7ea6\u675f \u5982\u679c\u8981\u5220\u9664\u7684\u4e3b\u952e\u6709\u5916\u952e\u5f15\u7528\uff0c\u5219\u9700\u8981\u9996\u5148\u5728\u5f15\u7528\u8868\u4e2d\u5220\u9664\u5916\u952e\u7ea6\u675f\u3002\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a ALTER TABLE [\u5f15\u7528\u8868\u540d] DROP CONSTRAINT [\u5916\u952e\u7ea6\u675f\u540d] \u767b\u5f55\u540e\u590d\u5236 2. \u5220\u9664\u4e3b\u952e\u7ea6\u675f \u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u5220\u9664\u4e3b\u952e\u7ea6\u675f\uff1a ALTER TABLE [\u8868\u540d] DROP CONSTRAINT [\u4e3b\u952e\u7ea6\u675f\u540d] \u767b\u5f55\u540e\u590d\u5236 3. \u6dfb\u52a0\u65b0\u4e3b\u952e\u7ea6\u675f \u5982\u679c\u9700\u8981\uff0c\u53ef\u4ee5\u6dfb\u52a0\u65b0\u7684\u4e3b\u952e\u7ea6\u675f\uff1a ALTER TABLE [\u8868\u540d] ADD CONSTRAINT [\u65b0\u4e3b\u952e\u7ea6\u675f\u540d] PRIMARY KEY ([\u5217\u540d1], [\u5217\u540d2], &#8230;) \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff1a \u5982\u679c\u8868\u4e2d\u6709\u591a\u4e2a\u4e3b\u952e\u5217\uff0c\u8bf7\u5c06\u5b83\u4eec\u5168\u90e8\u5217\u5728 ALTER TABLE \u8bed\u53e5\u4e2d\u3002 \u5982\u679c\u8868\u4e0d\u5b58\u5728\u4e3b\u952e\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u6dfb\u52a0\u4e00\u4e2a\uff1a ALTER TABLE [&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-6103","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6103","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=6103"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6103\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}