Steps to create Database link from Oracle Database to Microsoft SQLServer Database:

Steps to create Database link from Oracle Database to Microsoft SQLServer Database:


Pre-requisites


1. Check Network communication is Opened from Oracle Database Server to MSSQL Database Server using telnet
2. Download the Oracle Gateway Server Software same as your Oracle Database version.


Installation of Oracle Gateway Software
=========


Hope you have downloaded the Dg4msql software for sql server 


1> Create a directory as gateway under $ORACLE_BASE directory. 


2) Invoke the GUI , Select Oracle Gateway for MYSQL and enter the sql server details at the time of installation 


3) Before completing the installation, OUI invokes the NETCA and create a new listener for gateway with new port (ex:1526) 


Note; In case if you have defined any bash profile for TNS_ADMIN, then please comment it 


4. Follow the below note for pre-req for gateway listener 


How to Configure DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX) post install ( Doc ID 562509.1 ) 


edit your gateway listener as recommended in the above note. 


5. create a tnsentry in $ORACLE_HOME/network/admin 


6. export TNS_ADMIN=$gateway home/network/admin 


lsnrctl stop <gateway listener> 


lsnrctl start <gateway listener> 


tnsping <gateway alias> 


conn / as sysdba 


create public database link <test> connect to “<sql server user>” identified by “<password>” using ‘<tnsnames.ora>’ 


select * from dual@test; 

How to create a Database link in GL to transfer FSG reports?



Some times, to migrate FSG reports from one environment to the other, its easy to create a dblink between the source and target environemnts and transfer the reports.


STep-by-Step Process to create database link using General Ledger Responbility.


1. Ensure that network connectivity is open between the Source and Target environments.


2. Login to database node of source instance and copy the contents of tnsnames.ora




Extract from tnsnames.ora


TEST1=
        (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=localhost.domain.com)(PORT=1524))
            (CONNECT_DATA=
                (SID=TEST1)
            )
        )


4. Add the above tns entry in the tnsnames.ora file on the application server node of Target instance (Where db link need to be created)




5. Format the tns entry into a single line as below




(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.domain.com)(PORT=1524))(CONNECT_DATA=(SID=TEST1)))




6. Navigate to General Ledger Superuser Reponsibility.


Click on SEtup->>System–> Database links


A form will popup –> Click on “New Database Link”


Input the below values


Database Name: TEST1
Description :Database link for FSG reports
Connect String:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.domain.com)(PORT=1524))(CONNECT_DATA=(SID=TEST1)))
DOMAIN Name: DOMAIN.COM
Apps Username: APPS
APPS Password: <Password>


7. Verify that db link is created


select * from dba_db_links;

Resolve Error ORA-28500 while accessing Heterogenous Database link (ORACLE TO MSSQL)

After creating a heterogenous database link from Oracle database  to MSSQL Server, getting error message “ORA-28500”


SQL>select sysdate from dual@DBLINK_MSSQL;
                         *
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Oracle][ODBC SQL Server Wire Protocol driver]Connection refused. Verify Host
Name and Port Number. {08001}
ORA-02063: preceding 2 lines from MSSQL_INTG




Reason


$ telnet MSSQLDB 1433
MSSQLDB/1433: Name or service not known


$ telnet 10.x.x.x 1433
Trying 10.x.x.x…
Connected to 10.x.x.x (10.x.x.x).
Escape character is ‘^]’.
^]
telnet> logout
^CConnection closed by foreign host.




I am able to telnet to MSSQL database Server using IP address , but cannot telnet to MSSQL server using hostname





Solution


Contact your Network admin to allow access to 1433 using Servername (MSSQLDB)


(or)


Change the below configuration


1. Set Oracle Home to point to your Gateway Oracle HOME


2. Navigate to $ORACLE_HOME/dg4msql/admin


Change below values in initdg4msql.ora


changed HS_FDS_CONNECT_INFO from MSSQLDB to IP address


#
HS_FDS_CONNECT_INFO=10.x.x.x:1433//wfcdb
# alternate connect format is hostname/serverinstance/databasename
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER




3. Restart the listener in Gateway Oracle HOME


4. Verify the database link is working fine.


SQL>select sysdate from dual@DBLINK_MSSQL;


==>Above Query should return current system date.