Benutzer-Werkzeuge

Webseiten-Werkzeuge


prog:oracle_apex_nginx_tomcat_ords_install_windows_server

Oracle Reports / Oracle APEX / ORDS 25 / Tomcat 9 mit Java 21 / Nginx auf Windows Server

Aufgabe

Ziel ist es einen Oracle Forms/Reports Umgebung mit Oracle Apex Umgebung unter Windows Server zu betreiben.

Eingesetzt werden soll dazu nginx als SSL Proxy Frontend und der Apache Tomcat als Applikation Server für den Oracle ORDS, Oracle Webblogic für die Forms/Reports Umgebung.

In Folge wird auf der Maschine noch eine Forms/Reports Umgebung Oracle Reports Server 14c "The next last Final Release" mit Oracle WebLogic auf einem Windows 2025 Server installieren und betreiben aufgesetzt.

Ablauf:

  • Benötigte Software bereitstellen
  • Oracle Instant Client installieren und Verbindung zur DB testen
  • APEX Statische Ressourcen bereitstellen
  • Java einrichten, falls noch nicht vorhanden
  • Tomcat installieren
  • nginx einrichten
  • APEX auf der Datenbank einrichten (auf dem DB Host!)
  • ORDS Standalone konfigurieren und im Tomcat deployen

In den folgenden Kommandozeilen Beispielen wird die MS PowerShell verwendet!


Lizenz

Wird der ORDS nur für den Aufruf von APEX verwendet, kann der ORDS mit der DB kostenfrei eingesetzt werden.

Aus der Lizenz Dokumentation:

„A restricted-use license for Oracle Application Express Listener is included with all editions (except for Oracle Database Express Edition) solely to support connectivity to Oracle Application Express, which may be installed in the Oracle Database. Running Oracle Application Express Listener on a different server does not require that that server be licensed to use the Oracle Database.“

siehe ⇒ http://docs.oracle.com/database/121/DBLIC/editions.htm#DBLIC2163 bzw. https://docs.oracle.com/en/database/oracle/oracle-database/26/dblic/Licensing-Information.html


Download der notwendigen Software

Betriebssystem vorbereiten

Die erste Test Installation ob es funktionieren kann erfolgt auf einer Eval Data Center Edition 2025 Maschine.

