forked from confluentinc/demo-scene
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
481 additions
and
0 deletions.
There are no files selected for viewing
145 changes: 145 additions & 0 deletions
145
oracle-and-kafka/data/ora-setup-scripts/01_xstreams-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
#!/bin/sh | ||
|
||
echo 'Configuring Oracle for XStreams' | ||
|
||
# Set archive log mode and enable GG replication | ||
ORACLE_SID=ORCLCDB | ||
export ORACLE_SID | ||
sqlplus /nolog <<- EOF | ||
CONNECT sys/Admin123 AS SYSDBA | ||
alter system set db_recovery_file_dest_size = 5G; | ||
alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile; | ||
alter system set enable_goldengate_replication=true; | ||
shutdown immediate | ||
startup mount | ||
alter database archivelog; | ||
alter database open; | ||
-- Should show "Database log mode: Archive Mode" | ||
archive log list | ||
exit; | ||
EOF | ||
|
||
# Create XStream admin user | ||
sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_adm_tbs.dbf' | ||
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; | ||
exit; | ||
EOF | ||
sqlplus sys/Admin123@//localhost:1521/ORCLPDB1 as sysdba <<- EOF | ||
CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_adm_tbs.dbf' | ||
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; | ||
exit; | ||
EOF | ||
sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
CREATE USER c##xstrmadmin IDENTIFIED BY xsa | ||
DEFAULT TABLESPACE xstream_adm_tbs | ||
QUOTA UNLIMITED ON xstream_adm_tbs | ||
CONTAINER=ALL; | ||
GRANT DBA TO c##xstrmadmin CONTAINER=ALL; | ||
-- GRANT CREATE SESSION, SET CONTAINER TO c##xstrmadmin CONTAINER=ALL; | ||
BEGIN | ||
DBMS_XSTREAM_AUTH.GRANT_ADMIN_PRIVILEGE( | ||
grantee => 'c##xstrmadmin', | ||
privilege_type => 'CAPTURE', | ||
grant_select_privileges => TRUE, | ||
container => 'ALL' | ||
); | ||
END; | ||
/ | ||
exit; | ||
EOF | ||
|
||
# Create test user | ||
sqlplus sys/Admin123@//localhost:1521/ORCLPDB1 as sysdba <<- EOF | ||
CREATE USER debezium IDENTIFIED BY dbz; | ||
GRANT CONNECT TO debezium; | ||
GRANT CREATE SESSION TO debezium; | ||
GRANT CREATE TABLE TO debezium; | ||
GRANT CREATE SEQUENCE TO debezium; | ||
GRANT CREATE TRIGGER TO debezium; | ||
ALTER USER debezium QUOTA 100M ON users; | ||
exit; | ||
EOF | ||
|
||
sqlplus sys/Admin123@//localhost:1521/ORCLPDB1 as sysdba <<- EOF | ||
CREATE USER rmoff IDENTIFIED BY asgard; | ||
GRANT CONNECT TO rmoff; | ||
GRANT CREATE SESSION TO rmoff; | ||
GRANT CREATE TABLE TO rmoff; | ||
GRANT CREATE SEQUENCE TO rmoff; | ||
GRANT CREATE TRIGGER TO rmoff; | ||
ALTER USER rmoff QUOTA 100M ON users; | ||
exit; | ||
EOF | ||
|
||
# Create XStream user | ||
sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_tbs.dbf' | ||
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; | ||
exit; | ||
EOF | ||
sqlplus sys/Admin123@//localhost:1521/ORCLPDB1 as sysdba <<- EOF | ||
CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_tbs.dbf' | ||
SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; | ||
exit; | ||
EOF | ||
sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
CREATE USER c##xstrm IDENTIFIED BY xs | ||
DEFAULT TABLESPACE xstream_tbs | ||
QUOTA UNLIMITED ON xstream_tbs | ||
CONTAINER=ALL; | ||
GRANT CREATE SESSION TO c##xstrm CONTAINER=ALL; | ||
GRANT SET CONTAINER TO c##xstrm CONTAINER=ALL; | ||
GRANT SELECT ON V_\$DATABASE to c##xstrm CONTAINER=ALL; | ||
GRANT FLASHBACK ANY TABLE TO c##xstrm CONTAINER=ALL; | ||
exit; | ||
EOF | ||
|
||
# Create XStream Outbound server | ||
|
||
sqlplus c##xstrmadmin/xsa@//localhost:1521/ORCLCDB <<- EOF | ||
BEGIN | ||
DBMS_XSTREAM_ADM.CREATE_OUTBOUND( | ||
server_name => 'dbzxout_new', | ||
schema_names => 'debezium', | ||
connect_user => 'c##xstrm'); | ||
END; | ||
/ | ||
exit; | ||
EOF | ||
|
||
# sqlplus c##xstrmadmin/xsa@//localhost:1521/ORCLCDB <<- EOF | ||
|
||
# DECLARE | ||
# tables DBMS_UTILITY.UNCL_ARRAY; | ||
# schemas DBMS_UTILITY.UNCL_ARRAY; | ||
# BEGIN | ||
# tables(1) := NULL; | ||
# schemas(1) := 'debezium'; | ||
# DBMS_XSTREAM_ADM.CREATE_OUTBOUND( | ||
# server_name => 'dbzxout', | ||
# table_names => tables, | ||
# schema_names => schemas); | ||
# END; | ||
# / | ||
|
||
# exit; | ||
# EOF | ||
|
||
# sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
# BEGIN | ||
# DBMS_XSTREAM_ADM.ALTER_OUTBOUND( | ||
# server_name => 'dbzxout', | ||
# connect_user => 'c##xstrm'); | ||
# END; | ||
# / | ||
|
||
# exit; | ||
# EOF | ||
|
47 changes: 47 additions & 0 deletions
47
oracle-and-kafka/data/ora-startup-scripts/01_create_customers.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
|
||
echo 'Creating rmoff.customers table' | ||
|
||
sqlplus rmoff/asgard@//localhost:1521/ORCLPDB1 <<- EOF | ||
drop table customers purge; | ||
create table CUSTOMERS ( | ||
id NUMBER(5,0) GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 42) NOT NULL PRIMARY KEY, | ||
first_name VARCHAR(50), | ||
last_name VARCHAR(50), | ||
email VARCHAR(50), | ||
gender VARCHAR(50), | ||
club_status VARCHAR(8), | ||
comments VARCHAR(90), | ||
create_ts timestamp DEFAULT CURRENT_TIMESTAMP , | ||
update_ts timestamp | ||
); | ||
CREATE OR REPLACE TRIGGER TRG_CUSTOMERS_UPD | ||
BEFORE INSERT OR UPDATE ON rmoff.CUSTOMERS | ||
REFERENCING NEW AS NEW_ROW | ||
FOR EACH ROW | ||
BEGIN | ||
SELECT SYSDATE | ||
INTO :NEW_ROW.UPDATE_TS | ||
FROM DUAL; | ||
END; | ||
/ | ||
EOF | ||
|
||
sqlplus sys/Admin123@//localhost:1521/ORCLPDB1 as sysdba <<- EOF | ||
ALTER TABLE rmoff.customers ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS; | ||
GRANT SELECT ON rmoff.customers to c##xstrm; | ||
-- From https://xanpires.wordpress.com/2013/06/26/how-to-check-the-supplemental-log-information-in-oracle/ | ||
COLUMN LOG_GROUP_NAME HEADING 'Log Group' FORMAT A20 | ||
COLUMN TABLE_NAME HEADING 'Table' FORMAT A20 | ||
COLUMN ALWAYS HEADING 'Type of Log Group' FORMAT A30 | ||
SELECT LOG_GROUP_NAME, TABLE_NAME, DECODE(ALWAYS, 'ALWAYS', 'Unconditional', NULL, 'Conditional') ALWAYS FROM DBA_LOG_GROUPS; | ||
exit; | ||
EOF |
31 changes: 31 additions & 0 deletions
31
oracle-and-kafka/data/ora-startup-scripts/02_populate_customers.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
echo 'Creating and populating rmoff.customers table' | ||
|
||
sqlplus rmoff/asgard@//localhost:1521/ORCLPDB1 <<- EOF | ||
insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (1, 'Rica', 'Blaisdell', '[email protected]', 'Female', 'bronze', 'Universal optimal hierarchy'); | ||
insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (2, 'Ruthie', 'Brockherst', '[email protected]', 'Female', 'platinum', 'Reverse-engineered tangible interface'); | ||
insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (3, 'Mariejeanne', 'Cocci', '[email protected]', 'Female', 'bronze', 'Multi-tiered bandwidth-monitored capability'); | ||
insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (4, 'Hashim', 'Rumke', '[email protected]', 'Male', 'platinum', 'Self-enabling 24/7 firmware'); | ||
insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (5, 'Hansiain', 'Coda', '[email protected]', 'Male', 'platinum', 'Centralized full-range approach'); | ||
exit; | ||
EOF | ||
|
||
|
||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (6, 'Robinet', 'Leheude', '[email protected]', 'Female', 'platinum', 'Virtual upward-trending definition'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (7, 'Fay', 'Huc', '[email protected]', 'Female', 'bronze', 'Operative composite capacity'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (8, 'Patti', 'Rosten', '[email protected]', 'Female', 'silver', 'Integrated bandwidth-monitored instruction set'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (9, 'Even', 'Tinham', '[email protected]', 'Male', 'silver', 'Virtual full-range info-mediaries'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (10, 'Brena', 'Tollerton', '[email protected]', 'Female', 'silver', 'Diverse tangible methodology'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (11, 'Alexandro', 'Peeke-Vout', '[email protected]', 'Male', 'gold', 'Ameliorated value-added orchestration'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (12, 'Sheryl', 'Hackwell', '[email protected]', 'Female', 'gold', 'Self-enabling global parallelism'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (13, 'Laney', 'Toopin', '[email protected]', 'Female', 'platinum', 'Phased coherent alliance'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (14, 'Isabelita', 'Talboy', '[email protected]', 'Female', 'gold', 'Cloned transitional synergy'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (15, 'Rodrique', 'Silverton', '[email protected]', 'Male', 'gold', 'Re-engineered static application'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (16, 'Clair', 'Vardy', '[email protected]', 'Male', 'bronze', 'Expanded bottom-line Graphical User Interface'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (17, 'Brianna', 'Paradise', '[email protected]', 'Female', 'bronze', 'Open-source global toolset'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (18, 'Waldon', 'Keddey', '[email protected]', 'Male', 'gold', 'Business-focused multi-state functionalities'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (19, 'Josiah', 'Brockett', '[email protected]', 'Male', 'gold', 'Realigned didactic info-mediaries'); | ||
# insert into CUSTOMERS (id, first_name, last_name, email, gender, club_status, comments) values (20, 'Anselma', 'Rook', '[email protected]', 'Female', 'gold', 'Cross-group 24/7 application'); |
12 changes: 12 additions & 0 deletions
12
oracle-and-kafka/data/ora-startup-scripts/03_restart_capture.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
# this is a hack but seems to work… | ||
|
||
echo 'Restarting Capture process' | ||
|
||
sqlplus sys/Admin123@//localhost:1521/ORCLCDB as sysdba <<- EOF | ||
call DBMS_CAPTURE_ADM.START_CAPTURE('CAP\$_DBZXOUT_NEW_16'); | ||
exit; | ||
EOF |
Oops, something went wrong.