Dropping a Cache Group

Use the DROP CACHE GROUP statement to drop a cache group and its cache tables.

Oracle Database objects used to manage the caching of Oracle Database data are automatically dropped when you use the DROP CACHE GROUP statement to drop a cache group.

If you issue a DROP CACHE GROUP statement on a cache group that has an autorefresh operation in progress:

  • The autorefresh operation stops if the LockWait connection attribute setting is greater than 0. The DROP CACHE GROUP statement preempts the autorefresh operation.

  • The autorefresh operation continues if the LockWait connection attribute setting is 0. The DROP CACHE GROUP statement is blocked until the autorefresh operation completes or the statement fails with a lock timeout error.

If you have created an AWT cache group, a replication scheme is created to enable committed changes on its cache tables to be asynchronously propagated to the cached Oracle tables. This replication scheme is automatically dropped when you drop the AWT cache group. Thus, perform the following before dropping an AWT cache group:

  1. Use the ttRepSubscriberWait built-in procedure to make sure that all committed changes on its cache tables have been propagated to the cached Oracle Database tables before dropping the AWT cache group.

    % ttIsql "DSN=cache1;UID=cacheadmin;PwdWallet=/wallets/cacheadminwallet"
    Command> CALL ttRepSubscriberWait('_AWTREPSCHEME','TTREP','_ORACLE','sys1',-1);
  2. The cache tables in an AWT cache group are replicated in an active standby pair. If the cache tables are the only tables that are being replicated, drop the active standby pair using a DROP ACTIVE STANDBY PAIR statement before dropping the AWT cache groups.

    Run the following statement as the TimesTen cache administration user on the cacheactive, cachestandby and rosubscriber databases to drop the active standby pair replication scheme:

    Command> DROP ACTIVE STANDBY PAIR;
    Command> exit

Perform the following when dropping a cache group:

  1. Run an ALTER CACHE GROUP statement to set the autorefresh state to OFF for cache groups with autorefresh.
  2. Before you can drop a cache group, you must grant the DROP ANY TABLE privilege to the TimesTen cache administration user. Run the following statement as the instance administrator on the cache1, cache2, cacheactive and cachestandby databases to grant the DROP ANY TABLE privilege to the TimesTen cache administration user. The following example shows the SQL statement issued from the cache1 database:
    % ttIsql cache1
    Command> GRANT DROP ANY TABLE TO cacheadmin;
    Command> exit
  3. Use a DROP CACHE GROUP statement to drop the cache groups from the standalone TimesTen databases and, if using an AWT cache group, the active and standby databases.

    Run the following statement as the TimesTen cache administration user on the cache1, cache2, cacheactive and cachestandby databases to drop the subscriber_accounts cache group. The following example shows the SQL statement issued from the cache1 database:

    % ttIsql "DSN=cache1;UID=cacheadmin;PwdWallet=/wallets/cacheadminwallet"
    Command> DROP CACHE GROUP subscriber_accounts;

    The DROP CACHE GROUP statement updates the metadata on the Oracle database. The objects are dropped if no other TimseTen databases are caching the same tables.