/*--------------------建立oracle連結的伺服器 --------------------*/EXEC sp_addlinkedserver @server = 'ORCL', --ORCL是SQL中連結的伺服器名稱 @srvproduct = 'Oracle', --Oracle 固定的 @provider = 'MSDAORA', --MSDAORA 固定的 @datasrc = 'ORCL' --DataSrc 本地服務名 GOEXEC SP_ADDLINKEDSRVLOGIN 'ORCL', false, 'sa', 'SCOTT', 'admin' --Sa是SQL本地登入帳號,POS/POS是ORACLE的登入帳號,但這句話對我們要達到的目的沒有協助。 --測試SELECT * FROM ORCL..SCOTT.EMP --注意大寫/*---------------------建立sqlserver連結的伺服器------------------------------------*/EXEC master.dbo.sp_addlinkedserver @server = N'192.168.0.170', @srvproduct=N'SQL Server'GOexec sp_addlinkedsrvlogin '192.168.0.170','false','sa','sa','123465'goSELECT * FROM [192.168.0.170].pubs.dbo.authors--可以通過dts把表結構建好在目標oracle上/*------------------------匯入資料------------------------------------------------------*/SELECT * FROM ORCL..SCOTT.zx_nrinsert ORCL..SCOTT.authors select * from authors insert ORCL..SCOTT.employee select * from employee insert ORCL..SCOTT.jobs select * from jobs insert ORCL..SCOTT.stores select * from stores insert ORCL..SCOTT.sales select * from [192.168.0.170].pubs.dbo.salesinsert ORCL..SCOTT.zx_xx select top 100 wj
from [192.168.0.170].vsatdata.dbo.zx_xx where lx='2'insert ORCL..SCOTT.zx_nr select top 10 * from [192.168.0.170].vsatdata.dbo.zx_nr
where wj in (select top 100 wj from [192.168.0.170].vsatdata.dbo.zx_xx where lx='2')select top 10 * from [192.168.0.170].vsatdata.dbo.zx_gp_nr