时间:2021-07-01 10:21:17 帮助过:2人阅读
实际上,就是设置了一个$TNS_ADMIN的环境变量:
[oracle@timesten-hol info]$ echo $TNS_ADMIN
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
[oracle@timesten-hol info]$ ls $TNS_ADMIN
listener.ora samples shrept.lst sqlnet.ora tnsnames.ora
[oracle@timesten-hol info]$ ls $TNS_ADMIN/tnsnames.ora
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
$ cat $TNS_ADMIN/tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TTORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
)
)
然后就可以使用sqlplus测试连接Oracle,如果成功,说明tnsnames.ora设置正确,Oracle数据库物理可达。
注意sqlplus程序以及包含在TimesTen的安装程序中,无需安装Oracle的客户端。
[oracle@timesten-hol info]$ sqlplus / as sysdba@ttorcl
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 13 06:27:44 2016
Copyright (c) 1982, 2010, 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
SQL>
然后可以测试通过timesten间接联通Oracle:
$ ttisql -v1 "uid=tthr;pwd=timesten;dsn=cachedb1;oraclepwd=oracle"
Command> passthrough 3
Command> select * from product_component_version;
< NLSRTL , 11.2.0.1.0, Production >
< Oracle Database 11g Enterprise Edition , 11.2.0.1.0, 64bit Production >
< PL/SQL , 11.2.0.1.0, Production >
< TNS for Linux: , 11.2.0.1.0, Production >
Command> passthrough 0
Command> call ttversion;
< 11, 2, 2, 6, 2 >
以上, passthrough 3表示命令在Oracle中执行,passthrough 0表示在TimesTen本地执行。
至此,我们已经可以确定TimesTen与Oracle数据库的连通性已经正确设置。
设置TimesTen与Oracle数据库的连通性
标签: