-- Copyright (c) 2020 Broadcom. All Rights Reserved.
-- The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
--
-- THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF
-- BROADCOM. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
-- EXPRESS WRITTEN PERMISSION OF BROADCOM.
--
-- The Licensed Software and Documentation are deemed to be commercial computer
-- software as defined in FAR 12.212 and subject to restricted rights as
-- defined in FAR Section 52.227-19 "Commercial Computer Software - Restricted
-- Rights" and DFARS 227.7202, Rights in "Commercial Computer Software or
-- Commercial Computer Software Documentation," as applicable, and any successor
-- regulations, whether delivered by Broadcom as on premises or hosted services.
-- Any use, modification, reproduction release, performance, display or
-- disclosure of the Licensed Software and Documentation by the U.S. Government
-- shall be solely in accordance with the terms of this Agreement.
--------------------------------------------------------------------------------

This file describes how to install the incident views that are used by the ICDx
Data Loss Prevention collector.

NOTE: If the sys user password contains a double quote, the SQL scripts will not
      work. You will need to change the sys user password prior to running the
      scripts. Use double quotes to enter or create passwords that contain
      special characters. You must type the quotes (").
      For example: "This is a p@assword example!"

1. Create a new Oracle user, which will be used by the ICDx Data Loss Prevention
   collector to access the incident views.

  1.1. Start the Oracle SQL*Plus CLI tool with the following command:

    >> sqlplus /nolog

  1.2. At the SQL prompt, run the create_incident_access_user.sql script:

    SQL> @create_incident_access_user.sql

    The script prompts you for the following information (the default values
    are shown in the square brackets):
      a. Enter the password for sys user:
      b. Enter sid:
      c. Enter a user name to be created[icdx_user]:
      d. Enter a password for the new user:

    The first time you run this script, you may see the following error (assuming
    you used the default user: icdx_user):

      DROP USER icdx_user
                *
      ERROR at line 1:
      ORA-01918: user 'icdx_user' does not exist

    You can ignore the error.

2. Grant SELECT access on the Enforce schema to the new database user, create
   synonyms for all tables to be used in the database views, and create the
   database views.

  2.1. Start the Oracle SQL*Plus CLI tool with the following command:

    >> sqlplus /nolog

  2.2. At the SQL prompt, run the setup.sql script:

    SQL> @setup.sql

    The script prompts you for the following information (the default values are
    shown in the square brackets):
      a. Please enter sid:
      b. Please enter username for the Enforce schema:
      c. Please enter password for the Enforce schema:
      d. Please enter username for the Incident Access schema[icdx_user]:
      e. Please enter password for the Incident Access schema:
