dmlink creation of oracle arrival dream

Posted by ZimmerX on Wed, 05 Jan 2022 09:31:14 +0100

odbc installation and configuration and common problems

For installation and configuration, refer to:
https://blog.csdn.net/juracka/article/details/111690943?spm=1001.2014.3001.5501

1. Modification of configuration file

This use yum Installation, modification after installation odbc Two profiles:

cat /etc/odbc.ini
[dm8]
Driver       = DM8 ODBC DRIVER
Description  = DM ODBC DSND
SERVER  = 192.168.1.132
UID         = SYSDBA
PWD     = SYSDBA
TCP_PORT     = 5236

cat /etc/odbcinst.ini
[DM8 ODBC DRIVER]
Description = ODBC DRIVER FOR DM8
Driver = /usr/lib/libdodbc.so

2. Test

[oracle@localhost ~]$ isql -v dm8
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
	SQL>

3. Common problems

(1) If the Damon client is not installed on the oracle server, you can install one or directly copy and upload it from the bin directory of the installed Damon.
(2) Note libdodbc So file, oracle needs permission to access this file. It can be found in / home / oracle / bash_ Add the path of Dameng bin directory in the profile, for example:

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:$ORACLE_HOME/dmbin

Also pay attention to permissions. Here, the file is directly copied to / usr/lib.

File configuration and points for attention

listener.ora

1. File location

$ORACLE_HOME/network/admin

2. Configuration
Add the following contents to the document:

SID_LIST_LISTENER=
  (SID_LIST=
    (SID_DESC=
      (SID_NAME=dm8)
      (ORACLE_HOME=/u01/oracle/product/11.2.0/db_1)
      (PROGRAM=dg4odbc)
     (ENVS=LD_LIBRARY_PATH=/u01/oracle/product/11.2.0/db_1/lib)
    )
  )

3. Restart listening

[oracle@localhost ~]$ lsnrctl reload

4. Attention
PROGRAM=dg4odbc. Dg4odbc cannot be modified here. Do not change it to sid. Here, $Oracle will be executed_ A file named dg4odbc under home / bin is a protocol for Oracle to understand different databases;

tnsnames.ora

1. File location

$ORACLE_HOME/network/admin

2. Configuration
Add the following after the document

dm8 =
  (DESCRIPTION=
    (ADDRESS=
        (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)
    )
   (CONNECT_DATA=
     (SID=dm8)
    )
    (HS=OK)
)

3. Test

 [oracle@localhost ~]$ tnsping dm8

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 30-JUL-2021 15:29:18

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:
/u01/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=localhost) (PORT=1521)) (CONNECT_DATA= (SID=dm8)) (HS=OK))
OK (0 msec)

4. Attention
Both host and port are written in oracle, not the address and port of Dameng library.

initdm8.ora

1. Location

$ORACLE_HOME/hs/admin

2. Configuration

vim initdm8.ora //new file
HS_FDS_CONNECT_INFO=dm8
HS_FDS_TRACE_LEVEL = debug
HS_FDS_SHAREABLE_NAME=/usr/lib/libdodbc.so
HS_FDS_SUPPORT_STATISTICS=FALSE
HS_LANGUAGE="simplified chinese_china.al32utf8"
HS_NLS_NCHAR=UCS2
set ODBCINI=/etc/odbc.ini

3. Attention
(1) The new file name is init ora
(2)HS_ FDS_ CONNECT_ The names in info and odbc are consistent
(3)HS_ FDS_ TRACE_ Setting level to debug makes it easy to view the error log. Otherwise, an error is often reported during testing. In many cases, such an error is reported. I don't know what the problem is. Open the debug log to facilitate troubleshooting.

Create dblink

create  database link  dmlink  connect to "SYSDBA" identified by "SYSDBA" using 'dm8';

Troubleshooting methods

If you put init HS in ora_ FDS_ TRACE_ Level is set to off. Once an error occurs, it is difficult to troubleshoot the problem. Problem encountered in configuration:

ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from <dblinkname>

We can't see the specific error information, and later tests found that many cases will report errors like this, such as init This error will be reported if the sid in the ora file name is written incorrectly, there is a problem with the character set in the configuration file, and the dynamic library file cannot be found.
After configuring to debug, in the directory

$ORACLE_HOME/hs/log

You can see the detailed error reporting reasons in the to facilitate troubleshooting.
For example, libdodbc.com was written incorrectly in the test So file name (written as libodbc.so)

vim initdm8.ora
HS_FDS_SHAREABLE_NAME=/usr/lib/libodbc.so

[oracle@localhost admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 30 15:48:14 2021
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@orcl> select * from v$version@dmlink;
select * from v$version@dmlink1
                    *
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from DMLINK1

You can't tell the problem by reporting the wrong information.
Viewing the log, you can see:

Oracle Corporation --- FRIDAY    JUL 30 2021 13:57:22.023

    Version 11.2.0.1.0

Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "debug"
Entered hgosdip
 setting HS_OPEN_CURSORS to default of 50
 .......
Exiting hgosdip, rc=0
ORACLE_SID is "dm8"
 Product-Info:
 Port Rls/Upd:1/0 PrdStat:0
 Agent:Oracle Database Gateway for ODBC
 ......
Failed to load ODBC library symbol: /usr/lib/libodbc.so(SQLAllocHandle)
......

Problem found.

For more information, please visit Dameng community: https://eco.dameng.com