• OS – Oracle Linux Server 6.5;
  • DB – Oracle 11gR2 (11.2.0.4.0).
  1. Put ODBC:
    yum install -y unixODBC unixODBC-devel
  2. Downloading source ” FreeTDS” the links that can be found here: www.freetds.org . For example:
    cd / tmp /
    wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
  3. Extract the archive, configure, assemble and install:
    tar -zxf freetds-stable.tgz
    cd freetds-0.91 /
    ./configure --prefix = / usr / local / freetds --enable-msdblib --with-gnu-ld
    make
    make install
  4. Right ” /usr/local/freetds/etc/freetds.conf,” to bring it to look like this:
    [Global]
            tds version = 5.0
            text size = 64512
    
    [MSSQLSERVER]
            host = <YOUR_HOSTNAME_OR_IP_MSSQL>
            port = 1433
            tds version = 7.0
            client charset = UTF-8
  5. In the section ” default” File ” /usr/local/freetds/etc/locales.conf” adding:
    language = russian
  6. Here is ” /etc/odbc.ini” to look like this:
    [MSSQLDSN]
    Description = My MSSQLSERVER
    Driver = /usr/local/freetds/lib/libtdsodbc.so
    Servername = MSSQLSERVER
    Database = MYDB
    
    [ODBC Data Sources]
    SQLDSN = FreeTDS
  7. Check the ODBC settings can be faithful with the “team isql“, like so:
    isql -v MSSQLDSN MSSQL_USERNAME MSSQL_USERNAME_PASSWORD << EOF
    select field1, field2 from table_name;
    EOF
  8. The file ” $ORACLE_HOME/hs/admin/initMRD.ora” add the following lines:
    HS_FDS_CONNECT_INFO = MSSQLDSN
    HS_FDS_TRACE_LEVEL = 0
    HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so
    HS_NLS_NCHAR = UCS2
    set ODBCINI = / etc / odbc.ini
  9. In the “file $ORACLE_HOME/network/admin/listener.ora” adding:
    SID_LIST_LISTENER =
            (SID_LIST =
    ...
                    (SID_DESC =
                            (SID_NAME = MSSQLDSN)
                            (PROGRAM = dg4odbc)
                            (ORACLE_HOME = /opt/oracle/product/11.2.0/dbhome_1)
                            (ENVS = LD_LIBRARY_PATH = / usr / lib64: / usr / local / freetds / lib: $ ORACLE_HOME / lib)
                    )
    ...
            )
  10. The file ” $ORACLE_HOME/network/admin/tnsnames.ora” add a connection:
    MSSQLDSN =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
        )
        (CONNECT_DATA = (SID = MSSQLDSN))
        (HS = OK)
      )
  11. Restart the Oracle instance.
  12. Create a database link, for example:
    CREATE DATABASE LINK MS_DBLINK CONNECT TO MSSQL_USERNAME IDENTIFIED BY MSSQL_USERNAME_PASSWORD USING 'MSSQLDSN';
  13. After all above manipulation must fulfill the command:
    select field1, field2 from table_name @ MS_DBLINK;
(Visited 28 times, 1 visits today)
adminOracleTips
OS - Oracle Linux Server 6.5; DB - Oracle 11gR2 (11.2.0.4.0). Put ODBC: yum install -y unixODBC unixODBC-devel Downloading source ' FreeTDS' the links that can be found here: www.freetds.org . For example: cd / tmp / wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz Extract the archive, configure, assemble and install: tar -zxf freetds-stable.tgz cd freetds-0.91 / ./configure --prefix = / usr / local...

Do you want to be notified about new DBA updates, releases, jobs and free tips? Join our email newsletter. It's fast and easy. You will be among the first to know about hot new DBA updates and stuff, it will help you enhance your DBA skills.
We take your privacy very seriously