TimesTen 与Oracle 数据库 12c的结合

2024-02-04 13:48

本文主要是介绍TimesTen 与Oracle 数据库 12c的结合,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

之前的例子都是TimesTen与Oracle 11gr2结合,今天试了一下与DB 12c的结合。
从TimesTen的角度来说,12c和11g没有区别,都是通过tnsnames.ora来连接,主要的工作还是在12c这边。

本文介绍TimesTen 11.2.2.8.11和Oracle DB 12.1.0.2.0的结合,平台为Oracle Linux Server release 6.6

安装完Oracle后,已有一个PDB:pdborcl,以下是一些常用的12c命令
主要的工作是用alter pluggable database pdborcl open将PDB启动,并且利用netca定义tnsnames.ora

[oracle@tt12c ~]$ . oraenv
ORACLE_SID = [orcl] ? orcl
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@tt12c ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0/dbhome_1[oracle@tt12c ~]$ sqlplus / as sysdbaSQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 20 19:48:06 2016Copyright (c) 1982, 2014, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup
ORACLE instance started.Total System Global Area 1660944384 bytes
Fixed Size          2925072 bytes
Variable Size        1056968176 bytes
Database Buffers      587202560 bytes
Redo Buffers           13848576 bytes
Database mounted.
Database opened.SQL> select NAME, DECODE(CDB, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option ?"
, OPEN_MODE, CON_ID from V$DATABASE;  2  NAME      Multitenant Option ?       OPEN_MODE            CON_ID
--------- -------------------------- -------------------- ----------
ORCL      Multitenant Option enabled READ WRITE            0SQL> select CON_ID, NAME, OPEN_MODE from V$PDBS;    CON_ID NAME               OPEN_MODE
---------- ------------------------------ ----------
     2 PDB$SEED              READ ONLY
     3 PDBORCL            MOUNTED <-还没有open,不可用
SQL> alter pluggable database pdborcl open;Pluggable database altered.SQL> select CON_ID, NAME, OPEN_MODE from V$PDBS;    CON_ID NAME               OPEN_MODE
---------- ------------------------------ ----------
     2 PDB$SEED              READ ONLY
     3 PDBORCL            READ WRITESQL> show con_name;CON_NAME
------------------------------
CDB$ROOT
SQL> alter session set container = pdborcl;Session altered.SQL> show con_name;CON_NAME
------------------------------
PDBORCLSQL> ALTER SESSION SET CONTAINER = CDB$ROOT;Session altered.使用netca配置tnsnames.ora,如下:然后登录:
[oracle@localhost admin]$ sqlplus sys/Passw0rd@pdborcl as sysdbaSQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 20 15:48:07 2016Copyright (c) 1982, 2014, Oracle.  All rights reserved.Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> show con_name;CON_NAME
------------------------------
PDBORCL
SQL> create user tthr identified by oracle;User created.
SQL> grant create session,create table to tthr;Grant succeeded.

以下测试TimesTen与Oracle的连接,第一次测试出了个小错,原因是Oracle与TimesTen的字符集不一致,看来passthrough模式也需要两个数据库的字符集一致。

[oracle@tt12c ~]$ sqlplus tthr/oracle@pdborclSQL*Plus: Release 12.1.0.2.0 Production on Wed Apr 20 19:51:15 2016Copyright (c) 1982, 2014, Oracle.  All rights reserved.Last Successful login time: Wed Apr 20 2016 15:53:45 +08:00Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing optionsSQL> SQL> create table oratab(a int);Table created.[oracle@tt12c ~]$ ttisql sampledb_1122
Command> create user tthr identified by timesten;
Command> grant create session, create table to tthr;
[oracle@tt12c ~]$ ttisql sampledb_1122Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.connect "DSN=sampledb_1122";
Connection successful: DSN=sampledb_1122;UID=oracle;DataStore=/home/oracle/TimesTen/tt1122/info/DemoDataStore/sampledb_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/oracle/TimesTen/tt1122/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)
Command> create user tthr identified by timesten;User created.Command> grant create session, create table to tthr;
Command> disconnect
Disconnecting...
Command> connect "dsn=sampledb_1122;uid=tthr;pwd=timesten";
Connection successful: DSN=sampledb_1122;UID=tthr;DataStore=/home/oracle/TimesTen/tt1122/info/DemoDataStore/sampledb_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/oracle/TimesTen/tt1122/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)
Command> create table tttab(a int);
Command> disconnect
Disconnecting...
Command> connect "dsn=sampledb_1122;uid=tthr;pwd=timesten"> ;
Connection successful: DSN=sampledb_1122;UID=tthr;DataStore=/home/oracle/TimesTen/tt1122/info/DemoDataStore/sampledb_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/oracle/TimesTen/tt1122/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0;
(Default setting AutoCommit=1)
Command> create table tttab(a int);
Command> [oracle@tt12c info]$ ttisql "dsn=sampledb_1122;uid=tthr;pwd=timesten;OracleNetServiceName=pdborcl;OraclePWD=oracle"Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.connect "dsn=sampledb_1122;uid=tthr;pwd=********;OracleNetServiceName=pdborcl;OraclePWD=********";
Connection successful: DSN=sampledb_1122;UID=tthr;DataStore=/home/oracle/TimesTen/tt1122/info/DemoDataStore/sampledb_1122;DatabaseCharacterSet=US7ASCII;ConnectionCharacterSet=US7ASCII;DRIVER=/home/oracle/TimesTen/tt1122/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0;OracleNetServiceName=pdborcl;
(Default setting AutoCommit=1)
Command> select * from tttab;
0 rows found.
Command> select * from oratab;2206: Table TTHR.ORATAB not found
The command failed.
Command> passthrough 3
Passthrough command has set autocommit off.
Command> select * from oratab;8296: TimesTen and Oracle database character sets do not match.  TimesTen: US7ASCII, Oracle: AL32UTF8
The command failed.
Command>  