MS-Windows 2025 (https://www.microsoft.com/de-de/evalcenter/download-windows-server-2025) steht im vhdx Format als virtuelle Maschine zur Verfügung.

Um diese Disk in VMWare Workstation zu verwenden muss diese Disk erst in das alte vhd Format umgewandelt werden.

Dazu kann das Tool qemu-img ( mehr dazu unter https://www.qemu.org/ und Download für Windows unter https://cloudbase.it/qemu-img-windows/) verwendet werden. Ein direkte Wandeln in das VMDK Format hat nicht auf anhieb funktioniert, daher nicht weiter so getestet da VMWare auch das VHD Format lesen kann.

Umwandeln mit den Format „VPC“:

PS C:\tools\qemu-img-win-x64-2_3_0> ./qemu-img.exe convert D:\vmware\WINSERVER2025\windows_server_2025.vhdx -O vpc D:\vmware\WINSERVER2025\windows_server_2025.vhd

Virtuelle Maschine mit der Platte als erste Platte anlegen und als Bios UEFI verwenden.

Empfohlen ist die Verwendung der englischen Variante von Windows 2025, oft lässt sich im Support Fall mit deutschen Fehlermeldungen nicht viel anfangen!

OS Vorbereiten

Die Installation muss unter dem OS-User (in meinen Fall ORASYSTEM ) stattfinden unter dem auch alle Services betrieben werden soll, ein entsprechenden User wird zuvor mit lokalen Admin Rechten anlegt.

  • Standard Installation Windows 2025 + letzten MS Update Stand
    • Produktiven Namen vergeben und in die Domäne aufnehmen
    • 8 GB Ram Minimum vorsehen
    • C: - 50GB besser 75GB
    • Verzeichnis „C:\temp“ anlegen

Die IP Adresse und vor allen der Name des Servers sollte sich nach der Installation NIE wieder ändern! Dies vorab verbindlich mit der IT vereinbaren und viel Ärger und Mühen einzusparen!

Tools installieren
Windows System optimieren
  • Aufruf „Advanced System Settings“ ( Control Panel\System and Security\System\Advanced System Settings ) „Advanced“
    • Performance Options :: Visual Effects :: „Best performance“ aktivieren
    • Performance Options :: Advanced :: „Background services“ aktivieren
    • Data Execution Prevention :: „Turn on DEP for essential Windows programs and services only“
    • Enviroment Variables ::
      • TEMP und TMP auf c:\temp für „System variables“ und auf c:\temp für die „User variables“
      • TNS_ADMIN auf C:\oracle\TNS_ADMIN für „System variables“
      • JAVA_HOME auf C:\srv\jdk-21.0.9 für „System variables“
      • JRE_HOME auf C:\srv\jdk-21.0.9 für „System variables“
  • Bildschirmschoner auf „Blank“ stellen bzw. deaktivieren (Control Panel\Appearance\Display)
  • Enabling User Account Control (UAC)
    • secpol.msc aus der PowerShell (adminstrative) starten
    • Security Settings > Local Policies > Security Options.
    • „User Account Control:Run all Administrator in Admin Approval Mode“ auf „enabled“ stellen
    • Server neu starten
System sichern

Nochmal überprüfen ob der Maschinen Namen und die IP Adresse nun definitiv sich nie wieder ändern bzw. auf die letztendlichen Settings setzen!

Herunterfahren und Snapshot setzen.


Alle Weiteren Arbeiten werden nun unter dem User ORASYSTEM durchgeführt!


Oracle Instant Client installieren und Verbindung zur DB testen

siehe auch Oracle SQL*LDR - Auf dem Clientarbeitsplatz Windows 10 mit dem Instant Client 19 verwenden

Herunterladen über https://www.oracle.com/database/technologies/instant-client/downloads.html und nach C:\oracle\product\instantclient_23_9 entpacken.

TNS_ADMIN auf C:\oracle\TNS_ADMIN für „System variables“ Ebene global einstellen.

Tnsname.ora und sqlnet.ora unter C:\oracle\TNS_ADMIN mit den notwendigen SQL*Net Konfigurationsdaten ablegen.


APEX Statische Ressourcen bereitstellen

APEX Zip für die Images herunterladen unter https://www.oracle.com/tools/downloads/apex-downloads/ .

Auspacken nach C:\srv\apex und alles bis auf C:\srv\apex\images wieder löschen.

Dran denken das bei einem Patch von APEX auf dem DB Server auch dieser Verzeichnis zu aktualisieren!


Java 21

Java entpacken nach C:\srv\jdk-21.0.9

Umgebungsvariablen JAVA_HOME und JRE_HOME setzen

Überprüfen in einer neuen Powershell Session mit:

echo $ENV:JAVA_HOME
 
echo $ENV:JRE_HOME

Tomcat 9

Verzeichnis für Tomcat anlegen, wie C:\srv

mkdir c:\srv\tomcat

Damit wir nicht bei jedem Update neue Ordnerstrukturen benötigen, versuchen wir jetzt auch mal unter Windows wie unter Linux mit einem Link zu arbeiten, leider lässt sich „mklink“ aber nur unter der alten Dos Schell aufrufen …

Administrative Powershell starten:

#Anleitung
cmd.exe /c mklink.exe
 
#link setzen, auf die /d Option achten!
cmd.exe /c mklink /d C:\srv\tomcat c:\srv\tomcat-9.0.111

Tomcat Konfigurieren

Apache Tomcat wird über die folgenden vier Dateien konfiguriert:

  • server.xml
  • context.xml
  • tomcat-users.xml
  • web.xml

Die Dateien liegen unter TOMCAT_HOME\conf Verzeichnis

TCP Port setzen - server.xml

Über „server.xml“ wird der Port gesetzt, der Default ist 8080.

Soll der Port verändert werden, zum Beispiel auf 8090, folgende Zeile suchen und anpassen:

<Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000"
               redirectPort="8443" />
Admin User konfigurieren - tomcat-users.xml

Über die Datei tomcat-users.xml wird der Admin User für die Admin Oberfläche konfiguriert, dazu werden bestimmte Rollen benötigt

  • manager-gui - allows access to the HTML GUI and the status pages
  • manager-script - allows access to the text interface and the status pages
  • manager-jmx - allows access to the JMX proxy and the status pages
  • manager-status - allows access to the status pages only
<role rolename="manager-gui"/>
<user username="tomcat" password="geheim" roles="manager-gui"/>

Tomcat starten

Über die Datei startup.bat im TOMCAT_HOME\bin Verzeichnis kann der Tomcat gestartet werden.

set-item -path ENV:JAVA_HOME -value "C:\srv\jdk-21.0.9"
set-item -path ENV:JRE_HOME -value $ENV:JAVA_HOME
 
cd D:\srv\tomcat\bin
& .\startup.bat

Dos Fenster mit dem Tomcat Start Ausgaben öffnet sich.

Firewall Anfrage mit „Allow“ beantworten.

Aufruf der Tomcat Oberfläche mit http://localhost:8090 zum Test ob Tomcat gestartet werden konnte.

Apache Tomcat 9 Autostart einrichten

Am einfachsten geht das mit dem Programm unter %TOMCAT_HOME%/bin/tomcat9.exe

Aus der Doku:

Install the service named 'OraEnvTomcat9':

cd C:\srv\tomcat\bin
 
cmd
 
service.bat install OraEnvTomcat9

Siehe auch unter https://tomcat.apache.org/tomcat-9.0-doc/windows-service-howto.html

! Java Options anpassen um die ORDS Konfiguration dann auch später zu finden!

Kontrolle und konfigurieren mit tomcat9w.exe

hinzufügen unter Java Options:

-Dconfig.url=c:\srv\ords

Name des Programms muss wie der Service Name lauten!

cd c:\srv\tomcat\bin
copy tomcat9w.exe OraEnvTomcat9.exe
OraEnvTomcat9.exe

 Kontrolle und konfigurieren mit tomcat9w.exe

Speicherparameter anpassen und auf den richtigen Pfad zur ORDS Konfiguration achten!


nginx

Bereitstellen

Über https://nginx.org/en/download.html NGNIX herunterladen und nach c:\srv\nginx-1.28.0 entpacken.

Verzeichnis für nginx anlegen, wie C:\srv\nginx

mkdir c:\srv\nginx

Damit wir nicht bei jedem Update neue Ordnerstrukturen benötigen, wird wieder verlinkt.

Administrative Powershell starten:

#link setzen, auf die /d Option achten!
cmd.exe /c mklink /d C:\srv\nginx c:\srv\nginx-1.28.0

Konfiguration

Für Oracle Forms und Reports wird gemappt:

  • /console
  • /em
  • /reports
  • /forms

Für Orace APEX

  • /i
  • /ords

C:\srv\nginx\conf\nginx.conf

worker_processes  1;
 
events {
    worker_connections  1024;
}
 
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    sendfile        on;
 
 
    # HTTP → HTTPS Weiterleitung
    server {
        listen 80;
        server_name myapexserver.gpi.local;
        return 301 https://$host$request_uri;
    }
 
    # HTTPS mit SSL-Termination
    server {
 
      root /srv/apex;
 
        listen 443 ssl;
        http2 on;
        #listen        80;
        server_name  myapexserver.gpi.local;
        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
 
        ssl_certificate      C:/srv/Certificate/fullchain.pem;
        ssl_certificate_key  C:/srv/Certificate/privkey.pem;
 
        ssl_protocols        TLSv1.2 TLSv1.3;
        ssl_ciphers          HIGH:!aNULL:!MD5;
 
        #ORDS über Tomcat weiterleiten
        location /ords {
            proxy_pass http://localhost:8080/ords;
         proxy_http_version 1.1;
 
         chunked_transfer_encoding on;
 
 
         proxy_set_header Host $host;
         proxy_set_header X-Forwarded-Host $host;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
         proxy_set_header X-Real-IP $remote_addr;         
 
 
            #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            #für ssl!
         proxy_set_header X-Forwarded-Proto https;
         #proxy_set_header X-Forwarded-Proto http;
 
            proxy_connect_timeout 60s;
            proxy_read_timeout 120s;
            proxy_send_timeout 120s;
 
         client_max_body_size 100M;
 
         # Cache-Control mit must-revalidate setzen und auf no-store
         #  für https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/04-Authentication_Testing/06-Testing_for_Browser_Cache_Weaknesses
         add_header Cache-Control "no-store, no-cache, must-revalidate" always;
         add_header Pragma "no-cache" always;
         add_header Expires "0" always;
 
        }
 
      #Weblogic Konsole weiterleiten
 
        location /console {
            proxy_pass http://localhost:7001/console;
         proxy_http_version 1.1;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
 
         # WebLogic-spezifische Header
         proxy_set_header WL-Proxy-Client-IP $remote_addr;
         proxy_set_header WL-Proxy-SSL "true";
 
         # Cookies anpassen, falls Pfad geändert wird
         proxy_cookie_path / /;
 
         # Keep-Alive für WebLogic
         proxy_set_header Connection "";
      }
 
 
      location /em {
            proxy_pass http://localhost:7001/em;
         proxy_http_version 1.1;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
 
         # WebLogic-spezifische Header
         proxy_set_header WL-Proxy-Client-IP $remote_addr;
         proxy_set_header WL-Proxy-SSL "true";
 
         # Cookies anpassen, falls Pfad geändert wird
         proxy_cookie_path / /;
 
         # Keep-Alive für WebLogic
         proxy_set_header Connection "";
      }
 
      location /reports {
            proxy_pass http://localhost:9002/reports;
         proxy_http_version 1.1;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
 
         # WebLogic-spezifische Header
         proxy_set_header WL-Proxy-Client-IP $remote_addr;
         proxy_set_header WL-Proxy-SSL "true";
 
         # Cookies anpassen, falls Pfad geändert wird
         proxy_cookie_path / /;
 
         # Keep-Alive für WebLogic
         proxy_set_header Connection "";
      }
 
      location /forms {
            proxy_pass http://localhost:9001/forms;
         proxy_http_version 1.1;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header X-Forwarded-Port $server_port;
 
         # WebLogic-spezifische Header
         proxy_set_header WL-Proxy-Client-IP $remote_addr;
         proxy_set_header WL-Proxy-SSL "true";
 
         # Cookies anpassen, falls Pfad geändert wird
         proxy_cookie_path / /;
 
         # Keep-Alive für WebLogic
         proxy_set_header Connection "";
      }
 
 
      #APEX statische Ressourcen direkt vom Dateisystem
      location /i/ {
         alias C:/srv/apex/images/;  
         autoindex off;              
         access_log off;
 
         # Optional: Cache für statische Inhalte
         expires 7d;
 
        # MIME-Typen sicherstellen
        default_type application/octet-stream;
      }
 
    }
 
   # Gzip für statische Inhalte aktivieren
    gzip on;
    gzip_types text/css application/javascript image/svg+xml;
}
Beim Anpassungen der Konfiguration prüfen ob nginx auch wirklich zuvor gestopt wurde, unter Windows scheint ein reload der Konfiguration ohne echten Neustart nur bedingt zu funktionieren!

Konfiguration pürfen mit:

cd 
 
.\nginx.exe -T

Starten

cd C:\srv\nginx
 
start nginx

Aufruf mit https://apexserv01.gpi.local/i/apex_version.txt zum Test ob nginx gestartet werden konnte und das /i/ auf richtig auflößt.

stoppen:

PS C:\srv\nginx> .\nginx.exe -s stop

Auto Start einrichten

Mit NSSM (Non-Sucking Service Manager) Nginx als echten Dienst installieren.

NSSM von https://nssm.cc/download herunterladen nach c:\tools\nssm-2.24 entpacken

Powershell als Administrator öffnen

 cd C:\tools\nssm-2.24\win64
 
#starten
 
 .\nssm install nginx
 
#nach dem Ausfüllen des Dialoges
#Service "nginx" installed successfully!

Im NSSM dialog:

  • Pfad zur Bin Datei setzen
  • Nginx directory hinterlegen
  • Install service auswählen
  •  Service "nginx" mt nssm installieren

Log Files rotieren

Unter Windows mit:

rotate_logs_nginx.ps1
<#!
.SYNOPSIS
    Rotates NGINX logs, compresses old logs, and deletes logs older than specified days.
.DESCRIPTION
    This script renames current NGINX logs with a date suffix, 
	compresses them into ZIP files,
    and deletes logs older than the retention period.
	It also signals NGINX to reopen logs.
.PARAMETER LogDir
    Path to the NGINX log directory.
.PARAMETER RetentionDays
    Number of days to keep old logs.
.EXAMPLE
    .\rotate_logs_nginx.ps1 -BaseDir "C:\\srv\\nginx-1.28.0" -LogDir "C:\\srv\\nginx-1.28.0\\logs" -RetentionDays 180
#>
 
param(
    [Parameter(Mandatory=$true)]
    [string]$BaseDir,
 
    [Parameter(Mandatory=$true)]
    [string]$LogDir,
 
    [Parameter(Mandatory=$true)]
    [int]$RetentionDays
)
 
# Get current date for suffix
$DateSuffix = (Get-Date -Format "yyyyMMdd")
 
# Ensure log directory exists
if (!(Test-Path $LogDir)) {
    Write-Error "Log directory $LogDir does not exist."
    exit 1
}
 
 
 
# Rotate logs: rename access.log and error.log
$AccessLog = Join-Path $LogDir "access.log"
$ErrorLog  = Join-Path $LogDir "error.log"
 
$RotateAccessLog = Join-Path $LogDir "access-$DateSuffix.log"
$RotateErrorLog = Join-Path $LogDir "error-$DateSuffix.log"
 
if (Test-Path $AccessLog) {
	Rename-Item $AccessLog $RotateAccessLog	
}
if (Test-Path $ErrorLog) {
	Rename-Item $ErrorLog $RotateErrorLog	
}
 
# Signal NGINX to reopen logs
$NginxExe =  Join-Path $BaseDir "nginx.exe"
cd $BaseDir
 
if (Test-Path $NginxExe) {
    & $NginxExe -s reopen
    Write-Host "NGINX signaled to reopen logs."
} else {
     Write-Warning "--ERROR -nginx.exe not found at $NginxExe. Please adjust path if necessary."
}
 
 
Add-Type -AssemblyName System.IO.Compression.FileSystem
 
$ZipFile = Join-Path $LogDir "nginx-logs-$DateSuffix.zip"
 
Write-Host "--INFO - Compress rotated logs into ZIP File $ZipFile "
# Dateien, die eingepackt werden sollen
$files = @(
    $RotateErrorLog,
    $RotateAccessLog
)
 
#check if file open!
 
$TimeoutSekunden = 120
 
foreach ($file in $files) {	
    $StartZeit = Get-Date
	while ($true) {
		try {
			$stream = [System.IO.File]::Open($file, 'Open', 'ReadWrite', 'None')
			$stream.Close()
			Write-Host "--INFO -  Datei $file can bei processed."
			break
		}
		catch {
			if ((Get-Date) - $StartZeit -gt (New-TimeSpan -Seconds $TimeoutSekunden)) {
				Write-Host "--INFO -  Error - File $file still open "
				break
			}
			Write-Host "--INFO - File $file  is still open wait  5 sec..."
			Start-Sleep -Seconds 5
		}
	}
}
 
 
# ZIP erstellen oder öffnen
$zip = [System.IO.Compression.ZipFile]::Open($ZipFile, 'Update')
foreach ($file in $files) {	
    if (Test-Path $file) {
        [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip, $file, [System.IO.Path]::GetFileName($file))
		Write-Host "--INFO -  $file Logs compressed to $ZipFile"
		rm $file
    }
	else {
		Write-Warning "--ERROR -  $file Logs not found"
	}
}
$zip.Dispose()
Write-Host "--INFO -  Logs compressed to $ZipFile"
 
# Delete logs older than retention period
 
$CutoffDate = (Get-Date).AddDays(-$RetentionDays)
 
Get-ChildItem -Path $LogDir -Filter "*.log" | Where-Object { $_.LastWriteTime -lt $CutoffDate } | Remove-Item -Force
Get-ChildItem -Path $LogDir -Filter "*.zip" | Where-Object { $_.LastWriteTime -lt $CutoffDate } | Remove-Item -Force
 
Write-Host "--INFO - Old logs older than $RetentionDays days deleted."
Job anlegen

Das ganze als Job unter dem gleichen User wie den ngnix laufen lassen! ⇒ sonst „Error 5772#5676: OpenEvent(„Global\ngx_reopen_6948“) failed (5: Access is denied)“

Als User „SYSTEM“ im Schedule einstellen!

Taks Parameter:

  • Programm:
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
  • Parameter
    -File C:\tools\Ora_PowerShell\rotate_logs_nginx.ps1 -BaseDir "C:\\srv\\nginx-1.28.0" -LogDir "C:\\srv\\nginx-1.28.0\\logs" -RetentionDays 180
  • Start in:
    C:\tools\Ora_PowerShell

Oracle APEX

Oracle APEX wird in der Datenbank installiert unter dem User Oracle.

Die Datenbank liegt in diesem Beispiel auf einem Linux Server!.

Zuvor die Datei für Oracle APEX - All languages über https://www.oracle.com/tools/downloads/apex-downloads.html herunterladen und auf dem Server kopieren.

Software bereitstellen:

su - oracle
unzip /tmp/apex-latest.zip -d /opt/oracle/product/

Prüfen ob es APEX schon in einer alten Version gibt(XE Problem!)

cd /opt/oracle/product/apex
#Umgebung auf die Datenbank setzen und in den richtigen Container wechseln
 
sqlplus / as sysdba
 
ALTER SESSION SET CONTAINER = FREEDB1;
 
 
#prüfen ob nicht ein alter APEX Stand exisiert
select username from dba_users;
#falls ja mit @apxremov aus dem Oracle Home der DB entfernen!!
Neu installieren

Aufruf des SQL Scripts für die Installation „@apexins.sql tablespace_apex tablespace_files tablespace_temp images“ wie:

# in das APEX Verzeichnis wechseln
 
cd /opt/oracle/product/apex
 
#Umgebung auf die Datenbank setzen 
 
#Sprache setzen
 
export NLS_LANG=American_America.AL32UTF8
 
 
sqlplus / as sysdba
 
# falls cdp richtigen Container setzen!
ALTER SESSION SET CONTAINER = FREEDB1;
 
spool /tmp/install_apex.log
 
@apexins.sql APEX APEX TEMP /i/
 
..
 
Thank you for installing Oracle APEX 23.1.0
 
Oracle APEX is installed in the APEX_230100 schema.
..
timing for: Complete Installation
Elapsed:    9.88

Laufzeit in meiner Testumgebung 9,8min (i9 Cpu SSD, 2GB memory_target)

  • Erzeugtes Logfile auf Fehler prüfen
Apex User konfigurieren

Den Instance Administrator - Master User für die Apex Verwaltung konfigurieren/Password setzen mit dem Script „apxchpwd.sql“, das Password muss komplex sein!

# falls cdp richtigen Container setzen!
ALTER SESSION SET CONTAINER = FREEDB1;
 
@apxchpwd.sql

Anleitung beachten und Password auch gut merken .-)!

