Hi,
I will explain ORADIM Utility in Oracle Database and Create Oracle Instance for Windows Environment in this post.
You can read the following post to learn how to install Oracle 19c installation.
Oracle Database 19c on Linux 7.6 Step by Step Installation -2
ORADIM is an utility of Oracle that is used to create an instance, stop and start database services via command line on Windows environment.
ORADIM utility is used in Oracle database services on Windows environment.
You can perform the following actions using ORADIM utility.
- Create an Oracle instance on WINDOWS
- Stop Oracle Instance
- Start Oracle Insance
ORADIM Syntax
oradim [-NEW -SID SID] | -SRVC service_name | -ASMSID SID | -ASMSRVC service_name [-SYSPWD password][-MAXUSERS number][-STARTMODE auto | manual] [-SRVCSTART system | demand] [-PFILE filename | -SPFILE] [-SHUTMODE normal | immediate | abort] [-TIMEOUT secs] [-RUNAS osusr[/ospass]]
You can create an Oracle Instance using ORADIM as follows.
C:\>oradim -new -sid MSDBA -syspwd mgrMSDBA -startmode auto -pfile C:\app\product\12.1.0.2\dbhome_1\dbs\init_MSDBA.ora;
You can shutdown the existing instance using oradim as follows.
oradim -SHUTDOWN -SID SID | -ASMSID SID [-SYSPWD password] [-SHUTTYPE srvc | inst | srvc,inst] [-SHUTMODE normal | immediate | abort] C:\> oradim -shutdown -sid MSDBA
You can startup the existing instance using oradim as follows.
oradim -STARTUP -SID SID | -ASMSID SID [-SYSPWD password] [-STARTTYPE srvc | inst | srvc,inst] [-PFILE filename | -SPFILE]
C:\> oradim -STARTUP -SID puma -STARTTYPE inst -PFILE C:\app\username\admin\prod\pfile\init.ora
You can delete the existing Oracle Instance or service as follows.
oradim -DELETE -SID SID | -ASMSID SID | -SRVC service_name | -ASMSRVC service_name
C:\> oradim -DELETE -SID MSDBA
You can edit the existing instance using oradim as follows.
oradim -EDIT -SID SID | -ASMSID SID [-SYSPWD password] [-STARTMODE auto | manual] [-SRVCSTART system | demand] [-PFILE filename | -SPFILE][SHUTMODE normal | immediate | abort] [SHUTTYPE srvc | inst | srvc,inst]
C:\> oradim -EDIT -SID MSDBA -PFILE C:\app\product\12.1.0.2\dbhome_1\dbs\init_MSDBA.ora;
Now let’s go to make examples with ORADIM.
You can encounter with the following error during Instance creation
C:\>oradim -new -sid MSDBA -syspwd mgrMSDBA -startmode auto -pfile C:\app\product\12.1.0.2\dbhome_1\dbs\init_MSDBA.ora; OPW-00001: Unable to open password-file DIM-00014: Cannot open the Windows NT Service Control Manager. O/S-Error: (OS 5) Access is denied.
This error is related with permission, to solve this error, Run the CMD as Administrator on Windows.
When you run the CMD as Administrator mode, Oracle instance will be created as follows.
C:\>oradim -new -sid MSDBA -syspwd mgrMSDBA -startmode auto -pfile C:\app\product\12.1.0.2\dbhome_1\dbs\init_MSDBA.ora; Instance created. C:\>
Now you can connect to SQLPLUS, and startup Oracle instance in nomount mode as follows.
C:\>set ORACLE_SID=MSDBA C:\>sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Wed May 05 14:16:09 2018 Copyright (c) 1982, 2010, Oracle. All rights reserved. SQL> SQL> connect sys/mgrMSDBA as sysdba Connected to an idle instance. SQL> SQL> startup nomount pfile='c:\app\product\12.1.0.2\dbhome_1\dbs\init_MSDBA.ora' ORACLE instance started. Total System Global Area 1068937216 bytes Fixed Size 2182592 bytes Variable Size 616563264 bytes Database Buffers 444596224 bytes Redo Buffers 5595136 bytes SQL>
When you startup Oracle instance in nomount mode, you can restore any database backup to this Oracle Instance, you can read the following post to learn how to do it.
https://ittutorial.org/oracle-rman-recovery-manager-restore-recover-tutorials-4-restore-database-recover-database/
Or you can create the fresh database as follows.
You can create a new database as follows.
SQL> CREATE DATABASE MSDBA LOGFILE group 1 ('C:\app\oradata\MSDBA\redo1.log') size 10M, group 2 ('C:\app\oradata\MSDBA\redo2.log') size 10M, group 3 ('C:\app\oradata\MSDBA\redo3.log') size 10M CHARECTER SET WE8ISO8859P1 NATIONAL CHARACTER SET utf8 DATAFILE 'C:\app\oradata\MSDBA\system.dbf' size 50M autoextend on next 10M maxsize unlimited extent management local SYSAUX datafile 'C:\app\oradata\MSDBA\sysaux.dbf' size 10M autoextend on next 10M maxsize unlimited UNDO TABLESPACE undotbs1 datafile 'C:\app\oradata\MSDBA\undo.dbf' size 10M DEFAULT TEMPORARY TABLESPACE temp tempfile 'C:\app\oradata\MSDBA\temp.dbf' size 10M; Database created. SQL> SQL>@C:\app\product\12.1.0.2\dbhome_1\RDBMS\ADMIN\catalog.sql SQL>@C:\app\product\12.1.0.2\dbhome_1\RDBMS\ADMIN\catproc.sql SQL>@C:\app\product\12.1.0.2\dbhome_1\RDBMS\ADMIN\pupbld.sql
You can read the following post to learn how to create a database manually.
https://ittutorial.org/how-to-create-a-database-manually-and-how-to-create-a-database-using-dbca-silent-mode-in-oracle/