惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - highmayor

在ABAP的SQL语句中写Oracle Hints Screen numbers ABAP 培训笔记 part 7 更改选择屏幕的GUI STATUS---RS_SET_SELSCREEN_STATUS 隐藏标准选择屏幕的执行按钮 SAP秀才-FI速成手册 FOR ALL ENTRIES的效率问题 - highmayor SAP学习笔记(HR Develepment学习笔记1) 程序间的调用 abap技术问题中文 - highmayor - 博客园 函数组的文件结构 - highmayor 闲说继承 oracle中使用SQL递归语句 - highmayor oracle删除重复行 深度理解按位异或运算符 一个容易忽略的陷阱:修改字符串常量的值 - highmayor - 博客园 Oracle数据库 Exp/Imp工具性能调优 通过JDBC操作ORACLE数据库 算法的时间复杂度(计算实例)
使用sqlplus copy 命令在两个数据库间转移数据
highmayor · 2010-06-07 · via 博客园 - highmayor

本文介绍了如何利用sqlplus copy 命令在两个数据库间转移数据

无需用到dblink, 两个数据库间不需直接通讯,当然,需要有一个client段能同时以sqlplus连接到两个数据库

问题的提出

论坛上有人提出这样的问题:

假设有两个数据库,分别处于两个不同的网但有一个客户机安了两块网卡可以同时连到两个数据库请问如果不通过在客户机上建中转表,有没有办法实现这两个数据库中从某一个往另一个拷表.

问题的解答

可以使用sqlpluscopy命令来达到。

copy的命令的这个样子的:

usage: COPY FROM <db> TO <db> <opt> <table> { (<cols>) } USING <sel> <db> : database string, e.g., scott/tiger@d:chicago-mktg
<opt> : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE
<table>: name of the destination table
<cols> : a comma-separated list of destination column aliases
<sel> : any valid SQL SELECT statement

实际上写的应该很清楚了,按照那样的语法就可以完成了。

它相当于从FROM DB根据<sel>把数据取到缓冲区,再根据<opt> TO DB中创建table(create)或者 重新创建table(replace),然后把数据insert或者append insert TO DBtable中。

Ø 有一点需要注意的,通常会设置高一点的arraysize,以便使sqlplusDB的交互减少,以达到更好的性能。

Ø 另外,在写database string时,可以不必写出密码,sqlplus会稍后会提示你输入密码。

一个完整的例子:

sqlplus /nolog

SQL> set arraysize 5000

SQL> copy from serol/luo@mescp to serol/luo@ractest create test_copy_table using select * from dba_objects;

Array fetch/bind size is 5000. (arraysize is 5000)
Will commit when done. (copycommit is 0)
Maximum long size is 5000. (long is 5000)
SQLRCN in cpytbl failed: -2120
Table TEST_COPY_TABLE created.
12579 rows selected from serol@mescp.
12579 rows inserted into TEST_COPY_TABLE.
12579 rows committed into TEST_COPY_TABLE at serol@ractest.