ORDS vorbereiten

APEX_LISTENER und APEX_REST_PUBLIC_USER User anlegen mit:

# falls cdp richtigen Container setzen!
ALTER SESSION SET CONTAINER = FREEDB1;
  @apex_rest_config.sql

APEX_PUBLIC_USER User Passwort setzen und entsperren

ALTER USER APEX_PUBLIC_USER IDENTIFIED BY xxxxx account UNLOCK;

In der Produktion ein besseres Password wählen!!

Nach diesem Schritten kann nun der ORDS installiert werden um auf Apex zuzugreifen.

  • Bei der Installation werden drei neue Schemas angelegt:
    • APEX_230100 - The account that owns the Oracle Application Express schema and metadata.
    • APEX_LISTENER
    • APEX_REST_PUBLIC_USER
    • APEX_PUBLIC_USER - The minimally privileged account is used for Oracle Application Express configuration with Oracle REST Data Services or Oracle HTTP Server and mod_plsql.

Sprachpakete installieren

Soll auch Deutsch in einer APP zum Einsatz kommen das deutsche Sprachpaket installieren, siehe auch APEX Applikation in deutscher Sprache erstellen - Sprachpaket installieren

cd /opt/oracle/product/apex/builder/de
 
export NLS_LANG=American_America.AL32UTF8
 
