01 - Create new table and insert data

1. Create a new table in the source database. On the source server, using SQL*Plus, logon as the REPOE schema and create a new table.

sqlplus repoe/repoe@ttorcl_src
CREATE TABLE sales (
   prod_id         NUMBER PRIMARY KEY,
   cust_id         NUMBER NOT NULL,
   quantity_sold   NUMBER(10,2) NOT NULL,
   amount_sold     NUMBER(10,2) NOT NULL,
   amount_received NUMBER(10,2),
   sales_status    VARCHAR2(10) NOT NULL
);

2. Insert data into this table and commit the data.

INSERT INTO sales VALUES ( 101, 201, 233, 1299, null, 'OVERDUE');
INSERT INTO sales VALUES ( 102, 301, 30, 1099, 1099, 'PAID');
INSERT INTO sales VALUES ( 103, 401, 30, 120, 120, 'PAID');
INSERT INTO sales VALUES ( 104, 401, 40, 160, null, 'OVERDUE');
COMMIT;

3. Assuming you still have the replication running from the One-Way Logical Replication Setup excercise, the replication console will show the new table. By default, DDL and the DML will be replicated so the table will be in sync on the target database.

REPOE.SALES:                     100%  Mine:4/4             Unrecov:0/0         Applied:4/4

4. Synchronization may take a few moments, depending on your host machine. On the source server, as oracle, in the $HOME/replicate directory, execute the record_cound.bash script to check the record counts for the new SALES table.

./record_count.bash
TABLE_NAME                     TTORCL_SRC  TTORCL_TRG
------------------------------ ----------- -----------
ADDRESSES                      750816      750816
CARD_DETAILS                   750760      750760
CUSTOMERS                      500760      500760
INVENTORIES                    900131      900131
LOGON                          1196958     1196958
ORDERENTRY_METADATA            4           4
ORDERS                         716839      716839
ORDER_ITEMS                    2148955     2148955
PRODUCT_DESCRIPTIONS           1000        1000
PRODUCT_INFORMATION            1000        1000
SALES                          4           4
WAREHOUSES                     1000        1000
12 rows selected.

Sum of orders         TTORCL_SRC         TTORCL_TRG
------------- ------------------ ------------------
ORDERS         $3,586,575,013.00  $3,586,575,013.00

Check the contents of the SALES table in both the source and target databases.

SQL> select * from sales;
   PROD_ID    CUST_ID QUANTITY_SOLD AMOUNT_SOLD AMOUNT_RECEIVED SALES_STAT
---------- ---------- ------------- ----------- --------------- ----------
       101        201           233        1299                 OVERDUE
       102        301            30        1099            1099 PAID
       103        401            30         120             120 PAID
       104        401            40         160                 OVERDUE