Thursday, October 01, 2015

No timesten tab in sql developer ?




Following https://docs.oracle.com/cd/E55747_01/doc.41/e39882/connect.htm to config sql developer.
But no timesten tab found.



googled and realize needing to install timesclient first.

following https://docs.oracle.com/cd/E11882_01/timesten.112/e21632/install.htm#TTINS171

for timesten client installation


Program Folder: TimesTen 11.2.2 (32-bit)
Register TimesTen enviroment variables: Enabled
World-Writeable: Enabled
PL/SQL: Enabled
Java Version: JDK 6
Java Classpath: C:\TimesTen\tt1122_32\lib\ttjdbc6.jar

Destination Location: C:\TimesTen\tt1122_32\
Demo Data_Store Location: C:\Users\liqy\AppData\Roaming\TimesTen\DemoDataStore

Features Selected:
            TimesTen Data Manager
            TimesTen Documentation
            TimesTen Client
            TimesTen Quickstart


Finally , see the timesten tab in sql developer.




Next, I am a bit confused by the username and password needed. Here are information found from various source.

UID


Specify a user name that is defined on the TimesTen server. When caching data from an Oracle database, the UID must match the UID on the Oracle database that is being cached in TimesTen.

In the Username field, enter the TimesTen user. If you use the TimesTen database to cache data from an Oracle database, enter the TimesTen cache manager user name. If you use the TimesTen database to load data from an Oracle database, enter the TimesTen user name that has SELECT privileges on the Oracle database tables that you want to load.


PWD

In the Password field, enter the password for the TimesTen user.


Specify the password that corresponds with the specified UID. When caching data from an Oracle database, PWD specifies the TimesTen password. You can specify the Oracle PWD in the connection string, if necessary.






As shown above, I can connect to timesten use either cacheadm or hr to connect to database, subject to purpose/function interested.

PLS-00201: identifier 'SYS.TT_STATS' must be declared in timesten 11.2.2.8.0

When using sql developer to create snapshot for timesten, following the demo http://www.oracle.com/webfolder/technetwork/tutorials/demos/db/timesten/tt1122/SQLDev/ttstats_viewlet_swf.html

An error was encountered performing the requested operation:

TT8503: ORA-06550: line 1, column 28:
PLS-00201: identifier 'TT_STATS' must be declared

Vendor code 8503



orarac1poc:DG:/u01/app/timesten/TimesTen/tt1122/quickstart/sample_code/jdbc> ttisql -version
TimesTen Release 11.2.2.8.0

orarac1poc:DG:/u01/app/timesten/TimesTen/tt1122> ttisql

Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.


Command> connect  "dsn=cachedb1_1122;uid=cacheadm;oraclepwd=xxxxxx";
Enter password for 'cacheadm':
Connection successful: DSN=cachedb1_1122;UID=cacheadm;DataStore=/u01/app/timesten/TimesTen/tt1122                        /info/DemoDataStore/cachedb1_1122;DatabaseCharacterSet=WE8MSWIN1252;ConnectionCharacterSet=US7ASC                        II;DRIVER=/u01/app/timesten/TimesTen/tt1122/lib/libtten.so;PermSize=40;TempSize=32;TypeMode=0;OracleNetServiceName=DG;
(Default setting AutoCommit=1)

-- Able to describe the procedure

Command> desc tt_stats;

Package SYS.TT_STATS:

  Procedure CAPTURE_SNAPSHOT:
    Arguments:
      CAPTURE_LEVEL                   IN     VARCHAR2 DEFAULTED
      DESCRIPTION                     IN     VARCHAR2 DEFAULTED

 ...



  Procedure SHOW_SNAPSHOTS:
    Arguments:
      RESULTSET                       OUT    PL/SQL TABLE SYS.TT_STATS.REPORT_TABLE
                                               VARCHAR2(32767)

Command> select * from dba_objects where object_name='TT_STATS';
< SYS, TT_STATS, , 316, , PACKAGE, 2015-09-21 15:08:22, 2015-09-21 15:08:22, 2015-09-21:15:08:22, VALID, N, N, N, 1, >
< SYS, TT_STATS, , 318, , PACKAGE BODY, 2015-09-21 15:08:22, 2015-09-21 15:08:22, 2015-09-21:15:08:22, VALID, N, N, N, 2, >
< PUBLIC, TT_STATS, , 317, , SYNONYM, 2015-09-21 15:08:22, 2015-09-21 15:08:22, 2015-09-21:15:08:22, VALID, N, N, N, 1, >
3 rows found.

Command> set serveroutput on;

Command> call sys.TT_STATS.SHOW_SNAPSHOTS;
 8503: ORA-06550: line 1, column 6:
PLS-00201: identifier 'SYS.TT_STATS' must be declared
 8503: ORA-06550: line 1, column 1:
PL/SQL: Statement ignored
The command failed.
Command> select * from dba_tab_privs where table_name='TT_STATS';
0 rows found.


The solution

Command> grant execute on tt_stats to cacheadm;

Command> select * from dba_tab_privs where table_name='TT_STATS';
< CACHEADM, SYS, TT_STATS, CACHEADM, EXECUTE, NO, NO >
1 row found.
Command> call sys.TT_STATS.SHOW_SNAPSHOTS;
ID     TimeStamp            Level     Description
-----  -------------------  --------  -----------
0 snapshots were found in current datastore
Command>

Verified in sql developer okay too.