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

相关文章

Python调用Orator ORM进行数据库操作

《Python调用OratorORM进行数据库操作》OratorORM是一个功能丰富且灵活的PythonORM库,旨在简化数据库操作,它支持多种数据库并提供了简洁且直观的API,下面我们就... 目录Orator ORM 主要特点安装使用示例总结Orator ORM 是一个功能丰富且灵活的 python O

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

PLsql Oracle 下载安装图文过程详解

《PLsqlOracle下载安装图文过程详解》PL/SQLDeveloper是一款用于开发Oracle数据库的集成开发环境,可以通过官网下载安装配置,并通过配置tnsnames.ora文件及环境变... 目录一、PL/SQL Developer 简介二、PL/SQL Developer 安装及配置详解1.下

使用Navicat工具比对两个数据库所有表结构的差异案例详解

《使用Navicat工具比对两个数据库所有表结构的差异案例详解》:本文主要介绍如何使用Navicat工具对比两个数据库test_old和test_new,并生成相应的DDLSQL语句,以便将te... 目录概要案例一、如图两个数据库test_old和test_new进行比较:二、开始比较总结概要公司存在多

MySQL数据库函数之JSON_EXTRACT示例代码

《MySQL数据库函数之JSON_EXTRACT示例代码》:本文主要介绍MySQL数据库函数之JSON_EXTRACT的相关资料,JSON_EXTRACT()函数用于从JSON文档中提取值,支持对... 目录前言基本语法路径表达式示例示例 1: 提取简单值示例 2: 提取嵌套值示例 3: 提取数组中的值注意

查询SQL Server数据库服务器IP地址的多种有效方法

《查询SQLServer数据库服务器IP地址的多种有效方法》作为数据库管理员或开发人员,了解如何查询SQLServer数据库服务器的IP地址是一项重要技能,本文将介绍几种简单而有效的方法,帮助你轻松... 目录使用T-SQL查询方法1:使用系统函数方法2:使用系统视图使用SQL Server Configu

SQL Server数据库迁移到MySQL的完整指南

《SQLServer数据库迁移到MySQL的完整指南》在企业应用开发中,数据库迁移是一个常见的需求,随着业务的发展,企业可能会从SQLServer转向MySQL,原因可能是成本、性能、跨平台兼容性等... 目录一、迁移前的准备工作1.1 确定迁移范围1.2 评估兼容性1.3 备份数据二、迁移工具的选择2.1

Python中连接不同数据库的方法总结

《Python中连接不同数据库的方法总结》在数据驱动的现代应用开发中,Python凭借其丰富的库和强大的生态系统,成为连接各种数据库的理想编程语言,下面我们就来看看如何使用Python实现连接常用的几... 目录一、连接mysql数据库二、连接PostgreSQL数据库三、连接SQLite数据库四、连接Mo

oracle如何连接登陆SYS账号

《oracle如何连接登陆SYS账号》在Navicat12中连接Oracle11g的SYS用户时,如果设置了新密码但连接失败,可能是因为需要以SYSDBA或SYSOPER角色连接,解决方法是确保在连接... 目录oracle连接登陆NmOtMSYS账号工具问题解决SYS用户总结oracle连接登陆SYS账号