sqlplus / AS sysdba
ALTER SESSION SET CONTAINER = FREEDB1;
 
@load_de.sql

Aktuellen Patch einspielen

Nun gleich im nächsten Schritt den aktuellen Patch Patch einspielen ( Aktuell 03.2021 Set Bundle for Oracle APEX 21.1 (32598392)) einspielen:

Download über den Oracle Support.

  • PSE BUNDLE FOR APEX 23.2 (PSES ON TOP OF 23.2.0) (Patch) - p35895964_2320_Generic.zip 349.0 KB (357387 bytes) - SHA-1 C85B8AEF5325084234B308FFD3E5933ABE0EAC0E - SHA-256 7650057575F623ADDA6720EBE2D97CC3B921F41CCD75AD2B68B26B47E935CB86

Patch DB:

# Upload nach /opt/oracle/install/patch/
 
sha1sum  p35895964_2320_Generic.zip
f7741994ff1c32b43bade2e48a998b6b3ba60539  p32598392_2110_Generic.zip
 
 
#einspielen als Oracle
 
cd /opt/oracle/install/patch/
 
unzip p35895964_2320_Generic.zip
cd 35895964
 
 
#Zeichensatz setzen
 
export NLS_LANG=American_America.AL32UTF8
 
#Patch je nach Umgebung einspielen
# sqlplus "sys/ as sysdba" @catpatch.sql        -- for Oracle Database 12.1 and newer, for non-CDB, for CDB where Oracle APEX is not installed in the root, and for PDB where APEX is not installed in the root
#     sqlplus "sys/ as sysdba" @catpatch_con.sql    -- for CDB where Oracle APEX is installed in the root
#     sqlplus "sys/ as sysdba" @catpatch_appcon.sql -- for installations where Oracle APEX is installed in an application container
 
