oracle-samples / usage-reports-to-adw

Usage2adw is a tool which uses the Python SDK to extract the usage and cost reports from your tenant and load it to Oracle Autonomous Database. (DbaaS can be used as well) Authentication to OCI by User or instance principals.
Other
14 stars 9 forks source link

"APEX - Can not delete application 100" while executing /home/opc/usage_reports_to_adw/usage2adw_setup.sh -setup_app #38

Closed sataru15 closed 6 months ago

sataru15 commented 6 months ago

Hi Support,

We are performing the "Step by Step Manual installation Guide on OCI VM and Autonomous Data Warehouse Database" following the link https://github.com/oracle-samples/usage-reports-to-adw/blob/main/step_by_step_manual_installation.md. While executing the Step 13. Execute the python script - usage2adw.py or setup_usage2adw.sh "/home/opc/usage_reports_to_adw/usage2adw_setup.sh -setup_app" facing below error message

  1. Enable APEX Application. Internal LOG=/home/opc/usage_reports_to_adw/log/enable_apex_application_20240502_123644.log ORA-20987: APEX - Can not delete application 100, it is installed in a different workspace! ORA-20987: APEX - Can not delete application 100, it is installed in a different workspace! - Contact your application administrator. Error enabling APEX Application, please check log /home/opc/usage_reports_to_adw/log/enable_apex_application_20240502_123644.log, aborting.

Create APEX Workspace User

PL/SQL procedure successfully completed.

Remove Application 100 begin * ERROR at line 1: ORA-20987: APEX - Can not delete application 100, it is installed in a different workspace! ORA-06512: at "APEX_230200.WWV_FLOW_ERROR", line 1111 ORA-06512: at "APEX_230200.WWV_FLOW_ERROR", line 1569 ORA-06512: at "APEX_230200.WWV_FLOW_IMP", line 1331 ORA-06512: at "APEX_230200.WWV_FLOW_IMP", line 1331 ORA-06512: at line 3

Install Application 100

PL/SQL procedure successfully completed.

--application/set_environment API Last Extended:20231031 Your Current Version:20231031 This import is compatible with version: 20230428 COMPATIBLE (You should be able to run this import without issues.) ID offset during import: 67069732094630378 New ID offset for application: 0 APPLICATION 100 - OCI Usage and Cost Report --application/delete_application begin * ERROR at line 1: ORA-20987: APEX - Can not delete application 100, it is installed in a different workspace! - Contact your application administrator. Details about this incident are available via debug id "553062". ORA-06512: at "APEX_230200.WWV_FLOW_ERROR", line 1111 ORA-06512: at "APEX_230200.WWV_FLOW_ERROR", line 1569 ORA-06512: at "APEX_230200.WWV_FLOW_IMP", line 1331 ORA-06512: at "APEX_230200.WWV_FLOW_IMP", line 1331 ORA-06512: at line 2

adizohar commented 6 months ago

It seems some steps already done and the apex application installed in wrong workspace Either terminate the autonomous database and create new one Or continue step 14 to manual setup the apex application

sataru15 commented 6 months ago

We are capitalizing on our existing ADW database, avoiding the need to incur the expense of creating a new one.

sataru15 commented 6 months ago

Additionally, could you please confirm whether we can bypass the apex configuration steps, as we intend to utilize OAC for the data visualization?

adizohar commented 6 months ago

If you are not planning to use APEX, you can skip this part.

adizohar commented 6 months ago

Please let me know if it works well

sataru15 commented 6 months ago

Then shall we proceed with below steps?

Load the data:

/home/opc/usage_reports_to_adw/shell_scripts/run_multi_daily_usage2adw.sh

adizohar commented 6 months ago

Yes, please let me know if this progress This will load both usage and cost files, if you are only after cost files, you can skip usage files using -su inside the shell script

sataru15 commented 6 months ago

Getting below error while running the script "/home/opc/usage_reports_to_adw/shell_scripts/run_multi_daily_usage2adw.sh".

[opc@**** ~]$ sh /home/opc/usage_reports_to_adw/shell_scripts/run_multi_daily_usage2adw.sh Start running at Thu May 2 18:00:18 GMT 2024... Running local... to /home/opc/usage_reports_to_adw/report/local/20240502_1800_local.txt Traceback (most recent call last): File "/home/opc/usage_reports_to_adw/usage2adw.py", line 74, in import oracledb ModuleNotFoundError: No module named 'oracledb' Finish Thu May 2 18:00:21 GMT 2024 - local Completed at Thu May 2 18:00:21 GMT 2024..

adizohar commented 6 months ago

The required packages were not installed, please install Did you run step 6 ? is it Oracle 8 linux ? here are the commands

sudo dnf module install python39
sudo alternatives --set python3 /usr/bin/python3.9

# Install Python required packages
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade oci oracledb requests
sataru15 commented 6 months ago

Python in the server was pointing to version 3.6. After running sudo alternatives --set python3 /usr/bin/python3.9 the issue fixed. Is it possible to set the python version to 3.9 only specific to opc user as setting this at root level causing dnf update to break.

adizohar commented 6 months ago

You can use python3.6 as well , please install the packages there python3 -m pip install --upgrade pip python3 -m pip install --upgrade oci oracledb requests

Alternative, you can use python3.9. maybe use alias (Need to check if it is sufficient) alias python3=python3.9 alias pip3=pip3.9

adizohar commented 6 months ago

Closing this issue as it has been fixed