├── .gitignore ├── playbook.yml ├── setup-logminer-noncdb.sh ├── setup-logminer-11.sh ├── setup-logminer.sh ├── setup-xstream-noncdb.sh ├── Vagrantfile ├── setup-xstream.sh ├── REDOLOG_SETUP.md ├── README.md └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | data 3 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | become: yes 4 | become_user: root 5 | tasks: 6 | - name: upgrade all packages 7 | dnf: name="*" state=latest 8 | - name: Have git, wget, ag etc. 9 | dnf: name={{item}} state=latest 10 | with_items: 11 | - git 12 | - wget 13 | - the_silver_searcher 14 | - dnf-plugins-core 15 | - name: Have docker repo 16 | shell: 'dnf config-manager \ 17 | --add-repo \ 18 | https://download.docker.com/linux/fedora/docker-ce.repo' 19 | - name: Have dnf cache updated 20 | shell: 'dnf makecache' 21 | - name: Have docker-ce 22 | dnf: name=docker-ce 23 | - name: add docker group 24 | group: name=docker state=present 25 | - name: add user to docker group 26 | user: name=vagrant groups=docker state=present 27 | - name: Ensure Docker is started 28 | systemd: 29 | state: started 30 | name: docker 31 | -------------------------------------------------------------------------------- /setup-logminer-noncdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Set archive log mode and enable GG replication 4 | ORACLE_SID=XE 5 | export ORACLE_SID 6 | sqlplus /nolog <<- EOF 7 | CONNECT sys/top_secret AS SYSDBA 8 | alter system set db_recovery_file_dest_size = 10G; 9 | alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile; 10 | shutdown immediate 11 | startup mount 12 | alter database archivelog; 13 | alter database open; 14 | -- Should show "Database log mode: Archive Mode" 15 | archive log list 16 | exit; 17 | EOF 18 | 19 | # Enable LogMiner required database features/settings 20 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 21 | ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 22 | ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED; 23 | exit; 24 | EOF 25 | 26 | # Create Log Miner Tablespace and User 27 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 28 | CREATE TABLESPACE LOGMINER_TBS DATAFILE '/opt/oracle/oradata/ORCLCDB/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 29 | exit; 30 | EOF 31 | 32 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 33 | CREATE USER dbzuser IDENTIFIED BY dbz DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS; 34 | 35 | GRANT CREATE SESSION TO dbzuser; 36 | GRANT SELECT ON V_\$DATABASE TO dbzuser; 37 | GRANT FLASHBACK ANY TABLE TO dbzuser; 38 | GRANT SELECT ANY TABLE TO dbzuser; 39 | GRANT SELECT_CATALOG_ROLE TO dbzuser; 40 | GRANT EXECUTE_CATALOG_ROLE TO dbzuser; 41 | GRANT SELECT ANY TRANSACTION TO dbzuser; 42 | GRANT SELECT ANY DICTIONARY TO dbzuser; 43 | GRANT LOGMINING TO dbzuser; 44 | 45 | GRANT CREATE TABLE TO dbzuser; 46 | GRANT LOCK ANY TABLE TO dbzuser; 47 | GRANT CREATE SEQUENCE TO dbzuser; 48 | 49 | GRANT EXECUTE ON DBMS_LOGMNR TO dbzuser; 50 | GRANT EXECUTE ON DBMS_LOGMNR_D TO dbzuser; 51 | GRANT SELECT ON V_\$LOGMNR_LOGS to dbzuser; 52 | GRANT SELECT ON V_\$LOGMNR_CONTENTS TO dbzuser; 53 | GRANT SELECT ON V_\$LOGFILE TO dbzuser; 54 | GRANT SELECT ON V_\$ARCHIVED_LOG TO dbzuser; 55 | GRANT SELECT ON V_\$ARCHIVE_DEST_STATUS TO dbzuser; 56 | 57 | exit; 58 | EOF 59 | 60 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 61 | CREATE USER debezium IDENTIFIED BY dbz; 62 | GRANT CONNECT TO debezium; 63 | GRANT CREATE SESSION TO debezium; 64 | GRANT CREATE TABLE TO debezium; 65 | GRANT CREATE SEQUENCE to debezium; 66 | ALTER USER debezium QUOTA 100M on users; 67 | exit; 68 | EOF 69 | -------------------------------------------------------------------------------- /setup-logminer-11.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir /u01/app/oracle/oradata/recovery_area 4 | 5 | # Set archive log mode and enable GG replication 6 | ORACLE_SID=XE 7 | export ORACLE_SID 8 | sqlplus /nolog <<- EOF 9 | CONNECT sys/top_secret AS SYSDBA 10 | alter system set db_recovery_file_dest_size = 10G; 11 | alter system set db_recovery_file_dest = '/u01/app/oracle/oradata/recovery_area' scope=spfile; 12 | shutdown immediate 13 | startup mount 14 | alter database archivelog; 15 | alter database open; 16 | -- Should show "Database log mode: Archive Mode" 17 | archive log list 18 | exit; 19 | EOF 20 | 21 | # Enable LogMiner required database features/settings 22 | sqlplus sys/top_secret@//localhost:1521/XE as sysdba <<- EOF 23 | ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 24 | ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED; 25 | exit; 26 | EOF 27 | 28 | # Create Log Miner Tablespace and User 29 | sqlplus sys/top_secret@//localhost:1521/XE as sysdba <<- EOF 30 | CREATE TABLESPACE LOGMINER_TBS DATAFILE '/u01/app/oracle/oradata/XE/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 31 | exit; 32 | EOF 33 | 34 | sqlplus sys/top_secret@//localhost:1521/XE as sysdba <<- EOF 35 | CREATE USER dbzuser IDENTIFIED BY dbz DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS; 36 | 37 | GRANT CREATE SESSION TO dbzuser; 38 | GRANT SELECT ON V_\$DATABASE TO dbzuser; 39 | GRANT FLASHBACK ANY TABLE TO dbzuser; 40 | GRANT SELECT ANY TABLE TO dbzuser; 41 | GRANT SELECT_CATALOG_ROLE TO dbzuser; 42 | GRANT EXECUTE_CATALOG_ROLE TO dbzuser; 43 | GRANT SELECT ANY TRANSACTION TO dbzuser; 44 | GRANT SELECT ANY DICTIONARY TO dbzuser; 45 | 46 | GRANT CREATE TABLE TO dbzuser; 47 | GRANT LOCK ANY TABLE TO dbzuser; 48 | GRANT CREATE SEQUENCE TO dbzuser; 49 | 50 | GRANT EXECUTE ON DBMS_LOGMNR TO dbzuser; 51 | GRANT EXECUTE ON DBMS_LOGMNR_D TO dbzuser; 52 | GRANT SELECT ON V_\$LOGMNR_LOGS to dbzuser; 53 | GRANT SELECT ON V_\$LOGMNR_CONTENTS TO dbzuser; 54 | GRANT SELECT ON V_\$LOGFILE TO dbzuser; 55 | GRANT SELECT ON V_\$ARCHIVED_LOG TO dbzuser; 56 | GRANT SELECT ON V_\$ARCHIVE_DEST_STATUS TO dbzuser; 57 | 58 | exit; 59 | EOF 60 | 61 | sqlplus sys/top_secret@//localhost:1521/XE as sysdba <<- EOF 62 | CREATE USER debezium IDENTIFIED BY dbz DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS; 63 | GRANT CONNECT TO debezium; 64 | GRANT CREATE SESSION TO debezium; 65 | GRANT CREATE TABLE TO debezium; 66 | GRANT CREATE SEQUENCE to debezium; 67 | ALTER USER debezium QUOTA 100M on users; 68 | exit; 69 | EOF 70 | -------------------------------------------------------------------------------- /setup-logminer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Set archive log mode and enable GG replication 4 | ORACLE_SID=ORCLCDB 5 | export ORACLE_SID 6 | sqlplus /nolog <<- EOF 7 | CONNECT sys/top_secret AS SYSDBA 8 | alter system set db_recovery_file_dest_size = 10G; 9 | alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile; 10 | shutdown immediate 11 | startup mount 12 | alter database archivelog; 13 | alter database open; 14 | -- Should show "Database log mode: Archive Mode" 15 | archive log list 16 | exit; 17 | EOF 18 | 19 | # Enable LogMiner required database features/settings 20 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 21 | ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 22 | ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED; 23 | exit; 24 | EOF 25 | 26 | # Create Log Miner Tablespace and User 27 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 28 | CREATE TABLESPACE LOGMINER_TBS DATAFILE '/opt/oracle/oradata/ORCLCDB/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 29 | exit; 30 | EOF 31 | 32 | sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF 33 | CREATE TABLESPACE LOGMINER_TBS DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 34 | exit; 35 | EOF 36 | 37 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 38 | CREATE USER c##dbzuser IDENTIFIED BY dbz DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS CONTAINER=ALL; 39 | 40 | GRANT CREATE SESSION TO c##dbzuser CONTAINER=ALL; 41 | GRANT SET CONTAINER TO c##dbzuser CONTAINER=ALL; 42 | GRANT SELECT ON V_\$DATABASE TO c##dbzuser CONTAINER=ALL; 43 | GRANT FLASHBACK ANY TABLE TO c##dbzuser CONTAINER=ALL; 44 | GRANT SELECT ANY TABLE TO c##dbzuser CONTAINER=ALL; 45 | GRANT SELECT_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; 46 | GRANT EXECUTE_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; 47 | GRANT SELECT ANY TRANSACTION TO c##dbzuser CONTAINER=ALL; 48 | GRANT SELECT ANY DICTIONARY TO c##dbzuser CONTAINER=ALL; 49 | GRANT LOGMINING TO c##dbzuser CONTAINER=ALL; 50 | 51 | GRANT CREATE TABLE TO c##dbzuser CONTAINER=ALL; 52 | GRANT LOCK ANY TABLE TO c##dbzuser CONTAINER=ALL; 53 | GRANT CREATE SEQUENCE TO c##dbzuser CONTAINER=ALL; 54 | 55 | GRANT EXECUTE ON DBMS_LOGMNR TO c##dbzuser CONTAINER=ALL; 56 | GRANT EXECUTE ON DBMS_LOGMNR_D TO c##dbzuser CONTAINER=ALL; 57 | GRANT SELECT ON V_\$LOGMNR_LOGS TO c##dbzuser CONTAINER=ALL; 58 | GRANT SELECT ON V_\$LOGMNR_CONTENTS TO c##dbzuser CONTAINER=ALL; 59 | GRANT SELECT ON V_\$LOGFILE TO c##dbzuser CONTAINER=ALL; 60 | GRANT SELECT ON V_\$ARCHIVED_LOG TO c##dbzuser CONTAINER=ALL; 61 | GRANT SELECT ON V_\$ARCHIVE_DEST_STATUS TO c##dbzuser CONTAINER=ALL; 62 | 63 | exit; 64 | EOF 65 | 66 | sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF 67 | CREATE USER debezium IDENTIFIED BY dbz; 68 | GRANT CONNECT TO debezium; 69 | GRANT CREATE SESSION TO debezium; 70 | GRANT CREATE TABLE TO debezium; 71 | GRANT CREATE SEQUENCE to debezium; 72 | ALTER USER debezium QUOTA 100M on users; 73 | exit; 74 | EOF -------------------------------------------------------------------------------- /setup-xstream-noncdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Set archive log mode and enable GG replication 4 | ORACLE_SID=ORCLCDB 5 | export ORACLE_SID 6 | sqlplus /nolog <<- EOF 7 | CONNECT sys/top_secret AS SYSDBA 8 | alter system set db_recovery_file_dest_size = 5G; 9 | alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile; 10 | alter system set enable_goldengate_replication=true; 11 | shutdown immediate 12 | startup mount 13 | alter database archivelog; 14 | alter database open; 15 | -- Should show "Database log mode: Archive Mode" 16 | archive log list 17 | exit; 18 | EOF 19 | 20 | # Create XStream admin user 21 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 22 | CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_adm_tbs.dbf' 23 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 24 | exit; 25 | EOF 26 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 27 | CREATE USER dbzadmin IDENTIFIED BY xsa 28 | DEFAULT TABLESPACE xstream_adm_tbs 29 | QUOTA UNLIMITED ON xstream_adm_tbs; 30 | 31 | GRANT CREATE SESSION TO dbzadmin; 32 | 33 | BEGIN 34 | DBMS_XSTREAM_AUTH.GRANT_ADMIN_PRIVILEGE( 35 | grantee => 'dbzadmin', 36 | privilege_type => 'CAPTURE', 37 | grant_select_privileges => TRUE 38 | ); 39 | END; 40 | / 41 | 42 | exit; 43 | EOF 44 | 45 | # Create test user 46 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 47 | CREATE USER debezium IDENTIFIED BY dbz; 48 | GRANT CONNECT TO debezium; 49 | GRANT CREATE SESSION TO debezium; 50 | GRANT CREATE TABLE TO debezium; 51 | GRANT CREATE SEQUENCE TO debezium; 52 | ALTER USER debezium QUOTA 100M ON users; 53 | 54 | exit; 55 | EOF 56 | 57 | # Create XStream user 58 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 59 | CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_tbs.dbf' 60 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 61 | exit; 62 | EOF 63 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 64 | CREATE USER dbzuser IDENTIFIED BY dbz 65 | DEFAULT TABLESPACE xstream_tbs 66 | QUOTA UNLIMITED ON xstream_tbs; 67 | 68 | GRANT CREATE SESSION TO dbzuser; 69 | GRANT SELECT ON V_\$DATABASE to dbzuser; 70 | GRANT FLASHBACK ANY TABLE TO dbzuser; 71 | GRANT SELECT_CATALOG_ROLE TO dbzuser; 72 | GRANT EXECUTE_CATALOG_ROLE TO dbzuser; 73 | exit; 74 | EOF 75 | 76 | # Create XStream Outbound server 77 | sqlplus dbzadmin/xsa@//localhost:1521/ORCLCDB <<- EOF 78 | DECLARE 79 | tables DBMS_UTILITY.UNCL_ARRAY; 80 | schemas DBMS_UTILITY.UNCL_ARRAY; 81 | BEGIN 82 | tables(1) := NULL; 83 | schemas(1) := 'debezium'; 84 | DBMS_XSTREAM_ADM.CREATE_OUTBOUND( 85 | server_name => 'dbzxout', 86 | table_names => tables, 87 | schema_names => schemas); 88 | END; 89 | / 90 | 91 | exit; 92 | EOF 93 | 94 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 95 | BEGIN 96 | DBMS_XSTREAM_ADM.ALTER_OUTBOUND( 97 | server_name => 'dbzxout', 98 | connect_user => 'dbzuser'); 99 | END; 100 | / 101 | 102 | exit; 103 | EOF 104 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure("2") do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://atlas.hashicorp.com/search. 15 | config.vm.box = "fedora/33-cloud-base" 16 | 17 | # Disable automatic box update checking. If you disable this, then 18 | # boxes will only be checked for updates when the user runs 19 | # `vagrant box outdated`. This is not recommended. 20 | # config.vm.box_check_update = false 21 | 22 | # Create a forwarded port mapping which allows access to a specific port 23 | # within the machine from a port on the host machine. In the example below, 24 | # accessing "localhost:8080" will access port 80 on the guest machine. 25 | config.vm.network "forwarded_port", guest: 1521, host: 1521 26 | 27 | # Create a private network, which allows host-only access to the machine 28 | # using a specific IP. 29 | # config.vm.network "private_network", ip: "192.168.33.10" 30 | 31 | # Create a public network, which generally matched to bridged network. 32 | # Bridged networks make the machine appear as another physical device on 33 | # your network. 34 | # config.vm.network "public_network" 35 | 36 | # Share an additional folder to the guest VM. The first argument is 37 | # the path on the host to the actual folder. The second argument is 38 | # the path on the guest to mount the folder. And the optional third 39 | # argument is a set of non-required options. 40 | config.vm.synced_folder "data", "/vagrant_data" 41 | 42 | # Provider-specific configuration so you can fine-tune various 43 | # backing providers for Vagrant. These expose provider-specific options. 44 | # Example for VirtualBox: 45 | # 46 | config.vm.provider "virtualbox" do |vb| 47 | # # Display the VirtualBox GUI when booting the machine 48 | # vb.gui = true 49 | # 50 | # Customize the amount of memory on the VM: 51 | vb.memory = "4096" 52 | vb.name = "oracle-box" 53 | end 54 | # 55 | # View the documentation for the provider you are using for more 56 | # information on available options. 57 | 58 | # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies 59 | # such as FTP and Heroku are also available. See the documentation at 60 | # https://docs.vagrantup.com/v2/push/atlas.html for more information. 61 | # config.push.define "atlas" do |push| 62 | # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" 63 | # end 64 | 65 | # Enable provisioning with a shell script. Additional provisioners such as 66 | # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 67 | # documentation for more information about their specific syntax and use. 68 | # config.vm.provision "shell", inline: <<-SHELL 69 | # apt-get update 70 | # apt-get install -y apache2 71 | # SHELL 72 | 73 | # Run Ansible from the Vagrant VM 74 | config.vm.provision "ansible_local" do |ansible| 75 | ansible.playbook = "playbook.yml" 76 | end 77 | end 78 | -------------------------------------------------------------------------------- /setup-xstream.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Set archive log mode and enable GG replication 4 | ORACLE_SID=ORCLCDB 5 | export ORACLE_SID 6 | sqlplus /nolog <<- EOF 7 | CONNECT sys/top_secret AS SYSDBA 8 | alter system set db_recovery_file_dest_size = 5G; 9 | alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile; 10 | alter system set enable_goldengate_replication=true; 11 | shutdown immediate 12 | startup mount 13 | alter database archivelog; 14 | alter database open; 15 | -- Should show "Database log mode: Archive Mode" 16 | archive log list 17 | exit; 18 | EOF 19 | 20 | # Create XStream admin user 21 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 22 | CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_adm_tbs.dbf' 23 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 24 | exit; 25 | EOF 26 | sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF 27 | CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_adm_tbs.dbf' 28 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 29 | exit; 30 | EOF 31 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 32 | CREATE USER c##dbzadmin IDENTIFIED BY xsa 33 | DEFAULT TABLESPACE xstream_adm_tbs 34 | QUOTA UNLIMITED ON xstream_adm_tbs 35 | CONTAINER=ALL; 36 | 37 | GRANT CREATE SESSION, SET CONTAINER TO c##dbzadmin CONTAINER=ALL; 38 | 39 | BEGIN 40 | DBMS_XSTREAM_AUTH.GRANT_ADMIN_PRIVILEGE( 41 | grantee => 'c##dbzadmin', 42 | privilege_type => 'CAPTURE', 43 | grant_select_privileges => TRUE, 44 | container => 'ALL' 45 | ); 46 | END; 47 | / 48 | 49 | exit; 50 | EOF 51 | 52 | # Create test user 53 | sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF 54 | CREATE USER debezium IDENTIFIED BY dbz; 55 | GRANT CONNECT TO debezium; 56 | GRANT CREATE SESSION TO debezium; 57 | GRANT CREATE TABLE TO debezium; 58 | GRANT CREATE SEQUENCE TO debezium; 59 | ALTER USER debezium QUOTA 100M ON users; 60 | 61 | exit; 62 | EOF 63 | 64 | # Create XStream user 65 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 66 | CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_tbs.dbf' 67 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 68 | exit; 69 | EOF 70 | sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF 71 | CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_tbs.dbf' 72 | SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED; 73 | exit; 74 | EOF 75 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 76 | CREATE USER c##dbzuser IDENTIFIED BY dbz 77 | DEFAULT TABLESPACE xstream_tbs 78 | QUOTA UNLIMITED ON xstream_tbs 79 | CONTAINER=ALL; 80 | 81 | GRANT CREATE SESSION TO c##dbzuser CONTAINER=ALL; 82 | GRANT SET CONTAINER TO c##dbzuser CONTAINER=ALL; 83 | GRANT SELECT ON V_\$DATABASE to c##dbzuser CONTAINER=ALL; 84 | GRANT FLASHBACK ANY TABLE TO c##dbzuser CONTAINER=ALL; 85 | GRANT SELECT_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; 86 | GRANT EXECUTE_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; 87 | exit; 88 | EOF 89 | 90 | # Create XStream Outbound server 91 | sqlplus c##dbzadmin/xsa@//localhost:1521/ORCLCDB <<- EOF 92 | DECLARE 93 | tables DBMS_UTILITY.UNCL_ARRAY; 94 | schemas DBMS_UTILITY.UNCL_ARRAY; 95 | BEGIN 96 | tables(1) := NULL; 97 | schemas(1) := 'debezium'; 98 | DBMS_XSTREAM_ADM.CREATE_OUTBOUND( 99 | server_name => 'dbzxout', 100 | table_names => tables, 101 | schema_names => schemas); 102 | END; 103 | / 104 | 105 | exit; 106 | EOF 107 | 108 | sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF 109 | BEGIN 110 | DBMS_XSTREAM_ADM.ALTER_OUTBOUND( 111 | server_name => 'dbzxout', 112 | connect_user => 'c##dbzuser'); 113 | END; 114 | / 115 | 116 | exit; 117 | EOF 118 | -------------------------------------------------------------------------------- /REDOLOG_SETUP.md: -------------------------------------------------------------------------------- 1 | # Setting up Oracle Redo Logs 2 | 3 | Oracle relies on Redo Logs to log all transactions performed against the database. 4 | The primary purpose of these logs is to allow Oracle to recover changes made to the database in case of a failure. 5 | The number of logs and their respective sizes depend greatly on frequency of changes and usage. 6 | The steps taken in this document are to support the Debezium test suite requirements and are simply meant as a guide. 7 | 8 | 9 | ## Current State 10 | 11 | Before making any changes, it's important to examine the current state of the database. 12 | The following 2 SQL statements provide us precisely that: 13 | 14 | ``` 15 | SQL> select group#, bytes/1024/1024, status from v$log order by 1; 16 | 17 | GROUP# BYTES/1024/1024 STATUS 18 | ---------- --------------- ---------------- 19 | 1 200 INACTIVE 20 | 2 200 CURRENT 21 | 3 200 UNUSED 22 | 23 | SQL> select group#, member from v$logfile order by 1, 2; 24 | 25 | GROUP# MEMBER 26 | ------ ------------------------------------------------------------ 27 | 1 /opt/oracle/oradata/ORCLCDB/redo01.log 28 | 2 /opt/oracle/oradata/ORCLCDB/redo02.log 29 | 3 /opt/oracle/oradata/ORCLCDB/redo03.log 30 | ``` 31 | 32 | The output above shows that there are `3` log groups, each group is configured with a size of `200MB`, each group has exactly 1 file assigned, and that currently only group `2` is being used. 33 | The status column can have `INACTIVE`, `UNUSED`, `CURRENT`, or `ACTIVE` values. 34 | The `CURRENT` status implies that is the log group currently being actively used by the database. 35 | The `ACTIVE` status implies that the log group is currently required for failure recovery, i.e. it's needed for reading purposes, but the database isn't currently writing to it. 36 | 37 | For Oracle EE installations, this is precisely what you should typically expect to see. 38 | This configuration is adequate to run the Debezium test suite. 39 | 40 | For Oracle XE installations, you will likely find that the logs are configured with a smaller size, typically `50MB`. 41 | This size is too small for Debezium's test suite, particularly when using the default connector configurations, 42 | because the connector is going to write the data dictionary to the redo logs. The data dictionary can consume quite 43 | a bit of space in the logs and therefore they need to be tuned appropriately to support this operation but also to 44 | provide a buffer for log switches. 45 | 46 | In the future, we plan to see if there are ways we can support smaller log file sizes, 47 | but typically in any type of production deployment, 48 | the logs are configured with sizes that are drastically larger than `200MB`; often in the gigabyte territory. 49 | 50 | ## Changing Redo Logs 51 | 52 | The easiest way to change the redo log configuration is to _clear_, _drop_, and _re-add_ the group. 53 | Please note, a group cannot be adjusted while it's currently in `ACTIVE` or `CURRENT` status. 54 | The following steps assume the status values shown above, so adjust these accordingly. 55 | 56 | ### Group 1 57 | 58 | Since logfile group 1 above is `INACTIVE`, we can proceed with changing its configuration. 59 | Be mindful of the path used in the `add logfile` clause, this should be identical to the path used in [Current State](#current) section. 60 | 61 | ``` 62 | alter database clear logfile group 1; 63 | alter database drop logfile group 1; 64 | alter database add logfile group 1 ('/opt/oracle/oradata/ORCLCDB/redo01.log') size 200M reuse; 65 | ``` 66 | 67 | ### Group 3 68 | 69 | Since logfile group 3 above is 'UNUSED', we can proceed with changing its configuration. 70 | Be mindful of the path used in the `add logfile` clause, this should be identical to the path used in the [Current State](#current) section. 71 | 72 | ``` 73 | alter database clear logfile group 3; 74 | alter database drop logfile group 3; 75 | alter database add logfile group 3 ('/opt/oracle/oradata/ORCLCDB/redo03.log') size 200M reuse; 76 | ``` 77 | 78 | ### Group 2 79 | 80 | Since logfile group 2 above is `CURRENT`, we cannot proceed with changing its configuration. 81 | In order to be able to change it, we need to first ask Oracle to switch log files: 82 | 83 | ``` 84 | alter system switch logfile; 85 | ``` 86 | 87 | It will take the database a few minutes for group 2 to shift to `INACTIVE`. 88 | You can check the status of the redo logs by running the very first SQL statement in the [Current State](#current) section. 89 | Once the log group has shifted to `INACTIVE`, it's safe to proceed with changing its configuration. 90 | Again, be mindful of the path used in the `add logfile` clause, this should be identical to the path used in the [Current State](#current) section. 91 | 92 | ``` 93 | alter database clear logfile group 2; 94 | alter database drop logfile group 2; 95 | alter database add logfile group 2 ('/opt/oracle/oradata/ORCLCDB/redo02.log') size 200M reuse; 96 | ``` 97 | 98 | ## Adding additional groups 99 | 100 | You may find that you need to add additional redo log groups if you intend to reuse the same container for performance benchmarks or multiple test suite executions. 101 | Adding additional redo logs simply allows Oracle to be more proficient in doing less swapping redo logs to archive logs and keeping the redo logs online longer. 102 | In order to add additional redo groups, simply execute the following: 103 | 104 | ``` 105 | alter database add logfile group ('` should be changed to the next logical group number based on your setup. 109 | If you have 3 redo log groups, you would first add group `4` and so forth. 110 | The `` should be assigned a path like that is used in the prior sections, adhering to the path used by other redo log files. 111 | 112 | ## Multiplexing logs 113 | 114 | While it's unnecessary for our purposes of testing, Oracle does provide support for redo log multiplexing. 115 | This allows the database to store identical copies of a redo log, often in separate locations to guard against recovery failure. 116 | Even if the copies are on the same disk, multiple copies can guard against I/O failures, file corruption, and so on. 117 | 118 | To use redo log multiplexing support, the `add logfile` SQL command should specify more than one logfile. 119 | As an example, the following shows how we could change redo log group 1 to support multiple / multiplexed log files: 120 | 121 | ``` 122 | alter database add logfile group 1 ('/opt/oracle/oradata/ORCLCDB/redo01a.log', '/opt/oracle/oradata/ORCLCDB/redo01b.log') size 200M reuse; 123 | ``` 124 | 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Debezium Vagrant Box for Oracle DB 2 | 3 | This is a Vagrant configuration for setting up a virtual machine based on Fedora 30, containing 4 | an Oracle DB instance for testing. 5 | Note that you'll need to download the Oracle installation yourself in order for preparing the testing environment. 6 | 7 | [Ansible](http://docs.ansible.com/ansible/latest/index.html) is used for provisioning the VM, see _playbook.yml_ for the complete set-up. 8 | 9 | 10 | ## Oracle Compatibility 11 | 12 | * Oracle 11 XE 13 | * Oracle XStream is not supported 14 | * Can only be used with Debezium Oracle connector using LogMiner adapter. 15 | 16 | 17 | * Oracle 18 XE 18 | * Debezium Oracle connector not compatible regardless of adapter. 19 | * Flashback queries not supported (required for snapshotting data) 20 | * Supplemental logging not supported (required for streaming changes) 21 | 22 | ## Preparations 23 | 24 | Make sure to have the following installed: 25 | 26 | * [VirtualBox](https://www.virtualbox.org/) 27 | * [Vagrant](https://www.vagrantup.com/) 28 | 29 | ## Installation 30 | 31 | Clone this repository: 32 | 33 | ``` 34 | git clone https://github.com/debezium/oracle-vagrant-box.git 35 | cd oracle-vagrant-box 36 | mkdir -p data 37 | cp setup-*.sh data/ 38 | ``` 39 | 40 | Download the Oracle [installation file](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html) and provide it within the previously created _data_ directory. 41 | 42 | ## Starting the VM 43 | 44 | Change into the project directory, and bootstrap the VM: 45 | 46 | ``` 47 | vagrant up 48 | ``` 49 | 50 | _If you get the error `Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available.` then run :_ 51 | 52 | ``` 53 | vagrant plugin install vagrant-vbguest 54 | vagrant reload 55 | vagrant provision 56 | ``` 57 | 58 | Once the VM has completed the boot sequence and has been provisioned, SSH into the VM: 59 | 60 | ``` 61 | vagrant ssh 62 | ``` 63 | 64 | 65 | ## Setting up Oracle DB 66 | 67 | 68 | ### Setup environment 69 | 70 | #### Get the Oracle docker-images repository 71 | 72 | The Oracle `docker-images` repository must be cloned from GitHub. 73 | While this repository contains various Docker configurations for many Oracle products, 74 | we're only interested in those for the `OracleDatabase`. 75 | 76 | ``` 77 | git clone https://github.com/oracle/docker-images.git 78 | ``` 79 | 80 | Navigate to the Oracle database single instance directory, shown below: 81 | 82 | ``` 83 | cd docker-images/OracleDatabase/SingleInstance/dockerfiles 84 | ``` 85 | 86 | #### Permissions 87 | 88 | For all Oracle installations _except Oracle 11_, the image specifies a volume in which all Oracle database files are kept on the host machine. 89 | This location needs to be created if it doesn't exist and provided the necessary permissions: 90 | 91 | ``` 92 | sudo mkdir -p /home/vagrant/oradata/recovery_area 93 | sudo chgrp 54321 /home/vagrant/oradata 94 | sudo chown 54321 /home/vagrant/oradata 95 | sudo chgrp 54321 /home/vagrant/oradata/recovery_area 96 | sudo chown 54321 /home/vagrant/oradata/recovery_area 97 | ``` 98 | 99 | 100 | #### CDB or non-CDB 101 | 102 | Beginning with Oracle 12, the database is installed using CDB-mode by default, enabling multi-tenancy support. 103 | If you wish to test using CDB mode, please skip this section. 104 | If you wish to test using non-CDB mode, only Oracle 12/19 (EE versions) provide a way to toggle non-CDB. 105 | 106 | Open the Database Configuration Assistant (DBCA) configuration template file, as shown below. 107 | This file controls precisely how Oracle will be installed. 108 | 109 | ``` 110 | vi /dbca.rsp.tmpl 111 | ``` 112 | 113 | Locate the following two configuration options in the file, change their values respectively and save: 114 | 115 | ``` 116 | createAsContainerDatabase=false 117 | numberOfPDBs=0 118 | ``` 119 | 120 | Now when the database performs its installation procedures in the [Running the Container](#running-the-container) section, 121 | the database will be installed using non-CDB mode without pluggable databases. 122 | 123 | ### Build the image 124 | 125 | Before the Oracle database image can be built, the installation files that were downloaded from Oracle OTN must be staged. 126 | The following shows how to stage Oracle 11, 12, 18, and 19 as well as how to initiate the image build. 127 | If the file downloaded from Oracle OTN is named differently than indicated here, 128 | the file must be renamed respectively; otherwise Docker will fail to locate the installation files. 129 | 130 | #### Oracle 11 XE 131 | ``` 132 | cp /vagrant_data/oracle-xe-11.2.0-1.0.x86_64.rpm.zip 11.2.0.2 133 | ./buildContainerImage.sh -v 11.2.0.2 -i -x 134 | ``` 135 | 136 | #### Oracle 12 EE 137 | ``` 138 | cp /vagrant_data/linuxx64_12201_database.zip 12.2.0.1 139 | ./buildContainerImage.sh -v 12.2.0.1 -i -e 140 | ``` 141 | 142 | #### Oracle 19 EE 143 | ``` 144 | cp /vagrant_data/LINUX.X64_193000_db_home.zip 19.3.0 145 | ./buildContainerImage.sh -v 19.3.0 -i -e 146 | ``` 147 | 148 | 149 | ### Running the container 150 | 151 | Depending on the Oracle version being used, certain docker switches may/may not be needed. 152 | The following shows how to start each of the Oracle database versions using `docker run`. 153 | Please wait until you see a message that the `DATABASE IS READY` in the logs. 154 | 155 | NOTE: If you have changed the DBCA configuration script to install the database in non-CDB mode, 156 | you may see a message that the database failed to start. 157 | This is normal as the failure is due to a bug in the Oracle start-up scripts that perform a PDB operation in non-CDB mode. 158 | 159 | #### Oracle 11 160 | ``` 161 | docker run --name dbz_oracle --shm-size=1g -p 1521:1521 -e ORACLE_PWD=top_secret oracle/database:11.2.0.2-xe 162 | ``` 163 | 164 | #### Oracle 12 165 | ``` 166 | docker run --name dbz_oracle -p 1521:1521 -e ORACLE_PWD=top_secret -v /home/vagrant/oradata/:/opt/oracle/oradata oracle/database:12.2.0.1-ee 167 | ``` 168 | 169 | #### Oracle 19 170 | ``` 171 | docker run --name dbz_oracle -p 1521:1521 -e ORACLE_PWD=top_secret -v /home/vagrant/oradata/:/opt/oracle/oradata oracle/database:19.3.0-ee 172 | ``` 173 | 174 | ### Database configuration 175 | 176 | As mentioned in the [Setup environment for image](#setup-environment-for-image), Oracle defaults to multi-tenancy installations since Oracle 12. 177 | For Oracle EE installations, the container will be named `ORCLCDB` while the pluggable database is named `ORCLPDB1`. 178 | For Oracle 11, the database does not have multi-tenancy support, so the database is simply named `XE`. 179 | 180 | At this point, the database has been installed but one additional step is required, 181 | and that is to configure the database with the necessary features, users and permissions, etc that enable Debezium to capture change events. 182 | 183 | The database can be configured to use: 184 | 185 | * [XStreams](#xstreams) 186 | * [LogMiner](#logminer) 187 | 188 | 189 | #### XStreams database configuration 190 | 191 | An automated script has been provided in order to configure the database with XStreams support. 192 | If you started the Docker image without daemon mode, you may need to open a new `vagrant ssh` shell. 193 | In the vagrant box, run the following based on your Oracle version used: 194 | 195 | ##### Oracle 12 and 19 (CDB) 196 | ``` 197 | cat /vagrant_data/setup-xstream.sh | docker exec -i dbz_oracle bash 198 | ``` 199 | 200 | ##### Oracle 12 and 19 (non-CDB) 201 | ``` 202 | cat /vagrant_data/setup-xstream-noncdb.sh | docker exec -i dbz_oracle bash 203 | ``` 204 | 205 | When the script execution has completed, the database is fully configured and ready to send change events to Debezium. 206 | 207 | 208 | #### LogMiner database configuration 209 | 210 | An automated script has been provided in order to configure the database with LogMiner support. 211 | If you started the Docker image without daemon mode, you may need to open a new `vagrant ssh` shell. 212 | In the vagrant box, run the following based on your Oracle version used: 213 | 214 | ##### Oracle 11 XE 215 | ``` 216 | cat /vagrant_data/setup-logminer-11.sh | docker exec -i --user=oracle dbz_oracle bash 217 | ``` 218 | 219 | ##### Oracle 12 and 19 (CDB) 220 | ``` 221 | cat /vagrant_data/setup-logminer.sh | docker exec -i dbz_oracle bash 222 | ``` 223 | 224 | ##### Oracle 12 and 19 (non-CDB) 225 | ``` 226 | cat /vagrant_data/setup-logminer-noncdb.sh | docker exec -i dbz_oracle bash 227 | ``` 228 | 229 | When the script execution has completed, the database is fully configured and ready to send change events to Debezium. 230 | 231 | ## FAQ 232 | 233 | ### Why is there no Oracle 11 XE for XStreams or no reference to Oracle 18 XE? 234 | 235 | See the [Compatibility](#compatibility) section for details. 236 | 237 | ### Why is Oracle performing log switches too frequently? 238 | 239 | This is often due to the fact that the redo logs are configured with sizes too small, or the number of groups is too few. 240 | In Oracle XE installations, this will happen because the default configuration uses redo logs with a size of `50MB`. 241 | Please see REDOLOG_SETUP.md for instructions on how to adjust the redo log setup. 242 | 243 | ### After restarting `dbz_oracle` with XStreams, container reports insufficient privileges. 244 | 245 | This happens because the Oracle Copy Process (CP) for XStreams fails to start when the container has been restarted. 246 | The easiest solution to resolve this problem is to remove the Outbound Server and recreate it. 247 | 248 | The following assumes an Oracle database named `ORCLCDB`. 249 | Please adjust the `ORACLE_SID` value based on your environment's setup and configuration. 250 | 251 | To drop the outbound server: 252 | 253 | ``` 254 | vagrant ssh 255 | docker exec -it -e ORACLE_SID=ORCLCDB dbz_oracle bash 256 | sqlplus /nolog <<- EOF 257 | connect sys/top_secret; 258 | exec dbms_xstream_adm.drop_outbound('dbzxout'); 259 | ``` 260 | 261 | To re-create the outbound server, open the setup script for your Oracle environment and scroll to the bottom. 262 | There are 2 `sqlplus` commands listed where the first creates the outbound while the second alters it. 263 | Simply cut-n-paste those two commands into the terminal of `dbz_oracle` to execute them. 264 | 265 | Now XStreams should work as it did previously prior to the container shutdown. 266 | 267 | ## License 268 | 269 | This project is licensed under the Apache License version 2.0. 270 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. --------------------------------------------------------------------------------