# in aktueller Umgebung ist es mir aber nur so gelungen:
 
#DB Umgebung setzen
 
sqlplus "/ as sysdba" 
ALTER SESSION SET CONTAINER = FREEDB1;
@catpatch.sql 
 
 
 
sqlplus / as sysdba
ALTER SESSION SET CONTAINER = FREEDB1;
@?/rdbms/admin/utlrp.sql
 
 
#Patch Stand prüfen
sqlplus / as sysdba
ALTER SESSION SET CONTAINER = FREEDB1;
select patch_version, installed_on from apex_patches;

Statische Dateien kopieren als root:

su - 
 
cd /opt/oracle/install/patch/32006852
 
# mit dem \ orginal cp verwenden nicht den alias um die Wollen Sie überschreiben nachfrage zu unterdrücken
\cp -rf images /srv/apex

#Patch Verzeichnis wieder aufräumen

rm -rf /opt/oracle/install/patch/32006852

Oracle ORDS

Im nächsten Schritt die Installation / Konfiguration des ORDS durchgeführt werden.

Hierbei ist zu beachten:

  • In einer reinen APEX Umgebung Keine Feature installieren um nicht unnötige Sicherheitslücken zu erzeugen
  • bin/ords Script für die Konfigurtion verwenden
  • Pfad zur Config muss über Java Option an Tomcat übergeben werden, Start Skripte müssen angepasst werden!
  • Genau prüfen ob sich „defekte“ ORDS Installationen / Relikte in der Zieldatenbank befinden, z.b. aus einem Full import! Der Ords kann das leider nicht reparieren!

