Thursday, February 14, 2008

What is "Autorefresh Clean Up" script on Timesten?

Before I was going to the vacation. I thought I should find some stories to update my Blogs.
TimesTen released 7.0.4 version for 7 days ago. Anyway It could't support PL/SQL. I asked on the oracle forums, they told me next next... next version. wait wait... and wait!

I didn't come here to tell anyone about new feature on 7.0.4 version.

But I interested about cleaning up Autorefresh Object on Oracle, when you created cache group that timesten automatically creates a trigger and a log table for each Oracle base table specified in a READONLY cache group or a cache group with AUTOREFRESH INCREMENTAL attribute. The objects are dropped when the cache group is dropped.

If a Timesten data store becomes unavailable without dropping the cache groups, autorefresh objects continue to exist on Oracle.

TimesTen provides a script that can be used to clean up the autorefresh objects in the Oracle database. The location of the script is: install_dir/bin/autorefreshCleanUp.sql

The script removes autorefresh objects related to the data store and host that you specify when you run the script. It does not affect autorefresh objects for other data stores.
Using the autorefresh cleanup script

Use SQL*Plus to run the autorefresh cleanup script on the Oracle database. You must be connected to the Oracle database as a cache administration user to run the script. The autorefresh cleanup script requires two input parameters: the host name where TimesTen is running and the data store path name. The strings for the hostname and the data store path name must be identical to the strings stored onOracle. You can run the autorefreshChangeLogInfo.sql script, located in install_dir/bin, to determine the correct host name and data store path name. On Windows, enter the host name and data store name in lower case. Pass the host name and the data store path name to the script from the command line or from a SQL*Plus session:

• From the command line:

$ sqlplus cache_admin_uid@oracle_id @install_dir/bin/autorefreshCleanUp.sql
"host_name" "data_store_path_name"

• From a SQL*Plus session:

SQL> @install_dir/bin/autorefreshCleanUp.sql "host_name"
"data_store_path_name"
If you do not specify the parameters, the script prompts for them. “Parameter 1” is the host name; “parameter 2” is the data store path name.
The script displays the SQL that it executes on Oracle to clean up the autorefresh objects.

Example:

$ sqlplus user@DB @install_dir/bin/autorefreshCleanUp.sql
Enter value for 1: timesten01
old 6: host1 varchar(200) := '&1';
new 6: host1 varchar(200) := 'timesten01';
Enter value for 2: /oradata/TimesTen/ttmb_demo1
old 7: datastore1 varchar(257) := '&2';
new 7: datastore1 varchar(257) := '/oradata/TimesTen/ttmb_demo1';
*****************************OUTPUT**************************************
Performing cleanup for object_id: 18110 which belongs to table :TIMESTEN_TMP.TEMP_DATA5
Executing: delete from tt_03_agent_status where host = timeten01 and datastore =
/oradata/TimesTen/ttmb_demo1 and object_id = 18110
Executing: update tt_03_user_count set usercount = :usecount,usecount = 2
**************************************************************************

I think that's a great. However I have one script else to tell ... is: install_dir/bin/autorefreshChangeLogInfo.sql

This script help to get Autorefresh Log informations.
Example:
$ sqlplus user@DB @install_dir/bin/autorefreshChangeLogInfo.sql
****************************
Host name: timesten01
Timesten datastore name: /oradata/TimesTen/ttmb_demo3
Cache table name: TIMESTEN_TMP.TEMP_DATA5
Change log table name: tt_03_18110_L
Number of rows in change log table: 19459
Maximum logseq on the change log table: 87
Timesten has autorefreshed updates upto logseq: 87
Number of updates waiting to be autorefreshed: 0
Number of updates that has not been marked with a valid logseq: 0

****************************

Host name: timesten02

Timesten datastore name: /oradata/TimesTen/ttmb_demo3

Cache table name: TIMESTEN_TMP.TEMP_DATA5

Change log table name: tt_03_18110_L

Number of rows in change log table: 19459

Maximum logseq on the change log table: 87

Timesten has autorefreshed updates upto logseq: 83

Number of updates waiting to be autorefreshed: 19459

Number of updates that has not been marked with a valid logseq: 0


Wow...

No comments: