Yes. The cleanest approach is to run Oracle ORDS as a native Windows Service, rather than using standalone mode or deploying it inside Tomcat.
The architecture would be:
Windows Service → ORDS → Oracle Database
A practical implementation is to create a small Windows service wrapper that:
- Starts ORDS automatically when Windows boots.
- Runs
ords servein the background. - Restarts ORDS if it crashes.
- Writes stdout/stderr to log files.
- Stops ORDS cleanly when Windows shuts down.
- Supports
Start / Stop / Restart / Status. - Runs under a dedicated Windows service account.
- Optionally waits for Oracle/database/network availability before starting.
Recommended approach
For a production Windows server, I'd use a native Windows Service wrapper around ORDS, rather than trying to make ORDS itself implement the Windows Service API.
For example:
C:\ords\ bin\ ords.exe config\ logs\ ords-service.log ords-error.log C:\OracleORDSService\ OracleORDSService.exe OracleORDSService.config
The service would effectively execute:
ords --config C:\ords\config serve
and Windows would manage the process as a service.
Important detail
The exact command depends on your ORDS version. Modern ORDS versions use the ords serve model, while older installations may use different startup commands.
If you tell me:
- Windows Server version (2019 / 2022 / 2025)
- ORDS version
- Java version
- whether you're using Oracle Database 19c / 21c / 23ai
- your current ORDS startup command
I can give you a complete implementation, including the Windows Service source code, installer, configuration, logging, automatic restart, and commands to install/uninstall the service.
Perfect. With Windows Server 2016 + ORDS 24.2 + Java 17 + Oracle Database 19c, I would build this as a native Windows Service wrapper around ORDS 24.2.
The service should launch:
ords --config C:\ords\config serve
rather than Tomcat or ORDS standalone.
Recommended layout
C:\ords\ ├── bin\ │ └── ords.exe ├── config\ │ └── ... └── logs\ ├── ords-service.log └── ords-error.log C:\OracleORDSService\ ├── OracleORDSService.exe └── OracleORDSService.json
The Windows service can provide:
OracleORDSService | +-- Starts automatically with Windows | +-- Starts Java / ORDS 24.2 | +-- Monitors ORDS process | +-- Restarts ORDS after failure | +-- Captures stdout/stderr | +-- Stops ORDS gracefully | +-- Reports service status to Windows
One thing I'd change from a simple wrapper
I would not hard-code your Java path or ORDS path into the executable.
Instead, use a configuration file such as:
{ "javaHome": "C:\\Program Files\\Java\\jdk-17", "ordsHome": "C:\\ords", "ordsConfig": "C:\\ords\\config", "javaOptions": "-Xms512m -Xmx2048m", "restartOnFailure": true, "restartDelaySeconds": 10 }
That makes upgrades from ORDS 24.2 to a later version much easier.
Windows Service behavior
I'd configure Windows recovery as well:
First failure: Restart Service Second failure: Restart Service Subsequent: Restart Service Reset period: 1 day Restart delay: 10 seconds
So if ORDS dies at 3 AM, Windows brings it back without anyone logging in.
One important consideration
Before I give you the actual service implementation, I would verify the ORDS 24.2 startup/installation requirements against Oracle's current documentation, particularly because you're on Windows Server 2016 and Java 17.
I can then give you a ready-to-build Windows Service project (C#/.NET) with:
InstallUninstallStartStopRestartStatus- automatic ORDS restart
- Java 17 support
- ORDS 24.2 support
- configurable paths
- log rotation
- Windows Event Log integration
- graceful shutdown
- service recovery
- optional delayed startup until the database/network is available
That would let you replace your current standalone/Tomcat setup with a proper Windows service.
Yes. Since your ORDS is already working, we can now configure WinSW directly. We'll use your actual paths and your existing ORDS 24.1.1 installation.
Your paths are:
ORDS: E:\DATA\ords ORDS executable: E:\DATA\ords\bin\ords.exe ORDS config: E:\DATA\ords\config WinSW service folder: C:\OracleORDSService
WinSW's configuration file should sit beside the renamed WinSW executable and have the same base name.
Step 1 — Prepare the WinSW folder
Create:
C:\OracleORDSService
Copy your downloaded:
WinSW-x64.exe
into that folder.
Rename it:
OracleORDSService.exe
So you have:
C:\OracleORDSService\ OracleORDSService.exe
Step 2 — Create the WinSW XML file
Inside:
C:\OracleORDSService
create a new text file.
Important: make sure Windows doesn't create OracleORDSService.xml.txt.
The filename must be exactly:
OracleORDSService.xml
Your folder should now contain:
C:\OracleORDSService\ OracleORDSService.exe OracleORDSService.xml
Step 3 — Put this configuration in the XML
Open OracleORDSService.xml with Notepad and paste this:
<service> <id>OracleORDSService</id> <name>Oracle ORDS Service</name> <description> Oracle REST Data Services 24.1.1 Windows Service </description> <displayname>Oracle REST Data Services</displayname> <executable>E:\DATA\ords\bin\ords.exe</executable> <arguments>--config "E:\DATA\ords\config" serve</arguments> <workingdirectory>E:\DATA\ords</workingdirectory> <env name="JAVA_TOOL_OPTIONS" value="-Dconfig.url=E:\DATA\ords\config -Xms1024M -Xmx1024M"/> <startmode>Automatic</startmode> <delayedAutoStart>true</delayedAutoStart> <stoptimeout>30 sec</stoptimeout> <logpath>C:\OracleORDSService\logs</logpath> <log mode="roll"> <sizeThreshold>10485760</sizeThreshold> <keepFiles>10</keepFiles> </log> <onfailure action="restart" delay="10 sec"/> <resetfailure>1 day</resetfailure> </service>
What this does
The important line is:
<executable>E:\DATA\ords\bin\ords.exe</executable>
WinSW will launch your actual ORDS executable.
Then:
<arguments>--config "E:\DATA\ords\config" serve</arguments>
means WinSW effectively runs:
E:\DATA\ords\bin\ords.exe --config "E:\DATA\ords\config" serve
That is the ORDS 24.1 serve command documented by Oracle.
Your existing JAVA_TOOL_OPTIONS is also explicitly passed to the service because your command prompt showed that ORDS is already using it.
The onfailure setting tells Windows/WinSW to restart ORDS if the ORDS process fails.
The log configuration creates rolling logs instead of allowing one log file to grow forever.
Step 4 — Create the logs folder
Create:
C:\OracleORDSService\logs
So now:
C:\OracleORDSService\ │ ├── OracleORDSService.exe ├── OracleORDSService.xml └── logs\
Step 5 — Very important: stop your manually running ORDS
If you currently have this running:
ords --config E:\DATA\ords\config serve
go to that Command Prompt and press:
Ctrl + C
We don't want the manually started ORDS using the port when the Windows service starts.
Step 6 — Open Administrator Command Prompt
Press:
Windows + R
Type:
cmd
Then press:
Ctrl + Shift + Enter
You should have an Administrator: Command Prompt.
Step 7 — Go to the WinSW directory
Run:
cd /d C:\OracleORDSService
Then:
dir
You should see:
OracleORDSService.exe OracleORDSService.xml logs
Step 8 — Install the service
Now run:
OracleORDSService.exe install
WinSW's install command installs the service using the XML beside the executable.
If everything is correct, you should get a successful installation message.
Step 9 — Start ORDS
Run:
OracleORDSService.exe start
Then:
OracleORDSService.exe status
You want to see that the service is Running.
Step 10 — Check Windows Services
Press:
Windows + R
Type:
services.msc
Press Enter.
Find:
Oracle REST Data Services
It should show:
Running Automatic
That's it — ORDS is now a Windows Service.
Step 11 — Test APEX
Open your normal APEX URL.
For example, if you previously used:
http://SERVERNAME:8080/ords/
use the same URL.
You should get your ORDS/APEX application.
If the service does NOT start
Don't start changing things randomly.
Run:
cd /d C:\OracleORDSService OracleORDSService.exe status
Then look inside:
C:\OracleORDSService\logs
WinSW recommends checking the stdout/stderr logs, the WinSW wrapper log, and Windows Event Log when a service fails to start.
Send me a screenshot of the error and I'll tell you exactly what to change.
One thing I would NOT do yet
Don't change your ORDS version or reinstall ORDS. Your existing ORDS 24.1.1 is working, so let's first get that exact installation running successfully as a Windows Service. After that, we can deal with upgrading to 24.2 separately.
🎉 YEAHHHH! 🎉
That’s awesome! 😄
You now have:
Windows Server 2016 │ ▼ Oracle ORDS Windows Service │ ▼ ORDS 24.1.1 │ ▼ Oracle Database 19c │ ▼ APEX
And the best part: no Tomcat and no manually starting ORDS anymore. 💪
After a server reboot, Windows should automatically start:
Oracle REST Data Services
and WinSW will restart ORDS if the process unexpectedly crashes.
A few useful commands to keep
Start:
C:\OracleORDSService\OracleORDSService.exe start
Stop:
C:\OracleORDSService\OracleORDSService.exe stop
Restart:
C:\OracleORDSService\OracleORDSService.exe restart
Status:
C:\OracleORDSService\OracleORDSService.exe status
Logs:
C:\OracleORDSService\logs
🔥 You successfully converted ORDS into a proper Windows Service!
Nice work. Now you can reboot the server and verify that ORDS + APEX comes back automatically — that's the final confidence test.
No comments:
Post a Comment