| Lesson 3 | Creating a new Oracle service on Windows |
| Objective | Create and verify a Windows service for an Oracle AI Database 26ai instance |
CREATE DATABASE sequence from the previous lesson on a Windows host.
The following procedure assumes you have already prepared the initialization parameters and are ready to create the instance itself for a database such as COIN — this is exactly the point in the Lesson 2 sequence where you'd move from having a parameter file ready to running STARTUP NOMOUNT and, on Windows, that requires the instance's Windows service to exist first.
General syntax for creating a new service in Oracle AI Database 26ai on Windows:
oradim -new -sid <SID> -startmode {AUTO | MANUAL} [-pfile <parameter_file>] [-spfile] [-intpwd <password>] [-log <log_file>]
This is worth calling out directly because it's a mistake easy to make and easy to overlook: at this stage, always use -startmode MANUAL, even if you eventually want the instance to start automatically with Windows. Setting AUTO here causes the new service to immediately try starting and mounting a database that doesn't exist yet, since you haven't run CREATE DATABASE against it. You switch it to AUTO afterward, once the database actually exists — covered in step 5 below.
COIN).MANUAL – the correct choice when the service is first created; you start it yourself once the database exists.AUTO – starts the instance automatically when the Windows service starts; set this later, not at creation time.-pfile: traditional text init<SID>.ora file.-spfile: server parameter file spfile<SID>.ora located in the default directory.oradim.log is used by default).Assume your SID is COIN and you are using a text initialization file:
oradim -new -sid COIN -startmode MANUAL ^
-pfile C:\oracle\admin\COIN\pfile\initCOIN.ora ^
-log C:\oracle\logs\oradim-coin.log
OracleServiceCOIN.-startmode MANUAL was used, the service does not attempt to start or mount anything yet — you're free to proceed to CREATE DATABASE without the service racing ahead of you.oradim-coin.log.services.msc).sqlplus / as sysdba, run STARTUP NOMOUNT, and proceed with the CREATE DATABASE statement from the previous lesson.
With the database created and working, you can now safely change the service to start automatically whenever Windows restarts, using -EDIT rather than -NEW:
oradim -edit -sid COIN -startmode AUTO -srvcstart SYSTEM -spfile
SYSTEM here refers to the startup context, not a database password.AUTO becomes the right choice — the database exists now, so there's nothing left for the automatic mount attempt to fail against.You can manage the service from the command prompt:
net start OracleServiceCOIN
net stop OracleServiceCOIN
Or you can use the Services console to start, stop, or restart the service.
The syntax below summarizes the core options for creating and editing an Oracle Database service on Windows. The -NEW, -EDIT, -SID, -STARTMODE, -PFILE, and -SPFILE options are confirmed current for Oracle AI Database 26ai. For the complete, authoritative option list — including less commonly used flags — see the Oracle Database Platform Guide for Microsoft Windows, which is the canonical ORADIM reference and not part of the Oracle AI Database core documentation set covered elsewhere in this course.
oradim -new {-sid sid | -srvc service}
[-intpwd password] [-maxusers integer]
[-startmode {auto | manual}] [-pfile filespec | -spfile]
[-timeout seconds] [-log <log_file>]
oradim -edit -sid sid
[-startmode {auto | manual}] [-srvcstart {system | demand}]
[-pfile filespec | -spfile]
-startmode MANUAL; a database doesn't exist yet at this point, so AUTO causes a failed mount attempt.AUTO once the database has been created.COIN).-sid or -srvc, but not both.-edit to control the startup context once you're ready for automatic startup.initSID.ora).spfileSID.ora) instead of a text pfile.-EDIT step after the database exists, not at initial creation.To view ORADIM help and parameter descriptions:
oradim -?
oradim -h
oradim -help
ORADIM writes operational details to a log file named oradim.log in:
%ORACLE_HOME%\database
or in the directory specified by the registry parameter ORA_CWD. You should always check this log file to verify whether service creation or modification succeeded.
On Windows, Oracle Database commonly uses OS authentication via the setting:
SQLNET.AUTHENTICATION_SERVICES = (NTS)
If the database service starts under an account that doesn't have appropriate access — most often the Oracle Home User account discussed above, rather than the older LocalSystem convention — and networking or authentication is misconfigured, you may see:
ORA-12640: Authentication adapter initialization failed
Modern approaches to resolving this problem include:
sqlnet.oraSQLNET.AUTHENTICATION_SERVICES is set appropriately for your security model. For example, to allow OS authentication on Windows:
SQLNET.AUTHENTICATION_SERVICES = (NTS)
Only if you have a clear security design and do not require OS authentication would you consider:
SQLNET.AUTHENTICATION_SERVICES = (NONE)
Disabling OS authentication may simplify some configurations but should be evaluated carefully in regulated or enterprise environments.
sqlplus / as sysdba
STARTUP;
This is common in scripted or automated startup scenarios on Windows servers, including cloud-hosted Windows VMs.
After creating your service for the COIN database, verify its configuration using the Windows Services console:
-EDIT step.In hybrid environments, this step is useful for quickly verifying that your on-premises or Windows VM–based database is ready to serve connections alongside your cloud databases.