{"id":90816,"date":"2024-10-18T15:50:21","date_gmt":"2024-10-18T07:50:21","guid":{"rendered":"https:\/\/server.hk\/cnblog\/90816\/"},"modified":"2024-10-18T15:50:21","modified_gmt":"2024-10-18T07:50:21","slug":"ora-28103-adding-a-policy-to-an-object-owned-by-sys-is-not-allowed-oracle%e5%a0%b1%e9%8c%af-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9-%e9%81%a0%e7%a8%8b%e8%99%95%e7%90%86","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/90816\/","title":{"rendered":"ORA-28103: adding a policy to an object owned by SYS is not allowed ORACLE\u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406"},"content":{"rendered":"<h1 id=\"ora-28103-adding-a-policy-to-an-object-owned-by-sys-is-not-allowed-NpMoQpCJVa\">ORA-28103: Adding a Policy to an Object Owned by SYS is Not Allowed<\/h1>\n<p>\u5728\u4f7f\u7528Oracle\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\u662fORA-28103\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u51fa\u73fe\u5728\u5617\u8a66\u70baSYS\u7528\u6236\u64c1\u6709\u7684\u5c0d\u8c61\u6dfb\u52a0\u5b89\u5168\u7b56\u7565\u6642\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eORA-28103\u7684\u539f\u56e0\u3001\u5f71\u97ff\u4ee5\u53ca\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"ora-28103%e7%9a%84%e5%8e%9f%e5%9b%a0-NpMoQpCJVa\">ORA-28103\u7684\u539f\u56e0<\/h2>\n<p>ORA-28103\u932f\u8aa4\u7684\u4e3b\u8981\u539f\u56e0\u662fOracle\u6578\u64da\u5eab\u7684\u5b89\u5168\u8a2d\u8a08\u3002SYS\u7528\u6236\u662fOracle\u6578\u64da\u5eab\u7684\u6838\u5fc3\u7528\u6236\uff0c\u64c1\u6709\u6240\u6709\u7cfb\u7d71\u6b0a\u9650\u548c\u5c0d\u8c61\u3002\u51fa\u65bc\u5b89\u5168\u8003\u91cf\uff0cOracle\u4e0d\u5141\u8a31\u5c0dSYS\u7528\u6236\u64c1\u6709\u7684\u5c0d\u8c61\u6dfb\u52a0\u884c\u7d1a\u5b89\u5168\u7b56\u7565\uff08Virtual Private Database, VPD\uff09\u3002\u9019\u662f\u56e0\u70ba\u9019\u4e9b\u5c0d\u8c61\u901a\u5e38\u662f\u7cfb\u7d71\u7d1a\u7684\uff0c\u5c0d\u5176\u9032\u884c\u4fee\u6539\u53ef\u80fd\u6703\u5f71\u97ff\u6574\u500b\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n<h2 id=\"%e5%bd%b1%e9%9f%bf-NpMoQpCJVa\">\u5f71\u97ff<\/h2>\n<p>\u7576\u958b\u767c\u8005\u5617\u8a66\u70baSYS\u7528\u6236\u7684\u5c0d\u8c61\u6dfb\u52a0\u5b89\u5168\u7b56\u7565\u6642\uff0c\u5c07\u6703\u6536\u5230\u5982\u4e0b\u932f\u8aa4\u4fe1\u606f\uff1a<\/p>\n<pre><code>ORA-28103: adding a policy to an object owned by SYS is not allowed<\/code><\/pre>\n<p>\u9019\u4e0d\u50c5\u6703\u5c0e\u81f4\u64cd\u4f5c\u5931\u6557\uff0c\u9084\u53ef\u80fd\u5f71\u97ff\u5230\u61c9\u7528\u7a0b\u5e8f\u7684\u6b63\u5e38\u904b\u884c\uff0c\u7279\u5225\u662f\u7576\u9019\u4e9b\u5c0d\u8c61\u662f\u61c9\u7528\u7a0b\u5e8f\u4f9d\u8cf4\u7684\u6838\u5fc3\u6578\u64da\u6642\u3002<\/p>\n<h2 id=\"%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-NpMoQpCJVa\">\u89e3\u6c7a\u65b9\u6848<\/h2>\n<p>\u8981\u89e3\u6c7aORA-28103\u932f\u8aa4\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u8003\u616e\u4ee5\u4e0b\u5e7e\u7a2e\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li><strong>\u4f7f\u7528\u5176\u4ed6\u7528\u6236\u5275\u5efa\u5c0d\u8c61\uff1a<\/strong>\u5982\u679c\u9700\u8981\u70ba\u67d0\u500b\u5c0d\u8c61\u6dfb\u52a0\u5b89\u5168\u7b56\u7565\uff0c\u5efa\u8b70\u4f7f\u7528\u975eSYS\u7528\u6236\u5275\u5efa\u8a72\u5c0d\u8c61\u3002\u9019\u6a23\u53ef\u4ee5\u907f\u514d\u6b64\u932f\u8aa4\u7684\u767c\u751f\u3002<\/li>\n<li><strong>\u6aa2\u67e5\u5c0d\u8c61\u64c1\u6709\u8005\uff1a<\/strong>\u5728\u9032\u884c\u4efb\u4f55\u64cd\u4f5c\u4e4b\u524d\uff0c\u78ba\u4fdd\u4f60\u4e86\u89e3\u5c0d\u8c61\u7684\u64c1\u6709\u8005\u3002\u5982\u679c\u5c0d\u8c61\u662f\u7531SYS\u64c1\u6709\uff0c\u5247\u9700\u8981\u91cd\u65b0\u8003\u616e\u4f60\u7684\u8a2d\u8a08\u3002<\/li>\n<li><strong>\u4f7f\u7528\u66ff\u4ee3\u65b9\u6848\uff1a<\/strong>\u5982\u679c\u5fc5\u9808\u4f7f\u7528SYS\u7528\u6236\u7684\u5c0d\u8c61\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528\u5176\u4ed6\u5b89\u5168\u63aa\u65bd\uff0c\u4f8b\u5982\u4f7f\u7528\u89d2\u8272\u6216\u6b0a\u9650\u4f86\u63a7\u5236\u8a2a\u554f\uff0c\u800c\u4e0d\u662f\u4f7f\u7528\u884c\u7d1a\u5b89\u5168\u7b56\u7565\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%a4%ba%e4%be%8b-NpMoQpCJVa\">\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5728\u975eSYS\u7528\u6236\u4e0b\u5275\u5efa\u4e00\u500b\u8868\u4e26\u6dfb\u52a0\u5b89\u5168\u7b56\u7565\uff1a<\/p>\n<pre><code>-- \u5275\u5efa\u4e00\u500b\u65b0\u7684\u7528\u6236\nCREATE USER my_user IDENTIFIED BY password;\n\n-- \u6388\u4e88\u5fc5\u8981\u7684\u6b0a\u9650\nGRANT CONNECT, RESOURCE TO my_user;\n\n-- \u4ee5\u65b0\u7528\u6236\u8eab\u4efd\u5275\u5efa\u8868\nCREATE TABLE my_user.my_table (\n    id NUMBER,\n    name VARCHAR2(100)\n);\n\n-- \u6dfb\u52a0\u884c\u7d1a\u5b89\u5168\u7b56\u7565\nBEGIN\n    DBMS_RLS.ADD_POLICY(\n        object_schema =&gt; 'my_user',\n        object_name =&gt; 'my_table',\n        policy_name =&gt; 'my_policy',\n        function_schema =&gt; 'my_user',\n        policy_function =&gt; 'my_security_function'\n    );\nEND;\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u5275\u5efa\u4e86\u4e00\u500b\u65b0\u7684\u7528\u6236\u4e26\u5728\u5176\u4e0b\u5275\u5efa\u4e86\u4e00\u500b\u8868\uff0c\u7136\u5f8c\u6210\u529f\u5730\u70ba\u8a72\u8868\u6dfb\u52a0\u4e86\u884c\u7d1a\u5b89\u5168\u7b56\u7565\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-NpMoQpCJVa\">\u7e3d\u7d50<\/h2>\n<p>ORA-28103\u932f\u8aa4\u662fOracle\u6578\u64da\u5eab\u4e2d\u4e00\u500b\u5e38\u898b\u7684\u554f\u984c\uff0c\u4e3b\u8981\u7531\u65bc\u5617\u8a66\u70baSYS\u7528\u6236\u64c1\u6709\u7684\u5c0d\u8c61\u6dfb\u52a0\u5b89\u5168\u7b56\u7565\u800c\u5f15\u8d77\u3002\u901a\u904e\u4f7f\u7528\u975eSYS\u7528\u6236\u5275\u5efa\u5c0d\u8c61\u6216\u8003\u616e\u5176\u4ed6\u5b89\u5168\u63aa\u65bd\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u6b64\u932f\u8aa4\u7684\u767c\u751f\u3002\u4e86\u89e3\u9019\u4e9b\u7d30\u7bc0\u4e0d\u50c5\u6709\u52a9\u65bc\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\uff0c\u9084\u80fd\u78ba\u4fdd\u61c9\u7528\u7a0b\u5e8f\u7684\u7a69\u5b9a\u904b\u884c\u3002<\/p>\n<p>\u5982\u9700\u9032\u4e00\u6b65\u4e86\u89e3\u5982\u4f55\u512a\u5316\u60a8\u7684\u6578\u64da\u5eab\u74b0\u5883\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u89e3\u6c7a\u65b9\u6848\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u548c\u5b89\u5168\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to resolve ORA-28103: adding a policy to an object owned by SYS is not allowed in Oracle. Troubleshooting and remote handling tips included.<\/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-90816","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/90816","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=90816"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/90816\/revisions"}],"predecessor-version":[{"id":90817,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/90816\/revisions\/90817"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=90816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=90816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=90816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}