Software bereitstellen

Dazu die aktuelle Version herunterladen und mit der Versionsnummer in ein eigenes Verzeichnis entpacken.

Über https://www.oracle.com/database/sqldeveloper/technologies/db-actions/download/ die Version 25.3.1.289.1312 - October 23, 2025 des ORDS herunterladen.

Checksum prüfen, ob diese mit der Website angegebenen übereinstimmt:

Get-FileHash -Algorithm SHA1 -Path "ords-latest.zip"
 
Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA1            F48A0BD55EA21D48CE91F4AAE3021AFC326DAB52                               C:\OracleSoftware\ORDS\ords-l...

Auspacken und Konfigurationsorder anlegen:

#Auspacken
 
Expand-Archive -Path "C:\OracleSoftware\ORDS\ords-latest.zip" -DestinationPath "C:\oracle\product"
 
# Konfigurationsorder anlegen
 
mkdir c:\srv\ords

Version prüfen:

cd C:\oracle\product\ords.25.2\bin
 ./ords --version
 
ORDS: Release 25.3 Production on Mi. Nov. 05 09:52:23 2025
 
Copyright (c) 2010, 2025, Oracle.
 
Configuration:
  C:\oracle\product\ords.25.2\bin
 
Oracle REST Data Services 25.3.1.r2891312

Konfiguration erstellen

Unsere Konfiguration liegt extra außerhalb der ORDS Software unter „C:\srv\ords“.

Vor 22 wurde dieser Pfad im War File hinterlegt, aber der Version 22 muss der Pfad extra als Variable beim Aufruf mit übergeben werden! Parameter „export _JAVA_OPTIONS=-Dconfig.url=/srv/ords/config“ in der Tomcat Konfiguration!

ORDS Meta Repository in der DB anlegen und DB Pool Konfiguration erzeugen

DB Zugriff vom APP Server überprüfen

Zugriff auf die Datenbank zuvor über den Instantclient mit dem SQL*Plus Ping Befehlt testen:

cd C:\oracle\product\instantclient_23_9
 
/sqlplus /nolog
 
SQL*Plus: Release 23.0.0.0.0 - Production on Wed Nov 5 13:43:29 2025
Version 23.9.0.25.07
 
 
SQL> ping  GPIAPEXDB
 
Local Net Naming configuration file: C:\oracle\TNS_ADMIN\tnsnames.ora
 
Attempting to contact: (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = srvdb01.gpi.local )(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = GPIAPEXDB)))
Ok (20.750 msec)
 
 
SQL> connect sys@GPIAPEXDB as sysdba
Connect durchgefuhrt.

Falls die DB über eine Full Import angelegt wurden und in der orginal Quelle sich alte Reste vom ORDS befinden zuvor die Reste entfernen! Leider erkennt der ORDS nicht wenn sich solche Fragment in der DB befinden und er kann das nicht selber reparieren!

DROP USER ORDS_PUBLIC_USER CASCADE;
DROP USER ORDS_METADATA CASCADE;
 
 
DROP ROLE ORDS_ADMINISTRATOR_ROLE;
DROP ROLE ORDS_RUNTIME_ROLE;
Konfiguration starten

Aufruf des Installs mit dem ORDS Kommandozeilen Tool unter C:\oracle\product\ords.25.2\bin:

 
mkdir C:\srv\ords
 
 
cd C:\oracle\product\ords.25.2\bin
 
./ords --config C:\srv\ords  install -i
 
 
ORDS: Release 25.3 Production on Mi. Nov. 05 12:51:57 2025
 
Copyright (c) 2010, 2025, Oracle.
 
Configuration:
  C:\srv\ords
 
The configuration folder C:\srv\ords does not contain any configuration files.
 
Oracle REST Data Services - Interactive Install
 
  Enter a number to select the TNS net service name to use. Total TNS net service names are 11. Showing only the first 9 TNS net service names from C:\oracle\TNS_ADMIN\tnsnames.ora. Additional option to Specify the database connection.
    ***
    [5] GPIAPEXDB      SERVICE_NAME=GPIAPEXDB
    ***
    [S] Specify the database connection
    [T] Specify the TNS net service name
  Choose [1]: 5
  Provide database user name with administrator privileges.
    Enter the administrator username: sys
  Enter the database password for SYS AS SYSDBA:
 
Retrieving information.
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: TNS
    [2] TNS Connection: TNS_NAME=GPIAPEXDB TNS_FOLDER=C:\oracle\TNS_ADMIN
           Administrator User: SYS AS SYSDBA
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <generate>
    [4] Additional Feature: Database Actions
    [5] Configure and start ORDS in Standalone Mode: Yes
    [6]    Protocol: HTTP
    [7]       HTTP Port: 8080
    [8]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Upgrade ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: 3
  Enter your choice for the runtime user password (ORDS_PUBLIC_USER)
    [S] Specify your own password
    [G] Generate password
    [C] Cancel - No Changes
  Choose [G]: S
  Enter the database password for ORDS_PUBLIC_USER:
