{"id":185270,"date":"2024-11-10T20:09:17","date_gmt":"2024-11-10T12:09:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/185270\/"},"modified":"2024-11-10T20:09:18","modified_gmt":"2024-11-10T12:09:18","slug":"%e4%bd%bf%e7%94%a8sqlplus%e6%93%8d%e4%bd%9c%e6%95%b8%e6%93%9a%e5%ba%ab%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95%ef%bc%88sqlplus%e6%95%b8%e6%93%9a%e5%ba%ab%e5%90%8d%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/185270\/","title":{"rendered":"\u4f7f\u7528sqlplus\u64cd\u4f5c\u6578\u64da\u5eab\u540d\u7684\u65b9\u6cd5\uff08sqlplus\u6578\u64da\u5eab\u540d\uff09"},"content":{"rendered":"<h1 id=\"%e4%bd%bf%e7%94%a8sqlplus%e6%93%8d%e4%bd%9c%e6%95%b8%e6%93%9a%e5%ba%ab%e5%90%8d%e7%9a%84%e6%96%b9%e6%b3%95%ef%bc%88sqlplus%e6%95%b8%e6%93%9a%e5%ba%ab%e5%90%8d%ef%bc%89-xBhEmFxMxd\">\u4f7f\u7528sqlplus\u64cd\u4f5c\u6578\u64da\u5eab\u540d\u7684\u65b9\u6cd5\uff08sqlplus\u6578\u64da\u5eab\u540d\uff09<\/h1>\n<p>\u5728\u6578\u64da\u5eab\u7ba1\u7406\u4e2d\uff0cOracle\u7684sqlplus\u662f\u4e00\u500b\u975e\u5e38\u91cd\u8981\u7684\u5de5\u5177\u3002\u5b83\u662f\u4e00\u500b\u547d\u4ee4\u884c\u754c\u9762\uff0c\u5141\u8a31\u7528\u6236\u8207Oracle\u6578\u64da\u5eab\u9032\u884c\u4ea4\u4e92\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528sqlplus\u4f86\u64cd\u4f5c\u6578\u64da\u5eab\u540d\uff0c\u5305\u62ec\u9023\u63a5\u6578\u64da\u5eab\u3001\u67e5\u8a62\u6578\u64da\u5eab\u4fe1\u606f\u4ee5\u53ca\u57f7\u884c\u57fa\u672c\u7684\u6578\u64da\u5eab\u64cd\u4f5c\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afsqlplus%ef%bc%9f-xBhEmFxMxd\">\u4ec0\u9ebc\u662fsqlplus\uff1f<\/h2>\n<p>sqlplus\u662fOracle\u63d0\u4f9b\u7684\u4e00\u500b\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u65bc\u57f7\u884cSQL\u8a9e\u53e5\u548cPL\/SQL\u584a\u3002\u5b83\u53ef\u4ee5\u7528\u4f86\u9023\u63a5\u5230Oracle\u6578\u64da\u5eab\uff0c\u57f7\u884c\u67e5\u8a62\uff0c\u66f4\u65b0\u6578\u64da\uff0c\u4e26\u7ba1\u7406\u6578\u64da\u5eab\u5c0d\u8c61\u3002sqlplus\u7684\u512a\u52e2\u5728\u65bc\u5176\u7c21\u55ae\u6613\u7528\uff0c\u4e26\u4e14\u80fd\u5920\u5728\u5404\u7a2e\u64cd\u4f5c\u7cfb\u7d71\u4e0a\u904b\u884c\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8sqlplus%e9%80%a3%e6%8e%a5%e5%88%b0%e6%95%b8%e6%93%9a%e5%ba%ab-xBhEmFxMxd\">\u5982\u4f55\u4f7f\u7528sqlplus\u9023\u63a5\u5230\u6578\u64da\u5eab<\/h2>\n<p>\u8981\u4f7f\u7528sqlplus\u9023\u63a5\u5230Oracle\u6578\u64da\u5eab\uff0c\u9996\u5148\u9700\u8981\u78ba\u4fdd\u5df2\u7d93\u5b89\u88dd\u4e86Oracle\u5ba2\u6236\u7aef\u3002\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u901a\u904e\u547d\u4ee4\u884c\u754c\u9762\u555f\u52d5sqlplus\u3002\u4ee5\u4e0b\u662f\u9023\u63a5\u6578\u64da\u5eab\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<pre><code>sqlplus username\/password@database_name<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c<code>username<\/code>\u662f\u4f60\u7684\u6578\u64da\u5eab\u7528\u6236\u540d\uff0c<code>password<\/code>\u662f\u5c0d\u61c9\u7684\u5bc6\u78bc\uff0c<code>database_name<\/code>\u662f\u4f60\u8981\u9023\u63a5\u7684\u6578\u64da\u5eab\u540d\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>sqlplus scott\/tiger@orcl<\/code><\/pre>\n<h2 id=\"%e6%9f%a5%e8%a9%a2%e6%95%b8%e6%93%9a%e5%ba%ab%e4%bf%a1%e6%81%af-xBhEmFxMxd\">\u67e5\u8a62\u6578\u64da\u5eab\u4fe1\u606f<\/h2>\n<p>\u9023\u63a5\u6210\u529f\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528SQL\u8a9e\u53e5\u4f86\u67e5\u8a62\u6578\u64da\u5eab\u7684\u4fe1\u606f\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u67e5\u8a62\u547d\u4ee4\uff1a<\/p>\n<h3 id=\"%e6%9f%a5%e7%9c%8b%e7%95%b6%e5%89%8d%e7%94%a8%e6%88%b6-xBhEmFxMxd\">\u67e5\u770b\u7576\u524d\u7528\u6236<\/h3>\n<pre><code>SELECT USER FROM dual;<\/code><\/pre>\n<h3 id=\"%e6%9f%a5%e7%9c%8b%e6%89%80%e6%9c%89%e6%95%b8%e6%93%9a%e5%ba%ab%e5%90%8d-xBhEmFxMxd\">\u67e5\u770b\u6240\u6709\u6578\u64da\u5eab\u540d<\/h3>\n<pre><code>SELECT name FROM v$database;<\/code><\/pre>\n<h3 id=\"%e6%9f%a5%e7%9c%8b%e6%89%80%e6%9c%89%e7%94%a8%e6%88%b6-xBhEmFxMxd\">\u67e5\u770b\u6240\u6709\u7528\u6236<\/h3>\n<pre><code>SELECT username FROM all_users;<\/code><\/pre>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e7%9a%84%e6%95%b8%e6%93%9a%e5%ba%ab%e6%93%8d%e4%bd%9c-xBhEmFxMxd\">\u57fa\u672c\u7684\u6578\u64da\u5eab\u64cd\u4f5c<\/h2>\n<p>\u5728sqlplus\u4e2d\uff0c\u9664\u4e86\u67e5\u8a62\u6578\u64da\u5916\uff0c\u9084\u53ef\u4ee5\u57f7\u884c\u63d2\u5165\u3001\u66f4\u65b0\u548c\u522a\u9664\u7b49\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u64cd\u4f5c\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"%e6%8f%92%e5%85%a5%e6%95%b8%e6%93%9a-xBhEmFxMxd\">\u63d2\u5165\u6578\u64da<\/h3>\n<pre><code>INSERT INTO employees (id, name, salary) VALUES (1, 'John Doe', 50000);<\/code><\/pre>\n<h3 id=\"%e6%9b%b4%e6%96%b0%e6%95%b8%e6%93%9a-xBhEmFxMxd\">\u66f4\u65b0\u6578\u64da<\/h3>\n<pre><code>UPDATE employees SET salary = 55000 WHERE id = 1;<\/code><\/pre>\n<h3 id=\"%e5%88%aa%e9%99%a4%e6%95%b8%e6%93%9a-xBhEmFxMxd\">\u522a\u9664\u6578\u64da<\/h3>\n<pre><code>DELETE FROM employees WHERE id = 1;<\/code><\/pre>\n<h2 id=\"%e9%80%80%e5%87%basqlplus-xBhEmFxMxd\">\u9000\u51fasqlplus<\/h2>\n<p>\u5b8c\u6210\u6240\u6709\u64cd\u4f5c\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fasqlplus\uff1a<\/p>\n<pre><code>EXIT;<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-xBhEmFxMxd\">\u7e3d\u7d50<\/h2>\n<p>\u4f7f\u7528sqlplus\u64cd\u4f5c\u6578\u64da\u5eab\u540d\u662f\u4e00\u500b\u975e\u5e38\u6709\u6548\u7684\u65b9\u5f0f\uff0c\u7121\u8ad6\u662f\u67e5\u8a62\u6578\u64da\u9084\u662f\u57f7\u884c\u6578\u64da\u5eab\u64cd\u4f5c\u3002\u901a\u904e\u672c\u6587\u7684\u4ecb\u7d39\uff0c\u76f8\u4fe1\u8b80\u8005\u80fd\u5920\u638c\u63e1\u57fa\u672c\u7684sqlplus\u4f7f\u7528\u65b9\u6cd5\uff0c\u4e26\u80fd\u5920\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\u9748\u6d3b\u904b\u7528\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u6578\u64da\u5eab\u7ba1\u7406\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a>\u4f86\u63d0\u5347\u60a8\u7684\u696d\u52d9\u6548\u7387\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u4f7f\u7528sqlplus\u64cd\u4f5c\u6578\u64da\u5eab\u540d\uff0c\u638c\u63e1\u57fa\u672c\u547d\u4ee4\u548c\u6280\u5de7\uff0c\u8f15\u9b06\u7ba1\u7406\u548c\u67e5\u8a62\u6578\u64da\u5eab\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-185270","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185270","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=185270"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185270\/revisions"}],"predecessor-version":[{"id":185271,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/185270\/revisions\/185271"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=185270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=185270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=185270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}