Search notes:

oradim

oradim is a command line tool that is used to manage Oracle instances and services and services on Windows, specifically to create such services or starting up instances.
Some common command options include
Messages are not printed to stdout, rather, they're directed to a log file located under $env:ORAHOME\database\oradim.log.

Create an instance

-NEW
  [-SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid | -SRVC srvc | -ASMSRVC srvc | -MGMTDBSRVC srvc | -IOSSRVC srvc | -APXSRVC srvc]
  [-SYSPWD    pass]
  [-STARTMODE auto|manual]
  [-SRVCSTART system|demand]
  [-PFILE     file | -SPFILE]
  [-MAXUSERS  maxusers]
  [-SHUTMODE  normal|immediate|abort]
  [-TIMEOUT   secs]
  [-RUNAS     osusr/ospass]

Edit an instance

-EDIT -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid
 [-SYSPWD pass]
 [-STARTMODE auto|manual]
 [-SRVCSTART system|demand]
 [-PFILE file | -SPFILE]
 [-SHUTMODE normal|immediate|abort]
 [-SHUTTYPE srvc|inst]
 [-RUNAS osusr/ospass]

Delete instances

-DELETE -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid| -SRVC srvc | -ASMSRVC srvc | -MGMTDBSRVC srvc | -IOSSRVC srvc | -APXSRVC srvc

Start up services and/or instances

-STARTUP -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid
[-SYSPWD pass]
[-STARTTYPE srvc|inst|srvc,inst]
[-PFILE filename | -SPFILE]
Start both, the instance and its corresponding service:
PS P:\ora> oradim -startup -sid ORA19 -starttype srvc,inst
Specify password (here: pwfilePw/42) as well (when using password file):
PS P:\ora> oradim -startup -sid ORA19 -starttype srvc,inst -syspwd pwFilePw/42
See also the simple orastart script to start an instance and listener.

Shut down services and/or instances

-SHUTDOWN
-SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid
[-SYSPWD pass]
[-SHUTTYPE srvc|inst|srvc,inst]
[-SHUTMODE normal|immediate|abort]
$env:ORACLE_SID='ORA19'
Connecting to a database/instance:
PS P:\ora> sqlplus / as sysdba
…
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
…
Stop the instance:
PS P:\ora> oradim -shutdown -sid $env:ORACLE_SID -shuttype inst -shutmode immediate
Instance is stopped («idle»):
PS P:\ora> sqlplus / as sysdba
…
Connected to an idle instance.
Although the instance is stopped, the corresponding Oracle service is still running:
PS P:\ora> (get-service OracleService$env:ORACLE_SID).status
Running
Use -shuttype srvc to stop the service as well. Note that using -shutmode does not make sense when stoping a service.
PS P:\ora> oradim -shutdown -sid $env:ORACLE_SID -shuttype srvc
PS P:\ora> (get-service OracleService$env:ORACLE_SID).status
Stopped
Trying to connect to database again:
PS P:\ora> sqlplus -L / as sysdba
…
ERROR:
ORA-12560: TNS:protocol adapter error
…
SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

Manipulate ACLs

-ACL -setperm|-addperm|-removeperm  dbfiles|diag|registry
-USER username
-OBJTYPE file|dir|registry
-OBJPATH object-path
-RECURSE true|false
[-HOST hostname]

Manipulate FAMILY settings

-FAMILY -set|-delete value [-SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid ]

Wrapper for Win32 API

oradim -ex can be used as direct wrapper for some functions of the Win32 API:
s[ervice] [\\node] new    SrvcName Executable [<auto/manual/disabled>] [<user>] [<pass>]
s[ervice] [\\node] edit   SrvcName [<auto/manual/disabled>] [<user>] [<pass>]
s[ervice] [\\node] delete SrvcName
s[ervice] [\\node] start  SrvcName [<args...>]
s[ervice] [\\node] stop   SrvcName
s[ervice] [\\node] enum [with ImageName]
s[ervice] [\\node] query SrvcName

r[egistry] [\\node] get   [HKLM]|HKCU path_to_value
r[egistry] [\\node] setdw|setsz|setmsz|setesz [HKLM]|HKCU path_to_value values
r[egistry] [\\node] del   [HKLM]|HKCU path_to_value
r[egistry] [\\node] dump  keys|[values] [HKLM]|HKCU path
r[egistry] [\\node] key create|delete|defined [HKLM]|HKCU path_to_value

n[etwork] [\\node] groupAdd group_name ["group comment"]
n[etwork] [\\node] userAdd group_name user_name ["group comment"]
n[etwork] [\\node] groupDelete group_name
n[etwork] [\\node] userDelete group_name user_name

v[mmap] pid

d[osdevice] create|delete|query [link] [target]
Display Oracle services in $ORACLE_HOME in PowerShell.
#
#  Needs to be run as administrator, probably.
#
oradim -ex services enum with image | findstr.exe /il $env:oracle_home

See also

Error message ORA-01031: insufficient privileges when starting an instance.

Index