Confirm password:
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: TNS
    [2] TNS Connection: TNS_NAME=GPIAPEXDB TNS_FOLDER=C:\oracle\TNS_ADMIN
           Administrator User: SYS AS SYSDBA
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] Additional Feature: Database Actions
    [5] Configure and start ORDS in Standalone Mode: Yes
    [6]    Protocol: HTTP
    [7]       HTTP Port: 8080
    [8]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Upgrade ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: 4
  Enter a number to select additional feature(s) to enable:
    [1] Database Actions  (Enables all features)
    [2] REST Enabled SQL and Database API
    [3] REST Enabled SQL
    [4] Database API
    [5] None
  Choose [1]: 5
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: TNS
    [2] TNS Connection: TNS_NAME=GPIAPEXDB TNS_FOLDER=C:\oracle\TNS_ADMIN
           Administrator User: SYS AS SYSDBA
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] Additional Feature: None
    [5] Configure and start ORDS in Standalone Mode: Yes
    [6]    Protocol: HTTP
    [7]       HTTP Port: 8080
    [8]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Upgrade ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: 5
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: TNS
    [2] TNS Connection: TNS_NAME=GPIAPEXDB TNS_FOLDER=C:\oracle\TNS_ADMIN
           Administrator User: SYS AS SYSDBA
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] Additional Feature: None
    [5] Configure and start ORDS in Standalone Mode: No
    [A] Accept and Continue - Create configuration and Upgrade ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: A
 
  .....
 
 
 
 INFO: 14:16:20 Validating objects for Oracle REST Data Services.
VALIDATION: 14:16:20 Starting validation for schema: ORDS_METADATA
VALIDATION: 14:16:20 Validating objects
VALIDATION: 14:16:20 Validating roles granted to ORDS_METADATA and ORDS_PUBLIC_USER
VALIDATION: 14:16:20 Validating ORDS Public Synonyms
VALIDATION: 14:16:20 Total objects: 433, invalid objects: 0, missing objects: 0
VALIDATION: 14:16:20    103  INDEX
VALIDATION: 14:16:20      4  LOB
VALIDATION: 14:16:20     39  PACKAGE
VALIDATION: 14:16:20     38  PACKAGE BODY
VALIDATION: 14:16:20      1  PROCEDURE
VALIDATION: 14:16:20     89  PUBLIC SYNONYM
VALIDATION: 14:16:20      1  SEQUENCE
VALIDATION: 14:16:20     36  TABLE
VALIDATION: 14:16:20     36  TRIGGER
VALIDATION: 14:16:20     20  TYPE
VALIDATION: 14:16:20      6  TYPE BODY
VALIDATION: 14:16:20     60  VIEW
VALIDATION: 14:16:20 Validation completed.
INFO: 14:16:20 Completed validation for Oracle REST Data Services.
PL/SQL-Prozedur erfolgreich abgeschlossen.
Commit abgeschlossen.
2025-11-05T13:16:20.422Z INFO        Completed installation for Oracle REST Data Services version 25.3.1.r2891312. Elapsed time: 00:00:10.435
 
[*** Info: Completed installation for Oracle REST Data Services version 25.3.1.r2891312. Elapsed time: 00:00:10.435
 ]

Erzeugte Konfiguration anzeigen lassen:

 ./ords --config C:\srv\ords config list
 
ORDS: Release 25.3 Production on Mi. Nov. 05 13:17:59 2025
 
Copyright (c) 2010, 2025, Oracle.
 
Configuration:
  C:\srv\ords
 
Database pool: default
INFO: The configuration does not have any global settings specified.
 
Setting                              Value                                    Source
----------------------------------   --------------------------------------   -----------
db.connectionType                    tns                                      Pool
db.password                          ******                                   Pool Wallet
db.tnsAliasName                      HPOTEST                                  Pool
db.tnsDirectory                      C:\oracle\TNS_ADMIN                      Pool
db.username                          ORDS_PUBLIC_USER                         Pool
feature.sdw                          false                                    Pool
plsql.gateway.mode                   proxied                                  Pool
restEnabledSql.active                false                                    Pool
security.requestValidationFunction   wwv_flow_epg_include_modules.authorize   Pool
Konfiguration anpassen / tunen

Was lässt sich konfigurieren:

./ords --config C:\srv\ords config info

z.B. Pool Größen anpassen mit jdbc.MaxLimit auf 50 ,jdbc.MinLimit auf 10 ,jdbc.InitialLimit auf 10:

./ords --config C:\srv\ords config set jdbc.MaxLimit 50
./ords --config C:\srv\ords config set jdbc.MinLimit     10
./ords --config C:\srv\ords config set jdbc.InitialLimit 10

SSL Proxy Konfiguration hinterlegen

./ords --config C:\srv\ords  config set security.httpsHeaderCheck "X-Forwarded-Proto: https"
./ords --config C:\srv\ords config set security.externalSessionTrustedOrigins "https://myapexserver.gpi.local"

War File unter Tomcat austauschen

War File austauschen als User Tomcat:

#tomcat stoppen!
sc tomcat9 stop
# ----
 
cp C:\oracle\product\ords.25.2\ords.war C:\srv\tomcat\webapps\ords.war
 
#prüfen
ls C:\srv\tomcat\webapps\ords.war
Prüfen ob der Config Pfad hinterlegt ist

Beim Start des Tomcat prüfen, tomcat9w.exe starten und prüfen ob im Service der Pfad auch angegeben ist!

-Dconfig.url=C:\srv\ords


Der erste APEX Aufruf und die Probleme damit

Wie immer nach einer ORDS Installation gibt es kleine bis größere Ärgernisse mit dem Produkt.

Erster Aufruf Internal Workspace über Landing Page

Der Link auf den APEX Workspace unter https://oracledb23c01.pipperr.local/ords/_/landing ist in einer frischen, leeren APEX Umgebung ärgerlicherweise zu Beginn leer.

Also in einer anderen Umgebung die Syntax suchen und den Link sich statisch merken.

Ein „/ords/f?p=4000“ wird dann zu folgender URL:

https://oracledb23c01.pipperr.local/ords/r/apex/workspace-sign-in/oracle-apex-sign-in

