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

相关文章

MySQL 数据库表操作完全指南:创建、读取、更新与删除实战

《MySQL数据库表操作完全指南:创建、读取、更新与删除实战》本文系统讲解MySQL表的增删查改(CURD)操作,涵盖创建、更新、查询、删除及插入查询结果,也是贯穿各类项目开发全流程的基础数据交互原... 目录mysql系列前言一、Create(创建)并插入数据1.1 单行数据 + 全列插入1.2 多行数据

MySQL 数据库表与查询操作实战案例

《MySQL数据库表与查询操作实战案例》本文将通过实际案例,详细介绍MySQL中数据库表的设计、数据插入以及常用的查询操作,帮助初学者快速上手,感兴趣的朋友跟随小编一起看看吧... 目录mysql 数据库表操作与查询实战案例项目一:产品相关数据库设计与创建一、数据库及表结构设计二、数据库与表的创建项目二:员

MybatisPlus中removeById删除数据库未变解决方案

《MybatisPlus中removeById删除数据库未变解决方案》MyBatisPlus中,removeById需实体类标注@TableId注解以识别数据库主键,若字段名不一致,应通过value属... 目录MyBATisPlus中removeBypythonId删除数据库未变removeById(Se

在 Spring Boot 中连接 MySQL 数据库的详细步骤

《在SpringBoot中连接MySQL数据库的详细步骤》本文介绍了SpringBoot连接MySQL数据库的流程,添加依赖、配置连接信息、创建实体类与仓库接口,通过自动配置实现数据库操作,... 目录一、添加依赖二、配置数据库连接三、创建实体类四、创建仓库接口五、创建服务类六、创建控制器七、运行应用程序八

SpringBoot结合Knife4j进行API分组授权管理配置详解

《SpringBoot结合Knife4j进行API分组授权管理配置详解》在现代的微服务架构中,API文档和授权管理是不可或缺的一部分,本文将介绍如何在SpringBoot应用中集成Knife4j,并进... 目录环境准备配置 Swagger配置 Swagger OpenAPI自定义 Swagger UI 底

Oracle迁移PostgreSQL隐式类型转换配置指南

《Oracle迁移PostgreSQL隐式类型转换配置指南》Oracle迁移PostgreSQL时因类型差异易引发错误,需通过显式/隐式类型转换、转换关系管理及冲突处理解决,并配合验证测试确保数据一致... 目录一、问题背景二、解决方案1. 显式类型转换2. 隐式转换配置三、维护操作1. 转换关系管理2.

Oracle查询表结构建表语句索引等方式

《Oracle查询表结构建表语句索引等方式》使用USER_TAB_COLUMNS查询表结构可避免系统隐藏字段(如LISTUSER的CLOB与VARCHAR2同名字段),这些字段可能为dbms_lob.... 目录oracle查询表结构建表语句索引1.用“USER_TAB_COLUMNS”查询表结构2.用“a

Oracle数据库定时备份脚本方式(Linux)

《Oracle数据库定时备份脚本方式(Linux)》文章介绍Oracle数据库自动备份方案,包含主机备份传输与备机解压导入流程,强调需提前全量删除原库数据避免报错,并需配置无密传输、定时任务及验证脚本... 目录说明主机脚本备机上自动导库脚本整个自动备份oracle数据库的过程(建议全程用root用户)总结

虚拟机Centos7安装MySQL数据库实践

《虚拟机Centos7安装MySQL数据库实践》用户分享在虚拟机安装MySQL的全过程及常见问题解决方案,包括处理GPG密钥、修改密码策略、配置远程访问权限及防火墙设置,最终通过关闭防火墙和停止Net... 目录安装mysql数据库下载wget命令下载MySQL安装包安装MySQL安装MySQL服务安装完成

MySQL进行数据库审计的详细步骤和示例代码

《MySQL进行数据库审计的详细步骤和示例代码》数据库审计通过触发器、内置功能及第三方工具记录和监控数据库活动,确保安全、完整与合规,Java代码实现自动化日志记录,整合分析系统提升监控效率,本文给大... 目录一、数据库审计的基本概念二、使用触发器进行数据库审计1. 创建审计表2. 创建触发器三、Java