我在CentOS服务器上安装了Oracle InstantClient 12.1 basic和Oracle InstantClient ODBC 12.1。
我配置了odbc.ini
,odbcinst.ini
和tnsnames.ora
以及环境变量。现在我可以从isql
连接,但是我的Asterisk以root身份运行,无法在那里记录CDR。当我重新加载res_odbc.so
时,我收到以下错误消息:
[Jun 21 18:10:03] NOTICE[4843]: res_odbc.c:792 load_odbc_config: Adding ENV var: ORACLE_HOME=/usr/lib/oracle/12.1/client64
[Jun 21 18:10:03] NOTICE[4843]: res_odbc.c:792 load_odbc_config: Adding ENV var: LD_LIBRARY_PATH=:$ORACLE_HOME/lib
[Jun 21 18:10:03] NOTICE[4843]: res_odbc.c:792 load_odbc_config: Adding ENV var: TWO_TASK=192.168.0.103:1521/pss55$
[Jun 21 18:10:03] NOTICE[4843]: res_odbc.c:1527 odbc_obj_connect: Connecting oracle_cdr
[Jun 21 18:10:03] WARNING[4843]: res_odbc.c:1552 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=12154 [unixODBC][Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified
tnsnames.ora:
TEST = (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 192.168.0.103)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = ORA92)
) )
odbc.ini:
[oracle_cdr]
Description = myoracledb database
Driver = ORA92
DSN = oracle_cdr
ServerName = TEST
Trace = yes
TraceFile = /tmp/odbc_oracle.log
Database = 192.168.0.103:1521/pss55$
UserID = billing
Password = fff
Port = 1521
odbcinst.ini:
[ORA92]
Description = Oracle ODBC driver for Oracle 12c
Driver = /usr/lib/oracle/12.1/client64/lib/libsqora.so.12.1
FileUsage = 1
Driver Logging = 7
和ENV vars是:
export LD_LIBRARY_PATH=:/usr/lib/oracle/12.1/client64/lib
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export TWO_TASK=192.168.0.103:1521/pss55$
export TNS_ADMIN=/etc/oracle
任何人都可以帮我确定问题所在吗?