如何从SQL Server迁移大批量数据到Oracle

如题所述

第一步:从SQLSERVER中导出数据
在SQLSERVER数据库上使用Import and Export Data工具
1.在choose a Data source页
选取:
source= Microsoft OLE DB Porvider for Sql Server
server=local
database=icd_db_bill
{use Sql Server authentication}
user=sa
选择下一步
2.在choose destination 页中
选取destination为Text File
file name ="d:\backup\tbilllog1.txt"
选择下一步
3. 选择use a query to specify the data to transfer
选择下一步
注:由于SQLSERVER导出时会将table_id作为一个域导出,而oracle没有(oracle 为rowid),所以必须选择此项为use a query to specify the data to transfer而不是copy table(s) from source database
4.在Query Builder选项进入
选取tbilllog1,添加然后将table_id从列表中去掉
一直确认直到select Destination File Format页面
5.选择
file type =ansi (缺省)
row={cr}{lf} (缺省)
column=comma (缺省)
text= double quote{"} (缺省)
在comumn和text选项会影响到oracle的controlfile的设置

第二步:
oracle方面的设置
首先将tbilllog1.txt 拷贝到log1.ctl的目录
提示:如果NT平台可以先压缩再传送可以节省时间,到目的目录再解开
controlfile example: log1.ctl
LOAD DATA
INITFILE 'tbilllog1.txt'
insert into table tbilllog1
fields terminated by ',' optionally enclosed by '"'
(
callid,
callidnum,
callerno,
calleeno,
waitbegin date "yyyy--mm-dd hh24:mi:ss",
waitend date "yyyy-mm-dd hh24:mi:ss",
ackbegin date "yyyy-mm-dd hh24:mi:ss",
ackend date "yyyy-mm-dd hh24:mi:ss",
...
)
*fields terminated by ','指明域由,分割,对应到上面第5步的column=comma
*optionally enclose by '"'指明字符型数据有" "括起来,对应到text=double quote{"}如果选择text=none 不加此语句。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-05-08
相似回答