# Oracle Modes Configuration Guide - UNIFIED ## 🎯 Un Singur Dockerfile + Docker Compose | Oracle Version | Configurație .env | Comandă Build | Port | |---------------|-------------------|---------------|------| | 10g (test) | `INSTANTCLIENTPATH=...` | `docker-compose up --build` | 5003 | | 11g (prod) | `INSTANTCLIENTPATH=...` | `docker-compose up --build` | 5003 | | 12.1+ (nou) | `FORCE_THIN_MODE=true` | `ORACLE_MODE=thin docker-compose up --build` | 5003 | --- ## 🔧 THICK MODE (Oracle 10g/11g) - DEFAULT ### Configurare .env: ```env # Uncomment această linie pentru thick mode: INSTANTCLIENTPATH=/opt/oracle/instantclient_23_9 # Comment această linie: # FORCE_THIN_MODE=true ``` ### Rulare: ```bash docker-compose up --build -d curl http://localhost:5003/health ``` --- ## 🚀 THIN MODE (Oracle 12.1+) ### Varianta 1 - Prin .env (Recomandat): ```env # Comment această linie pentru thin mode: # INSTANTCLIENTPATH=/opt/oracle/instantclient_23_9 # Uncomment această linie: FORCE_THIN_MODE=true ``` ### Varianta 2 - Prin build argument: ```bash ORACLE_MODE=thin docker-compose up --build -d ``` ### Test: ```bash curl http://localhost:5003/health ``` --- ## 🔄 LOGICA AUTO-DETECT Container-ul detectează automat modul: 1. **FORCE_THIN_MODE=true** → **Thin Mode** 2. **INSTANTCLIENTPATH** există → **Thick Mode** 3. Build cu **ORACLE_MODE=thin** → **Thin Mode** 4. Default → **Thick Mode** --- ## 🛠️ COMENZI SIMPLE ### Pentru Oracle 10g/11g (setup-ul tău actual): ```bash # Verifică .env să aibă: grep INSTANTCLIENTPATH ./api/.env # Start docker-compose up --build -d curl http://localhost:5003/test-db ``` ### Pentru Oracle 12.1+ (viitor): ```bash # Editează .env: decomentează FORCE_THIN_MODE=true # SAU rulează direct: ORACLE_MODE=thin docker-compose up --build -d curl http://localhost:5003/test-db ``` ### Switch rapid: ```bash # Stop docker-compose down # Edit .env (change INSTANTCLIENTPATH ↔ FORCE_THIN_MODE) # Start docker-compose up --build -d ``` --- ## ⚠️ TROUBLESHOOTING ### Eroare DPY-3010 în Thin Mode: ``` DPY-3010: connections to this database server version are not supported ``` **Soluție:** Oracle este 11g sau mai vechi → folosește thick mode ### Eroare libaio în Thick Mode: ``` Cannot locate a 64-bit Oracle Client library: libaio.so.1 ``` **Soluție:** Rebuild container (fix automat în Dockerfile.thick) ### Container nu pornește: ```bash docker-compose logs docker-compose down && docker-compose up --build ``` --- ## 📊 COMPARAȚIE PERFORMANȚĂ | Aspect | Thick Mode | Thin Mode | |--------|------------|-----------| | Container Size | ~200MB | ~50MB | | Startup Time | 10-15s | 3-5s | | Memory Usage | ~100MB | ~30MB | | Oracle Support | 10g+ | 12.1+ | | Dependencies | Instant Client | None | --- ## 🔧 DEZVOLTARE ### Pentru dezvoltatori: 1. **Thick mode** pentru compatibilitate maximă 2. **Thin mode** pentru development rapid pe Oracle nou 3. **Auto-detect** în producție pentru flexibilitate ### Testare ambele moduri: ```bash # Thick pe port 5003 docker-compose -f docker-compose.thick.yaml up -d # Thin pe port 5004 docker-compose -f docker-compose.thin.yaml up -d # Test ambele curl http://localhost:5003/health curl http://localhost:5004/health ```