oder direkt auf den INTERNAL Workspace springen mit „apex_admin“

 https://myapexserver.gpi.local/ords/apex_admin

Mit der kann man sich nun auf den INTERAL Workspace anmelden, nach dem Anlegen eines Workspace klappt es dann auch mit der Landing Page.

Warum so was dann nicht einfach gleich klappt .. schade… so wird die gute Idee mit der Landing Page gleich wieder für den Kunden eher verwirrend.

Fehler HTTP Status Code: 404 beim ersten Aufruf

Beim ersten Aufruf von https://myapexserver.gpi.local/ords/apex_admin erhalten ich leider einen „HTTP Status Code: 404 - Die Anforderung konnte keiner Datenbank zugeordnet werden. Stellen Sie sicher, dass die Anforderungs-URL richtig ist und dass Zuordnungen zwischen URL und Datenbank korrekt konfiguriert wurden“

Prüfen ob der ORDS sich in der DB anmelden konnte über die v$session der Zieldb.

SELECT * FROM v$session WHERE username IS NOT NULL;

Tauch hier der ORDS nicht auf, passt was mit der DB Verbindung nicht, im ersten Schritt Tomcat neu starten und genau prüfen ob das Konfig Verzeichnis auch auf C:\srv\ords gesetzt ist „Parameter -Dconfig.url=C:\srv\ords“!

Fehler HTTP Status Code: 500 beim zweiten Aufruf

der ORDS kann sich an der DB anmelden, ORDS_PUBLIC_USER Sessions sind in der Ziel DB Sichbar, aber wir erhalten noch einen HTTP 500 beim Aufruf von https://myapexserver/ords/apex_admin.

Im Log unter C:\srv\tomcat-9.0.111\logs\catalina.2025-11-05.log

05-Nov-2025 14:39:07.356 WARNUNG [http-nio-8080-exec-1] oracle.dbtools.common.logging.JDKLogSink.record PL/SQL Gateway mode of pool |default|lo| is set to proxied but ORDS could not read the proxy configuration from the database
	oracle.dbtools.url.mapping.db.DatabaseURLMappingBase$PlsqlGatewayConfigurationException: PL/SQL Gateway mode of pool |default|lo| is set to proxied but ORDS could not read the proxy configuration from the database


 A trailer fields supplier may not be set for this response. Either the underlying protocol does not support trailer fields or the protocol requires that the supplier is set before the response is committed]]

Auf Proxy Configuration im nginx in der Server Section achten:

proxy_http_version 1.1;
chunked_transfer_encoding on;

Fehler ERR_TOO_MANY_REDIRECTS

auf folgenden Paramter in der nginx achten:

proxy_set_header X-Forwarded-Proto https;

Bzw. http falls unter Port 80 gesetzt!

Fehler 413 Request Entity Too Large

Der Fehler 413 Request Entity Too Large kommt vom Reverse Proxy nginx, wenn die hochgeladene Anfrage (z. B. Datei-Upload oder POST-Body) größer ist als die erlaubte Maximalgröße.

client_max_body_size 100M;

Fehler 571 beim laden CSS aus "Static Files"

Meldung: HTTP 571

Der Datenbankbenutzer für den Verbindungspool |default|lo| kann das Schema GPI nicht als Proxy verwenden. Möglicherweise ist eine Einschränkung der maximalen Anzahl an Datenbanksessions konfiguriert, oder ein Autorisierungsfehler liegt vor.

Lösung:

ALTER USER GPI  GRANT CONNECT THROUGH ORDS_PUBLIC_USER;

Problem The request cannot be processed because it failed cross origin request validation

Problem:

If ords is being reverse proxied ensure the front end server is propagating the host name, scheme and port correctly. If using mod_proxy ensure ProxyPreserveHost is set to On. If using SAML with Oracle APEX, ensure security.externalSessionTrustedOrigins is correctly configured. If using a RESTful Service ensure the Origins Allowed value is correctly configured

This resource does not support Cross Origin Sharing requests, or the request Origin is not authorized to access this resource. 

The request cannot be processed because it failed cross origin request validation 

HTTP_TRUSTED_ORIGINS List of remote HTTP origins that can access resources, separated by newline. Set this parameter in combination with the ORDS parameter security.externalSessionTrustedOrigins. ⇒ https://docs.oracle.com/en/database/oracle/apex/24.1/aeapi/APEX_INSTANCE_ADMIN.Available-Parameter-Values.html

Lösung:

BEGIN
    apex_instance_admin.set_parameter(
        p_parameter => 'HTTP_TRUSTED_ORIGINS',
        p_value     => 'https://myapexserver.gpi.local'
    );
END;
/

Nicht in AEPX 19 verfügbar!!

set JAVA_HOME=c:\srv\jdk-21.0.9
 
cd C:\oracle\product\ords.25.2\bin
ords --config C:\srv\ords  config set security.httpsHeaderCheck "X-Forwarded-Proto: https"
 
#und 
 
ords --config C:\srv\ords config set security.externalSessionTrustedOrigins "https://myapexserver.gpi.local"

Neu starten!

siehe auch ORDS Cross-Origin Resource Sharing (CORS) Feature and 403 Forbidden Error (Doc ID 2874872.1)


Quellen

Diese Website verwendet Cookies. Durch die Nutzung der Website stimmen Sie dem Speichern von Cookies auf Ihrem Computer zu. Außerdem bestätigen Sie, dass Sie unsere Datenschutzbestimmungen gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information
"Autor: Gunther Pipperr"
prog/oracle_apex_nginx_tomcat_ords_install_windows_server.txt · Zuletzt geändert: von gpipperr