# freddenis/oracle-scripts architecture

> Architecture diagram of the GitHub repository freddenis/oracle-scripts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/freddenis/oracle-scripts
- Repository: https://github.com/freddenis/oracle-scripts

## Overview

##### Project type and purpose
- From the file tree and README, this is not a web or GUI application but a toolbox of Bash scripts for Oracle DB administration and monitoring (“oracle-scripts”).
- The scripts cover tasks such as ASM checks, RAC status, RMAN backups, patch listing, NFS checks, password changes, and integration with OCI.

##### File structure
- Top-level: a flat directory of .sh and .sql files—each script is a self-contained utility.
- Scripts are grouped by function via naming conventions:
- “gg-*.sh” → GoldenGate management
- “rac-*.sh” → Real Application Clusters status
- “exa-*.sh” → Exadata information
- “nfs-*, oci-*, rman-*, list-ohpatches.sh” → storage, cloud, backup, patching
- SQL files (.sql) contain queries the scripts invoke via SQL*Plus.
- No frontend/backend: all components run on the DBA host or bastion server.

##### Key components
A. DBA Host / Automation Server
- Contains all the Bash scripts (grouped by function).
- Scheduler (cron or orchestration tool) triggers them.
B. Oracle Targets
- Oracle Databases (Single instance, RAC clusters)
- ASM Instances
C. Storage / External Services
- NFS mounts
- OCI backup vault or object storage
D. Logging / Notification
- Log files, STDOUT→email or central logging (syslog / ELK etc.)

##### Relationships and interactions
- Scripts → Oracle via SQL*Plus or RMAN (listeners/tnsnames).
- Scripts → NFS status checks (shell commands).
- Backup scripts → OCI APIs or RMAN channels → OCI object storage.
- Output → central log or email notifications.

##### Architectural patterns / design principles
- Modular scripts: each does one task.
- Naming conventions group related utilities.
- Reuse of .sql queries via “pidsid.sql” or “locks.sql.”
- Clear separation of monitoring (status checks), management (start/stop), backup and reporting.

## Diagram (Mermaid)

```mermaid
flowchart TB
    Scheduler["Scheduler\n(cron/Ansible/AWX)"]:::scheduler

    subgraph "DBA Host / Automation Server"
        direction LR
        subgraph "Monitoring Scripts"
            direction TB
            rac_status["rac-status.sh"]:::automation
            asmdu["asmdu.sh"]:::automation
            exa_hsmart["exa-howsmart.sh"]:::automation
            nfs_status["nfs-status.sh"]:::automation
        end
        subgraph "Management Scripts"
            direction TB
            gg_start["gg-start.sh"]:::automation
            rac_on_all["rac-on_all_db.sh"]:::automation
            svc_failback["svc-set-failback-yes.sh"]:::automation
            change_pwd["change-password.sh"]:::automation
        end
        subgraph "Backup / Cloud Scripts"
            direction TB
            rman_backup["rman-backup.sh"]:::automation
            oci_check["oci-check-backups.sh"]:::automation
        end
        subgraph "Patching / Inventory Scripts"
            direction TB
            list_patches["list-ohpatches.sh"]:::automation
            lspatches["lspatches.sh"]:::automation
        end
        subgraph "SQL Query Modules"
            direction TB
            pidsid["pidsid.sql"]:::automation
            locks["locks.sql"]:::automation
            sidpid["sidpid.sql"]:::automation
        end
        subgraph "Utilities"
            direction TB
            oraenvpp["oraenv++"]:::automation
            yal["yal.sh"]:::automation
        end
    end

    subgraph "Oracle Environment"
        direction TB
        single["Single Instance DB"]:::oracle
        rac["Oracle RAC Cluster"]:::oracle
        asm["ASM Instance"]:::oracle
    end

    subgraph "External Storage / Cloud"
        direction TB
        nfs["NFS Storage"]:::cloud
        oci_obj["OCI Object Storage"]:::cloud
    end

    logging["Central Logging / Email"]:::scheduler

    %% Scheduler triggers scripts
    Scheduler --> rac_status
    Scheduler --> gg_start
    Scheduler --> rman_backup
    Scheduler --> list_patches

    %% Monitoring interactions
    rac_status --> rac
    asmdu --> asm
    exa_hsmart --> rac
    nfs_status --> nfs

    %% Management interactions
    gg_start --> rac
    rac_on_all --> rac
    svc_failback --> rac
    change_pwd --> single

    %% Backup interactions
    rman_backup --> single
    rman_backup --> rac
    rman_backup --> oci_obj
    oci_check --> oci_obj

    %% Scripts to logging
    rac_status --> logging
    gg_start --> logging
    rman_backup --> logging
    list_patches --> logging

    %% Scripts invoke SQL modules
    rac_status -.-> pidsid
    rac_status -.-> locks
    rac_status -.-> sidpid
    gg_start -.-> pidsid

    %% Click Events
    click rac_status "https://github.com/freddenis/oracle-scripts/blob/master/rac-status.sh"
    click asmdu "https://github.com/freddenis/oracle-scripts/blob/master/asmdu.sh"
    click exa_hsmart "https://github.com/freddenis/oracle-scripts/blob/master/exa-howsmart.sh"
    click nfs_status "https://github.com/freddenis/oracle-scripts/blob/master/nfs-status.sh"
    click gg_start "https://github.com/freddenis/oracle-scripts/blob/master/gg-start.sh"
    click rac_on_all "https://github.com/freddenis/oracle-scripts/blob/master/rac-on_all_db.sh"
    click svc_failback "https://github.com/freddenis/oracle-scripts/blob/master/svc-set-failback-yes.sh"
    click change_pwd "https://github.com/freddenis/oracle-scripts/blob/master/change-password.sh"
    click rman_backup "https://github.com/freddenis/oracle-scripts/blob/master/rman-backup.sh"
    click oci_check "https://github.com/freddenis/oracle-scripts/blob/master/oci-check-backups.sh"
    click list_patches "https://github.com/freddenis/oracle-scripts/blob/master/list-ohpatches.sh"
    click lspatches "https://github.com/freddenis/oracle-scripts/blob/master/lspatches.sh"
    click pidsid "https://github.com/freddenis/oracle-scripts/blob/master/pidsid.sql"
    click locks "https://github.com/freddenis/oracle-scripts/blob/master/locks.sql"
    click sidpid "https://github.com/freddenis/oracle-scripts/blob/master/sidpid.sql"
    click oraenvpp "https://github.com/freddenis/oracle-scripts/tree/master/oraenv++"
    click yal "https://github.com/freddenis/oracle-scripts/blob/master/yal.sh"

    classDef automation fill:#e0f7fa,stroke:#0277bd,color:#000
    classDef oracle fill:#e8f5e9,stroke:#2e7d32,color:#000
    classDef cloud fill:#fff3e0,stroke:#ef6c00,color:#000
    classDef scheduler fill:#eeeeee,stroke:#6d4c41,color:#000
```