修改字符集后,第二次测试成功了

Command> select * from tttab;
0 rows found.
Command> select * from oratab;2206: Table TTHR.ORATAB not found
The command failed.
Command> passthrough 3
Passthrough command has set autocommit off.
Command> select * from oratab;
0 rows found.
Command> passthrough 0;

这篇关于TimesTen 与Oracle 数据库 12c的结合的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/677712

相关文章

SQL Server修改数据库名及物理数据文件名操作步骤

《SQLServer修改数据库名及物理数据文件名操作步骤》在SQLServer中重命名数据库是一个常见的操作,但需要确保用户具有足够的权限来执行此操作,:本文主要介绍SQLServer修改数据... 目录一、背景介绍二、操作步骤2.1 设置为单用户模式(断开连接)2.2 修改数据库名称2.3 查找逻辑文件名

SQL Server数据库死锁处理超详细攻略

《SQLServer数据库死锁处理超详细攻略》SQLServer作为主流数据库管理系统,在高并发场景下可能面临死锁问题,影响系统性能和稳定性,这篇文章主要给大家介绍了关于SQLServer数据库死... 目录一、引言二、查询 Sqlserver 中造成死锁的 SPID三、用内置函数查询执行信息1. sp_w

Oracle修改端口号之后无法启动的解决方案

《Oracle修改端口号之后无法启动的解决方案》Oracle数据库更改端口后出现监听器无法启动的问题确实较为常见,但并非必然发生,这一问题通常源于​​配置错误或环境冲突​​,而非端口修改本身,以下是系... 目录一、问题根源分析​​​二、保姆级解决方案​​​​步骤1:修正监听器配置文件 (listener.

Druid连接池实现自定义数据库密码加解密功能

《Druid连接池实现自定义数据库密码加解密功能》在现代应用开发中,数据安全是至关重要的,本文将介绍如何在​​Druid​​连接池中实现自定义的数据库密码加解密功能,有需要的小伙伴可以参考一下... 目录1. 环境准备2. 密码加密算法的选择3. 自定义 ​​DruidDataSource​​ 的密码解密3

Maven项目中集成数据库文档生成工具的操作步骤

《Maven项目中集成数据库文档生成工具的操作步骤》在Maven项目中,可以通过集成数据库文档生成工具来自动生成数据库文档,本文为大家整理了使用screw-maven-plugin(推荐)的完... 目录1. 添加插件配置到 pom.XML2. 配置数据库信息3. 执行生成命令4. 高级配置选项5. 注意事

在Java中基于Geotools对PostGIS数据库的空间查询实践教程

《在Java中基于Geotools对PostGIS数据库的空间查询实践教程》本文将深入探讨这一实践,从连接配置到复杂空间查询操作,包括点查询、区域范围查询以及空间关系判断等,全方位展示如何在Java环... 目录前言一、相关技术背景介绍1、评价对象AOI2、数据处理流程二、对AOI空间范围查询实践1、空间查

Python+PyQt5实现MySQL数据库备份神器

《Python+PyQt5实现MySQL数据库备份神器》在数据库管理工作中,定期备份是确保数据安全的重要措施,本文将介绍如何使用Python+PyQt5开发一个高颜值,多功能的MySQL数据库备份工具... 目录概述功能特性核心功能矩阵特色功能界面展示主界面设计动态效果演示使用教程环境准备操作流程代码深度解

MySQL数据库实现批量表分区完整示例

《MySQL数据库实现批量表分区完整示例》通俗地讲表分区是将一大表,根据条件分割成若干个小表,:本文主要介绍MySQL数据库实现批量表分区的相关资料,文中通过代码介绍的非常详细,需要的朋友可以参考... 目录一、表分区条件二、常规表和分区表的区别三、表分区的创建四、将既有表转换分区表脚本五、批量转换表为分区

MySQL Workbench工具导出导入数据库方式

《MySQLWorkbench工具导出导入数据库方式》:本文主要介绍MySQLWorkbench工具导出导入数据库方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝... 目录mysql Workbench工具导出导入数据库第一步 www.chinasem.cn数据库导出第二步

Mysql数据库中数据的操作CRUD详解

《Mysql数据库中数据的操作CRUD详解》:本文主要介绍Mysql数据库中数据的操作(CRUD),详细描述对Mysql数据库中数据的操作(CRUD),包括插入、修改、删除数据,还有查询数据,包括... 目录一、插入数据(insert)1.插入数据的语法2.注意事项二、修改数据(update)1.语法2.有