Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
889 views

Oracle To SQL Server Access

This document provides instructions for configuring Oracle Database Gateways to access SQL Server objects from Oracle. It describes downloading and configuring the Oracle Database Gateway software, setting up Oracle net configuration files, creating a database link in Oracle to the SQL Server data source, and provides examples for querying SQL Server tables and executing stored procedures from Oracle.

Uploaded by

saisurya2001
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
889 views

Oracle To SQL Server Access

This document provides instructions for configuring Oracle Database Gateways to access SQL Server objects from Oracle. It describes downloading and configuring the Oracle Database Gateway software, setting up Oracle net configuration files, creating a database link in Oracle to the SQL Server data source, and provides examples for querying SQL Server tables and executing stored procedures from Oracle.

Uploaded by

saisurya2001
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

ACCESS SQL SERVER OBJECTS FROM ORACLE

DG4ODBC Setup

Download Oracle Database Gateways 11gRelease 2 (11.2.0.1.0) for MS Windows (32-bit)

Go on the OTN website:


http://www.oracle.com/technology/software/products/database/index.html

in the following Topic:


Oracle Database 11g Release 2 
Standard Edition, Standard Edition One, and Enterprise Edition

select the platform you want and click on 'See All' button

Then download this product:


Oracle Database Gateways 11g Release 2 (11.2.0.1.0) for Microsoft Windows (32-bit) 

win32_11gR2_client.zip (684,581,290 bytes)
Configuration Setup On Gateway Home (Ex : G:\product\11.2.0\tg_1)
Note : Oracle Gateway Home should be different from Oracle DB Home

- Navigate to <Gateway Home>\Network\Admin and make an entry


In the listener.ora file

##########################################################
# listener.ora Network Configuration File: G:\product\11.2.0\tg_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENERTAGSQLCONN =
(SID_LIST=
(SID_DESC=
(SID_NAME=tagsqlconn)
(ORACLE_HOME= G:\product\11.2.0\tg_1)
(PROGRAM=DG4ODBC)
)
)

LISTENERTAGSQLCONN =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = IG02WB81)(PORT = 50001))
)
)

ADR_BASE_LISTENERTAGSQLCONN = G:\product\11.2.0\tg_1
##########################################################

- Navigate to <Gateway Home>\hs\admin and take copy of initdg4odbc.ora


and rename new file to init<odbc DSN Name>.ora
- Use trace file at the following path to find logs generated
<Gateway Home>\hs\trace
- Open init<odbc DSN Name>.ora and edit as below :
##########################################################
HS_FDS_CONNECT_INFO = <odbc data_source_name>
HS_FDS_TRACE_LEVEL = debug/OFF

Following values are left to their defaults


setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "UCS2"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
setting HS_FDS_SUPPORT_STATISTICS to default of "FALSE"
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 32 assumed for HS_FDS_SQLLEN_INTERPRETATION
##########################################################
Configuration Set up on DB Home

- Edit tnsnames.ora file with a new entry


##########################################################
TAGSQLCONN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.120.29.81)(PORT = 50001))
(CONNECT_DATA=(SID=tagsqlconn))
(HS=OK)
)
##########################################################

- Edit Listener.ora file with a new entry


##########################################################
SID_LIST_LISTENERTAGSQLCONN =
(SID_LIST=
(SID_DESC=
(SID_NAME=tagsqlconn)
(ORACLE_HOME= G:\product\11.2.0\tg_1)
(PROGRAM=DG4ODBC)
)
)

LISTENERTAGSQLCONN =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = IG02WB81)(PORT = 50001))
)
)

ADR_BASE_LISTENERTAGSQLCONN = G:\product\11.2.0\tg_1
##########################################################

- Restart the Listener using lsnrctl utility


##########################################################
C:\> set oracle_sid=G:\product\11.2.0\tg_1 -- path of 11gR2 Gateway
C:\> lsnrctl start listenertagsqlconn
- Check the services after successful running of lsnrctl with name
Oracle<Oracle Home>TNSListener<listener Name>
Ex : OracleOraGtw11gTNSListenerlistenertagsqlconn
Set up on SQL Server objects to access from Oracle

Accessing SQL Server Objects from Oracle


- Connect as Oracle User and create dblink
C:\> set oracle_sid=tnbmpdv
SQL> sqlplus gis/****
SQL> drop public database link tagsqlconn;
create database link tagsqlconn connect to "<SQL Server User>" identified by "*********"
using 'SYSTEM DSN';

- Querying SQL Server Tables/Views


SQL> select count(*) from <SQL Server Object owner>.”Object Name”@<dblink name>
Ex : select count(*) from dbo.” vwRevExpPivotFROMvwMain”@tagsqlconn;

- Executing SQL Server Procedures


DECLARE
c INTEGER;
BEGIN
c:=DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@tagsqlconn
('execute R_CountyYearMapData');
END;
/

You might also like