Setting up connectivity to an Oracle database is simple, but it is also a very important task. After all, the integration of TimesTen with Oracle, compared to the standalone TimesTen, is a more extensive scenario.
Whether you follow up the cache Group or simply load data from Oracle to TimesTen, you need to pre-set TimesTen connectivity to the Oracle database.
First look at a concept map:
In the TimesTen DSN settings, oraclenetservicename specifies the service name of the back-end Oracle database. While the actual service definition is in Tnsnames.ora, which is perfectly consistent with Oracle's practice, you can simply create a new tnsnames.ora that copies the definition of the original Oracle service to this file, whether it's a single instance or a RAC, Or use an existing tnsnames.ora.
The Tnsnames.ora points to the actual back-end Oracle database, usually not on the same host as TimesTen.
So, where is timesten to find this Tnsnames.ora file? Can be specified at installation time, which is subsequently specified and modified through Ttmodinstall, for example:
[Email protected] info]$ ttmodinstallthe daemon forInstance' tt1122‘ isCurrently configured to Use Port 53392.Would toChange thisPort? [No] The server forInstance' tt1122‘ isCurrently configured to Use Port 53393.Would toChange thisPort? [No] Tns_admin forThe instance' tt1122‘ isCurrently set to'/u01/app/oracle/product/11.2. 0/dbhome_1/network/admin '. Would toChange Tns_admin forThis instance? [Yes]
In fact, a $tns_admin environment variable is set:
[Oracle@timesten-hol Info]$ Echo$TNS _admin/u01/app/oracle/product/11.2.0/dbhome_1/network/admin[oracle@timesten-hol Info]$ Ls$TNS _adminListener.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)))
You can then use the Sqlplus test to connect to Oracle, and if successful, the Tnsnames.ora settings are correct and the Oracle database is physically available.
Note that the Sqlplus program and the installer included in the TimesTen do not require an Oracle client to be installed.
[Email protected] info]$ sqlplus/as [email protected]sql*plus:Release 11.2. 0. 2. 0Production onWed Jul - .: -: - .Copyright (c)1982, ., Oracle. AllRights reserved. Connected to: Oracle Database OneG Enterprise EditionRelease 11.2. 0. 1. 0- -bitProduction withThe partitioning, OLAP, Data Mining andReal Application Testing Optionssql>
You can then test indirect connectivity to Oracle via TimesTen:
$ TTISQL-V1 "uid=tthr;pwd=timesten;dsn=cachedb1;oraclepwd=oracle" command> passthrough 3command> 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 0command> Call ttversion;< , 2, 2, 6, 2 >
Above, Passthrough 3 indicates that the command executes in Oracle, and Passthrough 0 means that it executes locally on timesten.
At this point, we have been able to determine that the connectivity of the TimesTen to the Oracle database has been set correctly.
Setting TimesTen connectivity to Oracle databases