Link
Link
Note: I encountered some errors while testing the DBLink, indicating that global_names should be set to
false. Since this is a production environment and we are unsure of the impact, I have added a trigger to
set global_names to false, but only for the particular user Oracle schema
Prerequisites:
Note: Make sure the service account has got the access on DB SQLserver
Oracle Database Gateway for Microsoft SQL Server (DG4MSQL) must be installed and properly
configured.
You should have the necessary permissions to modify Oracle configuration files (like listener.ora,
tnsnames.ora) and create database links.
The first step is to create the Oracle Gateway initialization file, which will configure the connection to the
target SQL Server.
Steps:
bash
Copy
cd /*****/opt00/oracle/product/gateway/dg4msql/admin
# HS init parameters
HS_FDS_CONNECT_INFO=[sqlservername]:1433//sqldbname
HS_FDS_TRACE_LEVEL=OFF
Explanation:
o HS_FDS_CONNECT_INFO: Specifies the target SQL Server host (e.g., sqlservername), port (e.g.,
1433), and the database name (e.g., sqldbname).
You need to configure Oracle's listener to recognize the new Oracle Gateway SID (dg4msqlprd).
Steps:
cd $ORACLE_HOME/network/admin
vi listener.ora
(SID_DESC=
(SID_NAME=dg4msqlprd)
(ORACLE_HOME=/orcl/opt00/oracle/product/19.8.0.0)
(PROGRAM=dg4msql)
Explanation:
o SID_NAME: Specifies the SID for the Oracle Gateway (dg4msqlprd).
4. Reload the listener to apply changes: but in solar the sid was already added in listerner but caps
whcih caused the trouble
lsnrctl reload
Next, update the tnsnames.ora file with the configuration for the new DBLink connection.
Steps:
vi tnsnames.ora
2. Add the following configuration for the new DBLink: again here the program and SID was same
that too cap letters
dg4msqlprd =
(DESCRIPTION =
(CONNECT_DATA =
(SID = dg4msqlprd)
(HS = OK)
Explanation:
Steps:
sqlplus ETI_SOURCE/<password>@<oracle_host>
IDENTIFIED BY <password>
USING 'dg4msqlprd';
Explanation:
o CONNECT TO: Specifies the SQL Server user (sqlserver account) for authentication.
3. Verify the DBLink: Run the following query to verify the DBLink is working: login as eti_source
DUMMY
-----
1 row selected.
If the DBLink is functioning correctly, you should see the output from the connected SQL Server
database.
After creating the DBLink, it is important to verify that everything works as expected.
Steps:
1. Test the DBLink: Run a query that references SQL Server data, for example:
2.
COUNT(*)
----------
531
1 row selected.
3. Check the Oracle Gateway Logs: If the query fails, check the Oracle Gateway logs for any errors:
Go to --> $ORACLE_HOME/dg4msql/log/