{"id":197,"date":"2026-01-23T05:57:11","date_gmt":"2026-01-23T05:57:11","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=197"},"modified":"2026-01-28T06:24:15","modified_gmt":"2026-01-28T06:24:15","slug":"oracle%e8%bf%90%e7%bb%b4-%e8%a1%a8%e7%a9%ba%e9%97%b4%e5%88%9b%e5%bb%ba%e3%80%81%e7%94%a8%e6%88%b7%e5%88%9b%e5%bb%ba%e4%b8%8e%e6%8e%88%e6%9d%83%e3%80%81%e7%94%a8%e6%88%b7%e5%88%a0","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=197","title":{"rendered":"oracle\u8fd0\u7ef4\u2014\u2014\u8868\u7a7a\u95f4\u521b\u5efa\u3001\u7528\u6237\u521b\u5efa\u4e0e\u6388\u6743\u3001\u7528\u6237\u5220\u9664\u3001\u8868\u7a7a\u95f4\u5220\u9664"},"content":{"rendered":"\n<p>1\u3001\u521b\u5efa\u8868\u7a7a\u95f4\uff08\u6570\u636e + \u7d22\u5f15\u5206\u79bb\uff09<\/p>\n\n\n\n<p>\u8868\u7a7a\u95f4\u662f Oracle \u5b58\u50a8\u6570\u636e\u7684\u903b\u8f91\u5355\u5143\uff0c\u5c06\u300c\u6570\u636e\uff08\u8868\uff09\u300d\u548c\u300c\u7d22\u5f15\u300d\u5206\u5f00\u5b58\u50a8\uff08ORACLEHZS_TAB \u5b58\u8868\uff0cORACLEHZS_INX \u5b58\u7d22\u5f15\uff09\uff0c\u53ef\u63d0\u5347 IO \u6027\u80fd\uff08\u907f\u514d\u6570\u636e\u548c\u7d22\u5f15\u4e89\u7528\u78c1\u76d8 IO\uff09<\/p>\n\n\n\n<p><code>DATAFILE<\/code>\uff1a\u6307\u5b9a\u8868\u7a7a\u95f4\u5bf9\u5e94\u7684\u7269\u7406\u6570\u636e\u6587\u4ef6\u8def\u5f84\uff0c\u9700\u786e\u4fdd\u8def\u5f84\u5b58\u5728\u4e14 Oracle \u7528\u6237\u6709\u8bfb\u5199\u6743\u9650\uff08\u5982 <code>\/data\/app\/oracle\/oradata\/oracleopshub\/<\/code> \u9700\u63d0\u524d\u521b\u5efa\uff0c\u6743\u9650\u4e3a <code>oracle:oinstall<\/code>\uff09<\/p>\n\n\n\n<p><code>SIZE<\/code>\uff1a\u521d\u59cb\u5927\u5c0f\uff0c\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9884\u4f30\u8bbe\u7f6e\uff085GB\/2GB \u662f\u5408\u7406\u7684\u521d\u59cb\u503c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u4f18\u5316\u7248\uff08\u81ea\u52a8\u6269\u5c55\uff0c\u6700\u592710GB\uff09\nCREATE TABLESPACE ORACLEHZS_TAB \nDATAFILE '\/data\/app\/oracle\/oradata\/oracleopshub\/oracleopshub_tab01.dbf' \nSIZE 5120M \nAUTOEXTEND ON NEXT 100M MAXSIZE 10240M; -- \u6ee1\u4e86\u81ea\u52a8\u52a0100MB\uff0c\u6700\u592710GB<\/code><\/pre>\n\n\n\n<p>2\u3001\u521b\u5efa\u4e1a\u52a1\u7528\u6237<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u521b\u5efayjopshub\u7528\u6237\uff0c\u5bc6\u7801yjopshub\uff0c\u9ed8\u8ba4\u8868\u7a7a\u95f4ORACLEHZS_TAB\uff0c\u4e34\u65f6\u8868\u7a7a\u95f4TEMP\ncreate user yjopshub \nidentified by yjopshub \ndefault tablespace ORACLEHZS_TAB \ntemporary tablespace TEMP \nprofile DEFAULT;\n\n-- \u521b\u5efaerpdata\u7528\u6237\uff0c\u5bc6\u7801erpopshubdata\uff0c\u914d\u7f6e\u540c\u4e0a\ncreate user erpdata \nidentified by erpopshubdata \ndefault tablespace ORACLEHZS_TAB \ntemporary tablespace TEMP \nprofile DEFAULT;<\/code><\/pre>\n\n\n\n<p>3\u3001\u7528\u6237\u6388\u6743<\/p>\n\n\n\n<p><code>connect<\/code>\uff1a\u57fa\u7840\u6743\u9650\uff08\u767b\u5f55\u6570\u636e\u5e93\u3001\u521b\u5efa\u4f1a\u8bdd\uff09\uff1b <code>resource<\/code>\uff1a\u4e1a\u52a1\u6838\u5fc3\u6743\u9650\uff08\u521b\u5efa\u8868\u3001\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u7b49\uff09\uff1b <code>create any table<\/code>\uff1a\u5141\u8bb8\u521b\u5efa\u4efb\u610f\u6a21\u5f0f\u4e0b\u7684\u8868\uff08\u8c28\u614e\u6388\u4e88\uff09\uff1b <code>dba<\/code>\uff1a\u8d85\u7ea7\u7ba1\u7406\u5458\u6743\u9650\uff08\u5305\u542b\u6240\u6709\u6743\u9650\uff0c\u751f\u4ea7\u73af\u5883<strong>\u4e0d\u5efa\u8bae\u76f4\u63a5\u6388\u4e88<\/strong>\uff0c\u9700\u6700\u5c0f\u5316\u6388\u6743\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u7ed9yjopshub\u6388\u6743\uff1a\u521b\u5efa\u4efb\u610f\u8868\u3001DBA\u6743\u9650\u3001\u8d44\u6e90\u6743\u9650\u3001\u8fde\u63a5\u6743\u9650\ngrant create any table,dba,resource,connect to yjopshub;\ngrant create any table,dba,resource,connect to erpdata;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u6700\u5c0f\u5316\u6388\u6743\u793a\u4f8b\ngrant connect, resource to yjopshub;\ngrant create index, create view, alter any table to yjopshub; -- \u6309\u9700\u6dfb\u52a0\n-- \u82e5\u9700\u6307\u5b9a\u7d22\u5f15\u5b58\u50a8\u5230ORACLEHZS_INX\u8868\u7a7a\u95f4\uff0c\u9700\u989d\u5916\u6388\u6743\ngrant unlimited tablespace to yjopshub; -- \u5141\u8bb8\u4f7f\u7528\u8868\u7a7a\u95f4\u65e0\u9650\u5236\uff08\u6216\u6307\u5b9a\u914d\u989d\uff09<\/code><\/pre>\n\n\n\n<p>4\u3001\u5220\u9664\u7528\u6237\uff08\u542b\u5bf9\u8c61\uff09<\/p>\n\n\n\n<p><code>cascade<\/code>\uff1a\u5fc5\u987b\u52a0\uff01\u5426\u5219\u82e5\u7528\u6237\u6709\u5bf9\u8c61\uff08\u5982\u8868\uff09\uff0c\u5220\u9664\u4f1a\u62a5\u9519 <code>ORA-01922: CASCADE must be specified to drop 'YJHZS'<\/code>\uff1b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u7ea7\u8054\u5220\u9664yjopshub\u7528\u6237\u53ca\u6240\u6709\u5bf9\u8c61\uff08\u8868\/\u7d22\u5f15\/\u89c6\u56fe\u7b49\uff09\ndrop user yjopshub cascade;\ndrop user erpdata cascade;<\/code><\/pre>\n\n\n\n<p>\u82e5\u5220\u9664\u65f6\u62a5\u9519 <code>ORA-01940: cannot drop a user that is currently connected<\/code>\uff0c\u9700\u5148\u6740\u6b7b\u7528\u6237\u4f1a\u8bdd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u67e5\u627e\u7528\u6237\u4f1a\u8bdd\nselect sid, serial# from v$session where username='YJHZS';\n-- \u6740\u6b7b\u4f1a\u8bdd\uff08\u66ff\u6362sid\/serial#\uff09\nalter system kill session '123,456';<\/code><\/pre>\n\n\n\n<p>5\u3001\u5220\u9664\u8868\u7a7a\u95f4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u5220\u9664\u8868\u7a7a\u95f4\uff0c\u540c\u65f6\u5220\u9664\u5176\u5305\u542b\u7684\u6240\u6709\u5185\u5bb9\uff08\u6570\u636e\u6587\u4ef6\u9700\u624b\u52a8\u5220\u9664\uff09\ndrop tablespace ORACLEHZS_TAB including contents;<\/code><\/pre>\n\n\n\n<p>\u82e5\u9700\u540c\u65f6\u5220\u9664\u7269\u7406\u6570\u636e\u6587\u4ef6\uff0c\u6dfb\u52a0 <code>and datafiles<\/code>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u7ea7\u8054\u5220\u9664\u8868\u7a7a\u95f4+\u5185\u5bb9+\u7269\u7406\u6570\u636e\u6587\u4ef6\uff08\u8c28\u614e\u6267\u884c\uff09\ndrop tablespace ORACLEHZS_TAB including contents and datafiles;<\/code><\/pre>\n\n\n\n<p>6\u3001\u9a8c\u8bc1\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>-- \u9a8c\u8bc1\u7528\u6237\u9ed8\u8ba4\u8868\u7a7a\u95f4\nselect username, default_tablespace from dba_users where username in ('YJHZS','ERPDATA');\n-- \u9a8c\u8bc1\u8868\u7a7a\u95f4\u72b6\u6001\nselect tablespace_name, status, contents from dba_tablespaces where tablespace_name in ('ORACLEHZS_TAB','ORACLEHZS_INX');\n-- \u9a8c\u8bc1\u6570\u636e\u6587\u4ef6\nselect file_name, bytes\/1024\/1024 MB, autoextensible from dba_data_files where tablespace_name='ORACLEHZS_TAB';<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u521b\u5efa\u8868\u7a7a\u95f4\uff08\u6570\u636e + \u7d22\u5f15\u5206\u79bb\uff09 \u8868\u7a7a\u95f4\u662f Oracle \u5b58\u50a8\u6570\u636e\u7684\u903b\u8f91\u5355\u5143\uff0c\u5c06\u300c\u6570\u636e\uff08\u8868\uff09\u300d\u548c\u300c\u7d22\u5f15\u300d\u5206\u5f00\u5b58\u50a8\uff08ORACLEHZS_TAB \u5b58\u8868\uff0cORACLEHZS_INX \u5b58\u7d22\u5f15\uff09\uff0c\u53ef\u63d0\u5347 IO \u6027\u80fd\uff08\u907f\u514d\u6570\u636e\u548c\u7d22\u5f15\u4e89\u7528\u78c1\u76d8 IO\uff09 DATAFILE\uff1a\u6307\u5b9a\u8868\u7a7a\u95f4\u5bf9\u5e94\u7684\u7269\u7406\u6570\u636e\u6587\u4ef6\u8def\u5f84\uff0c\u9700\u786e\u4fdd\u8def\u5f84\u5b58\u5728\u4e14 Oracle \u7528\u6237\u6709\u8bfb\u5199\u6743\u9650\uff08\u5982 \/data\/app\/oracle\/oradata\/oracleopshub\/ \u9700\u63d0\u524d\u521b\u5efa\uff0c\u6743\u9650\u4e3a oracle:oinstall\uff09 SIZE\uff1a\u521d\u59cb\u5927\u5c0f\uff0c\u5efa\u8bae\u6839\u636e\u4e1a\u52a1\u9884\u4f30\u8bbe\u7f6e\uff085GB\/2GB \u662f\u5408\u7406\u7684\u521d\u59cb\u503c\uff09 2\u3001\u521b\u5efa\u4e1a\u52a1\u7528\u6237 3\u3001\u7528\u6237\u6388\u6743 connect\uff1a\u57fa\u7840\u6743\u9650\uff08\u767b\u5f55\u6570\u636e\u5e93\u3001\u521b\u5efa\u4f1a\u8bdd\uff09\uff1b resource\uff1a\u4e1a\u52a1\u6838\u5fc3\u6743\u9650\uff08\u521b\u5efa\u8868\u3001\u7d22\u5f15\u3001\u89e6\u53d1\u5668\u7b49\uff09\uff1b create any table\uff1a\u5141\u8bb8\u521b\u5efa\u4efb\u610f\u6a21\u5f0f\u4e0b\u7684\u8868\uff08\u8c28\u614e\u6388\u4e88\uff09\uff1b dba\uff1a\u8d85\u7ea7\u7ba1\u7406\u5458\u6743\u9650\uff08\u5305\u542b\u6240\u6709\u6743\u9650\uff0c\u751f\u4ea7\u73af\u5883\u4e0d\u5efa\u8bae\u76f4\u63a5\u6388\u4e88\uff0c\u9700\u6700\u5c0f\u5316\u6388\u6743\uff09 4\u3001\u5220\u9664\u7528\u6237\uff08\u542b\u5bf9\u8c61\uff09 cascade\uff1a\u5fc5\u987b\u52a0\uff01\u5426\u5219\u82e5\u7528\u6237\u6709\u5bf9\u8c61\uff08\u5982\u8868\uff09\uff0c\u5220\u9664\u4f1a\u62a5\u9519 ORA-01922: CASCADE must be specified to drop &#8216;YJHZS&#8217;\uff1b \u82e5\u5220\u9664\u65f6\u62a5\u9519 ORA-01940: cannot drop a user that is currently connected\uff0c\u9700\u5148\u6740\u6b7b\u7528\u6237\u4f1a\u8bdd\uff1a 5\u3001\u5220\u9664\u8868\u7a7a\u95f4 \u82e5\u9700\u540c\u65f6\u5220\u9664\u7269\u7406\u6570\u636e\u6587\u4ef6\uff0c\u6dfb\u52a0 and datafiles\uff1a 6\u3001\u9a8c\u8bc1\u914d\u7f6e<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-197","post","type-post","status-publish","format-standard","hentry","category-8"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=197"}],"version-history":[{"count":2,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions\/199"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}