X

TimesTen In-Memory Database
for Extreme Performance

How to use a TimesTen Active Standby Pair on Oracle Bare Metal Cloud

Doug Hood
TimesTen Cloud Product Manager

My blog about How do I create a simple TimesTen HA config in the Oracle Bare Metal Cloud, resulted in a TimesTen Active Standby Pair being created on two HighIO instances in the cloud.

This blog uses that TimesTen Active Standby Pair to do some simple SQL operations.

A TimesTen Active Standby Pair

My active standby pair used the following IP addresses:

Active Standby Pair IP Addresses

To use this TimesTen Active Standby Pair I needed to use a bash shell (from Linux, MacOS or Cygwin):

  • ssh to the 'active database' Bare Metal Compute machine as user opc
    • ssh opc@129.146.31.96
  • Become the oracle user and use a bash shell
    • sudo -n -u oracle bash
  • Run the TimesTen environment script /opt/TimesTen/ott-tt1122-env.sh
    • . /opt/TimesTen/ott-tt1122-env.sh

ssh to the active machine on the Bare Metal Cloud

In a separate terminal window, I also logged on to the TimesTen standby database:

  • ssh to the 'standby database' Bare Metal Compute machine as user opc.
    • ssh opc@129.146.22.198
  • Become the oracle user and use a bash shell
    • sudo -n -u oracle bash
  • Run the TimesTen environment script /opt/TimesTen/ott-tt1122-env.sh
    • . /opt/TimesTen/ott-tt1122-env.sh

The ttStatus command shows that the ttimdb database is loaded into memory on machine doughigh2 and that there are various replication connections:

  • ttStatus

ttStatus on the Standby database

On the active database [doughigh1] I also run the ttStatus utility to verify that the database was loaded into memory and that replication was running:

  • ttStatus

ttStatus for machine doughigh1

On the active database [doughigh1], I connected to the ttimdb TimesTen database via ttIsql and verified the replication scheme via the repschemes command:

  • ttisql ttimdb
  • repschemes

Repschemes command

In the ttimdb database that I created, the schema owner was called appuser. To connect to the database as user appuser, I needed to do the following:

  • quit the current ttisql session
    • exit or quit
  • Connect as user appuser
    • ttIsql "dsn=ttimdb;uid=appuser;pwd=appuser"
  • Use the tables command to show the tables owned by appuser
    • tables
  • Describe the customers and orders tables
    • desc customers
    • desc orders

Appuser tables

I could then start using SQL to select the current customers and add a new customer to the active DB on machine doughigh1:

  • Select * from customers;
  • Insert into customers values (123, 'Big', 'Bird', 'Seasame St');

Insert a customer in the active DB

I could also update and deletes rows in the active database:

Insert and update rows on the Active Database

Delete rows on the active database

On the standby database [doughigh2], I checked the rows in the customers database before and after rows are changed on the active database. I could not write to the standby database as it is read only.

Standby Database is read only

To be able to create and alter tables on the active database, I needed to login as the TimesTen instance administrator as the DB user appuser did not have the admin privilege. The create table and alter table commands were replicated to the standby database:

  • quit out of the ttIsql session that is connected as user appuser
    • quit
  • Connect to TimesTen as the database owner.  The current DB is called ttimdb
    • ttIsql ttimdb

Add and alter a table on the active DB

The create and alter table statements are replicated to the Standby Database. On host doughigh2:

  • tables
  • desc t;

Replicated create and alter table statements on the Standby DB

Summary

  • With an Active Standby Pair, if you have the correct privileges, you can do any DDL, DML or queries on the active database.
  • On the standby database, only read only queries are supported

Disclaimer: these are my personal thoughts and do not represent Oracle's official viewpoint in any way, shape, or form.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha