-
Notifications
You must be signed in to change notification settings - Fork 22
Execution Steps
This document will show how to execute OCI360 once for you tenancy. If you want to deploy the tool to automatically create a report every N minutes, please refer to the Installing OCI360 Tool page.
Download and unzip the oci360 master repo into your computer:
[oracle@orasrv ~]$ wget -O oci360.zip https://github.com/dbarj/oci360/archive/master.zip
[oracle@orasrv ~]$ sha1sum oci360.zip
eaced7a92f88bfcff4176e6651cb6e556cbe4794 oci360.zip
[oracle@orasrv ~]$ unzip oci360.zip
[oracle@orasrv ~]$ mv oci360-master/ oci360/
[oracle@orasrv ~]$ mkdir /home/oracle/oci360_out/
[oracle@orasrv ~]$ sqlplus sys/xxx@localhost:1521/xepdb1 as sysdba
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL> create user OCI360 identified by "xxx";
SQL> alter user OCI360 default tablespace USERS quota unlimited on USERS;
SQL> grant CREATE SESSION, ALTER SESSION, CREATE SEQUENCE, CREATE TABLE, CREATE VIEW to OCI360;
SQL> grant SELECT on SYS.GV_$INSTANCE to OCI360;
SQL> grant SELECT on SYS.GV_$OSSTAT to OCI360;
SQL> grant SELECT on SYS.GV_$SYSTEM_PARAMETER2 to OCI360;
SQL> grant SELECT on SYS.V_$DATABASE to OCI360;
SQL> grant SELECT on SYS.V_$INSTANCE to OCI360;
SQL> grant SELECT on SYS.V_$PARAMETER to OCI360;
SQL> grant SELECT on SYS.V_$PARAMETER2 to OCI360;
SQL> grant SELECT on SYS.V_$PROCESS to OCI360;
SQL> grant SELECT on SYS.V_$SESSION to OCI360;
SQL> grant SELECT on SYS.V_$SYSTEM_PARAMETER2 to OCI360;
SQL> grant EXECUTE on SYS.DBMS_LOCK to OCI360;
SQL> grant EXECUTE on SYS.UTL_FILE to OCI360;
SQL> create directory OCI360DIR_RJTEN as '/home/oracle/oci360_out/';
SQL> grant READ,WRITE,EXECUTE on directory OCI360DIR_RJTEN to OCI360;
SQL> exit
PS: For more information about the necessary database and grants, check the DB User Privileges and the Database Requirements pages.
The steps 1 and 2 just need to be executed once per tenancy. If you want to regenerate your OCI360 output, just consider the steps from here.
Call the JSON exporter tool to export all your tenancy info into a zip file.
[oracle@orasrv ~]$ cd /home/oracle/oci360_out/
[oracle@orasrv oci360_out]$ /home/oracle/oci360/sh/oci_json_export.sh ALL_REGIONS
Starting region sa-saopaulo-1.
Starting region us-ashburn-1.
Starting region ap-sydney-1.
Processing "oci_bv_boot-volume-backup.json" in sa-saopaulo-1.
Processing "oci_bv_boot-volume-backup.json" in us-ashburn-1.
Processing "oci_bv_boot-volume-backup.json" in ap-sydney-1.
Processing "oci_bv_boot-volume-kms-key.json" in us-ashburn-1.
Processing "oci_bv_boot-volume-kms-key.json" in sa-saopaulo-1.
Processing "oci_bv_boot-volume-kms-key.json" in ap-sydney-1.
Processing "oci_bv_boot-volume.json" in sa-saopaulo-1.
...
[oracle@orasrv oci360_out]$ ls -l
total 252
-rw-r--r--. 1 oracle oinstall 67200 Dec 31 14:35 oci_json_export_20191231130255_ap-sydney-1.zip
-rw-r--r--. 1 oracle oinstall 87269 Dec 31 14:39 oci_json_export_20191231130255_sa-saopaulo-1.zip
-rw-r--r--. 1 oracle oinstall 84418 Dec 31 14:45 oci_json_export_20191231130255_us-ashburn-1.zip
PS 1: oci_json_export tool is hosted at https://github.com/dbarj/oci-scripts. The step-by-step instructions of how to run it is available at https://www.dbarj.com.br/en/2018/10/howto-backup-oracle-cloud-infrastructure-metadata/.
PS 2: If the export is taking too much time on a given object type, you can skip it using exporting OCI_JSON_EXCLUDE variable.
This step is only valid if you are subscribed to multiple regions and the command above generated multiple zip files (one per region).
The merger shell-script will concatenate all of them into a single zip. In the example below, I'm concatenating 3 region zips in a single file:
[oracle@orasrv ~]$ cd /home/oracle/oci360_out/
[oracle@orasrv oci360_out]$ /home/oracle/oci360/sh/oci_json_merger.sh "oci_json_export_20191231130255_*.zip" oci_json_export_20191231130255.zip
[oracle@orasrv oci360_out]$ ls -l
total 364
-rw-r--r--. 1 oracle oinstall 123250 Dec 31 14:54 oci_json_export_20191231130255.zip
-rw-r--r--. 1 oracle oinstall 67200 Dec 31 14:35 oci_json_export_20191231130255_ap-sydney-1.zip
-rw-r--r--. 1 oracle oinstall 87269 Dec 31 14:39 oci_json_export_20191231130255_sa-saopaulo-1.zip
-rw-r--r--. 1 oracle oinstall 84418 Dec 31 14:45 oci_json_export_20191231130255_us-ashburn-1.zip
[oracle@orasrv oci360_out]$ rm -f oci_json_export_20191231130255_*.zip
[oracle@orasrv oci360_out]$ ls -l
total 124
-rw-r--r--. 1 oracle oinstall 123250 Dec 31 14:54 oci_json_export_20191231130255.zip
If you want to add Usage and/or Audit info from your tenancy into OCI360, before going to the final phase, please follow the steps:
Finally call OCI360:
[oracle@orasrv ~]$ cd /home/oracle/oci360/
[oracle@orasrv oci360]$ sqlplus oci360/xxx@localhost:1521/xepdb1
Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
SQL> DEF moat369_pre_sw_output_fdr = '/home/oracle/oci360_out/'
SQL> @oci360.sql
Wrote file original_settings
Getting JSON Files
Please wait ...
...
...
"End oci360. Output: /home/oracle/oci360_out/oci360_20200104_2042.zip"
Disconnected from Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0
[oracle@orasrv oci360]$
PS: For more information about DEFINE variables that can change the script behaviour, check the Control Variables page.
- Download and Unzip output oci360_YYYYMMDD_HH24MI.zip into a directory on your PC
- Review main html file 00001_oci360_index.html
(Only use this if you want to do everything manually.)