oracle报错02122,Timesten Cache to Oracle

本文详细介绍了在Linux环境下安装TimesTen数据库的步骤,并展示了如何为TimesTen创建数据源(DSN)、配置tnsnames.ora、创建数据库用户以及在TimesTen中创建缓存组。此外,还阐述了设置主动主数据库和备用数据库的复制操作,包括创建数据库用户、定义活动备用对、启动复制代理等步骤。
摘要由CSDN通过智能技术生成

1.TimesTen-Isntall-Linux

省略,详细步骤链接http://blog.sina.com.cn/s/blog_b6a665450102v3cw.html

2. Cache to oracle

2.1 Create a DSN for the TimesTen database

Before you can use Oracle In-Memory Database Cache, you must create

some Oracle users:

A user timesten owns Oracle tables that store information about

cache grids.

One or more schema users own the Oracle tables to be cached in a

TimesTen database. These may be existing users or new users.

A cache administration user creates and maintains Oracle objects

that store information used to manage cache grids and enforce

predefined behaviors of particular cache group types.

Start SQL*Plus on the Oracle system from an operating system shell

or command prompt, and connect to the Oracle database instance as

the sys user.

Use SQL*Plus to create a default tablespace that will be used by

both the timesten user and the cache administration user. This

tablespace should only be used to store objects for Oracle

In-Memory Database Cache and should not be shared with other

/applications. Then run the SQL*Plus script

TimesTen_install_dir/oraclescripts/initCacheGlobalSchema.sql to

create the following elements:

The timesten user

The Oracle tables owned by the timesten user to store information

about cache grids

The TT_CACHE_ADMIN_ROLE role that defines privileges on these

Oracle tables

Pass the default tablespace as an argument to the

initCacheGlobalSchema.sql script. In the following example, the

name of the default tablespace is cachetblsp:

SQL> CREATE TABLESPACE cachetblsp DATAFILE 'datfttuser.dbf' SIZE

100M;

SQL> @initCacheGlobalSchema "cachetblsp" SQL> CREATE USER test IDENTIFIED BY test;

SQL> GRANT dba to test; 2.2 Create a DSN for the TimesTen database

Vi sys.odbc.ini

[test]

Driver=/tt/TimesTen/tt1122/lib/libtten.so

DataStore=/tt/TimesTen/tt1122/info/DemoDataStore/test

PermSize=40

TempSize=32

PLSQL=1

DatabaseCharacterSet=ZHS16GBK

uid=test

pwd=test

oracleid=tnseproe

oraclepwd=test 2.3 配置tns

[timesten@wlsttnode1 admin]$ more tnsnames.ora

tnseproe =

(DESCRIPTION =

(ADDRESS =

(PROTOCOL = TCP)(HOST = 192.168.25.10)(PORT=1521))

(CONNECT_DATA =

(SERVICE_NAME = eproe)

)

)

2.4 Create users in the TimesTen database

[timesten@wlsttnode1 info]$ ttisql test

Copyright (c) 1996-2011, Oracle. All rights

reserved.

Type ? or "help" for help, type "exit" to quit ttIsql.

connect "DSN=test";

Connection successful:

DSN=test;UID=test;DataStore=/tt/TimesTen/tt1122/info/DemoDataStore/test;DatabaseCharacterSet=ZHS16GBK;ConnectionCharacterSet=US7ASCII;DRIVER=/tt/TimesTen/tt1122/lib/libtten.so;OracleId=tnseproe;PermSize=40;TempSize=32;TypeMode=0;OracleNetServiceName=tnseproe;

(Default setting AutoCommit=1)

Command> call

ttCacheUidPwdSet('test','test');

Command> call ttGridCreate('myGrid');

Command> call ttGridNameSet('myGrid');

Command> CREATE DYNAMIC ASYNCHRONOUS WRITETHROUGH GLOBAL CACHE

GROUP writecache FROM test.writetb (id NUMBER NOT NULL PRIMARY

KEY,name VARCHAR2(50));

Command> CREATE READONLY CACHE GROUP readcache AUTOREFRESH

INTERVAL 5 SECONDS FROM test.tt_test (id NUMBER NOT NULL PRIMARY

KEY,name VARCHAR2(50));

Warning 5002: Unable to connect to the cache

agent for /tt/TimesTen/tt1122/info/DemoDataStore/test; check agent

status

Warning 5051: Commit message to cache agent

failed. Cache agent must be restarted

Command> call ttcachestart;

