Task 1: Create Oracle Users and Tables
Follow these steps to create users and target tables on the Oracle database to support GoldenGate replication.
- Configure the Oracle database for cache operations. You have to connect to the Oracle database as a database administrator. For details, see Configuring the Oracle Database to Cache Data.
- Create the Oracle cache administration user,
cacheadmin(who also owns the cache group), with the passwordttpwd. This user also serves as a GoldenGate admin user. Create the Oracle application schema userorattwith the same passwordttpwd. The following example creates the Oracle users using the SQL*Plus utility:SQL> create user cacheadmin identified by ttpwd; User created. SQL> create user oratt identified by ttpwd; User created.
- To grant privileges to the Oracle users:
SQL> GRANT CREATE SESSION, RESOURCE, ALTER SYSTEM to oratt; Grant succeeded. SQL> GRANT SELECT ANY TRANSACTION TO oratt; Grant succeeded. SQL> GRANT SELECT ANY DICTIONARY TO oratt; Grant succeeded. SQL> GRANT FLASHBACK ANY TABLE TO oratt; Grant succeeded. SQL> GRANT UNLIMITED TABLESPACE TO oratt; Grant succeeded. SQL> GRANT SELECT ANY TABLE TO cacheadmin; Grant succeeded. SQL> GRANT INSERT ANY TABLE TO cacheadmin; Grant succeeded. SQL> GRANT UPDATE ANY TABLE TO cacheadmin; Grant succeeded. SQL> GRANT DELETE ANY TABLE TO cacheadmin; Grant succeeded.
Now, run the
grantCacheAdminPrivileges.sqlscript to grant privileges to the cache administration usercacheadminthat are required to create Oracle database objects. See The grantCacheAdminPrivileges.sql Script. - Create tables and insert rows into them. The
orattuser owns two tables. This example shows two tablescustomerandordersthat are cached in TimesTen.SQL> CREATE TABLE customer ( custid VARCHAR2(10) NOT NULL, firstname VARCHAR2(20) NOT NULL, lastname VARCHAR2(20) NOT NULL, address VARCHAR2(128) NOT NULL, phone VARCHAR2(16) NOT NULL, PRIMARY KEY (custid) ); Table created. SQL> CREATE TABLE orders ( orderid NUMBER(10,0) NOT NULL, custid VARCHAR2(10) NOT NULL, orderdate DATE NOT NULL, priority CHAR(1), amount NUMBER(12,2) NOT NULL, PRIMARY KEY (orderid), FOREIGN KEY (custid) REFERENCES customer(custid) ); Table created. SQL> INSERT INTO customer VALUES('C000000001', 'Fred', 'Bloggs', 'Nice Villas, Pleasant Town', '+16072321234'); 1 row inserted. SQL> INSERT INTO customer VALUES('C000000002', 'Johnny', 'Lever', 'Sam Villas, Green Town', '+16072324445'); 1 row inserted. SQL> INSERT INTO orders VALUES(123456, 'C000000001', '21/10/2024', 'N', 430.46); 1 row inserted. SQL> INSERT INTO orders VALUES(789123, 'C000000002', '21/10/2025', 'N', 156.25); 1 row inserted. COMMIT;