Test environment:
OS: XP
In ORACLE 10.1
SQLSERVER2000
HOSTNAME: home-30b98e1e20
Both use the default TCP/IP Port
1. Install the transparent gateway Option
Use Oracle Universal Instraller to choose custom installation on the installed ORACLE_HOME, and select Oracle Transparent Gateways for Microsoft SQL Server,
After the installation is complete, there will be such a directory $ oracle_home \ tg4msql
2. Create the file initsql2000.ora in the $ oracle_hometg4msqladmin directory.The content is as follows:
HS_FDS_CONNECT_INFO = home-30b98e1e20.test # home-30b98e1e20 is the SQL Server Name
HS_FDS_TRACE_LEVEL = OFF
HS_FDS_RECOVERY_ACCOUNT = RECOVER
HS_FDS_RECOVERY_PWD = RECOVER
3. Configure LISTENER. ORA
(SID_DESC =
(GLOBAL_DBNAME = tg4sql) # You can name it yourself.
(PROGRAM = tg4msql)
(SID_NAME = sql2000) # Same as sql2000 in initsql2000.ora.
(ORACLE_HOME = E: \ oracle \ product \ 10.1.0 \ Db_1)
)
4. Use the "service" in Windows to restart the Oracle LISTENER and DATABASE services
5. Configure tnsnames. ora
Sql2000 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = home-30b98e1e20) (PORT = 1521 ))
)
(CONNECT_DATA =
(SID = sql2000)
)
(HS = OK)
)
6. Create a DATABASE LINK
Create database link DB_ SQL CONNECT TO SA IDENTIFIED BY PASSWORD USING 'sql2000 ';
7. Test
Select * from t1 @ sql2000;
Note:
1. HS_FDS_CONNECT_INFO = the service name in the home-30b98e1e20.test is written as localhost or local will be suspended during the test;
2. When using DBLINK, set GLOBAL_NAME in spfile:
If it is true, use the full name of DBLINK, which can be found in all_db_links;
If it is FALSE, you do not have to use the full name. When the ORA-02019: to find the connection description for a remote database appears, use the full name, such:
Select * from t1@sql2000.ORACLE.COM