Command> CREATE READONLY CACHE GROUP readcache AUTOREFRESH

INTERVAL 5 SECONDS FROM test.tt_test (id NUMBER NOT NULL PRIMARY

KEY,name VARCHAR2(50));

8224: Cache group READCACHE already exists

The command failed.

Command> cachegroups

Cache Group TEST.READCACHE:

Cache Group Type: Read Only

Autorefresh: Yes

Autorefresh Mode: Incremental

Autorefresh State: Paused

Autorefresh Interval: 5 Seconds

Autorefresh Status: ok

Aging: No aging defined

Root Table: TEST.TT_TEST

Table Type: Read Only

Cache Group TEST.WRITECACHE:

Cache Group Type: Asynchronous Writethrough

global (Dynamic)

Autorefresh: No

Aging: LRU on

Root Table: TEST.WRITETB

Table Type: Propagate

2 cache groups found.

Command>

Command>

Command> select * from test.tt_test;

0 rows found.

Command> select * from TEST.WRITETB;

0 rows found.

Command> LOAD CACHE GROUP readcache COMMIT EVERY 256 ROWS;

4 cache instances affected.

Command> LOAD CACHE GROUP WRITECACHE COMMIT EVERY 256

ROWS;

3319: This operation needs the database to attach

to the grid first

The command failed.

Command> call

ttGridAttach(1,'WRITECACHE','wlsttnode1',5001);

Command> LOAD CACHE GROUP WRITECACHE COMMIT EVERY 256

ROWS;

3 cache instances affected.

Command>

Command> select * from test.tt_test;

< 1, Hello >

< 2, World >

< 3, tsttt >

< 4, sddf >

4 rows found.

Command> select * from test.radcache;

2206: Table TEST.RADCACHE not found

The command failed.

Command> select * from TEST.WRITETB;

< 1, sss >

< 2, dfdsaf >

< 3, sddf >

3 rows found.

Command>

SQL> insert into tt_test values(5,'mema');

Command> select * from test.tt_test;

< 1, Hello >

< 2, World >

< 3, tsttt >

< 4, sddf >

< 5, mema >

5 rows found.

3 Timesten to Timesten

3.1 Setting up an Active Master Database

ttisql repdb1_1122 3.1.1Create a Database User to Administer the Replication

Operations

create user adm identified by adm;

grant admin to adm;

create table customers (

cust_number number,

first_name varchar2(12) not

null,

last_name varchar2(12) not

null,

address varchar2(100) not

null,

primary key (cust_number));

insert into customers values (3700,'Peter','Burchard','882

Osborne Avenue, Boston, MA 02122');

insert into customers values (1121,'Saul','Mendoza','721 Stardust

Street, Mountain View, CA 94043');

create table orders (

order_number number not

null,

cust_number number not

null,

prod_number char(10) not

null,

order_date date not

null,

primary key (order_number),

foreign key (cust_number) references customers

(cust_number));

insert into ORDERS values

(6853036,3700,'0028616731',to_date('2008-04-05','yyyy-mm-dd'));

insert into ORDERS values

(6853041,3700,'0198612710',to_date('2009-01-12','yyyy-mm-dd'));

insert into ORDERS values

(6853169,1121,'0003750299',to_date('2008-08-01','yyyy-mm-dd'));

insert into ORDERS values

(6853174,1121,'0789428741',to_date('2008-10-25','yyyy-mm-dd'));

insert into ORDERS values

(6853179,1121,'0198612583',to_date('2009-02-02','yyyy-mm-dd'));

Define the active standby pair

connect "dsn=repdb1_1122;uid=adm;pwd=adm";

create active standby pair repdb1_1122 on "tthost1", repdb2_1122 on

"tthost2";

3.1.2Set the replication state to Active

call ttrepstateset ('active');

call ttrepstateget;

3.1.3Start the replication agent

call ttrepstart;

3.2Creating a Standby Database

3.2.1Duplicate the active database to the standby

ttrepadmin -duplicate -from repdb1_1122 -host "tthost1" -uid adm

-pwd adm "dsn=repdb2_1122"

3.2.2Start the replication agent

connect "dsn=repdb2_1122;uid=adm;pwd=adm";

call ttrepstart;

call ttrepstateget;

3.3Verify the data is being replicated between the active and the

standby

connect "dsn=repdb1_1122;uid=adm;pwd=adm";

insert into orders values (6853180,1121,'9999999999',

sysdate);

select * from orders where order_number=6853180;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值