Create Database   «Prev  Next»

Lesson 3 Creating a new Oracle service on Windows
Objective Create a new Windows service for the COIN database

Creating new Oracle Service using the Oradim utility

The Oradim utility is a command-line tool used on Windows to manage Oracle services, including the Oracle database, listeners, and Oracle Instance-related services. This tool is especially useful for creating, modifying, or deleting Oracle services on Windows. Here’s the process for creating a new Oracle Service using the Oradim utility:
Steps for Creating a New Oracle Service using Oradim:
  1. Open Command Prompt with Administrative Privileges:
    • You need administrative privileges to create and manage services. Right-click on Command Prompt and choose Run as Administrator.
  2. Run the Oradim Command:
    • Use the oradim command to create a new Oracle service. Below is the general syntax:
              oradim -new -sid <SID> -startmode <AUTO | MANUAL> [-pfile <file_name>]
              
    • Here’s a breakdown of the parameters:
      • -new: This specifies that you're creating a new service.
      • -sid <SID>: The SID (System Identifier) of the new Oracle instance. For example, if your Oracle SID is ORCL, use -sid ORCL.
      • -startmode <AUTO | MANUAL>: Specifies whether the Oracle instance should start automatically when the Windows service starts. Use AUTO for automatic start and MANUAL for manual start.
      • -pfile <file_name> (Optional): Specifies the location of the parameter file (init<SID>.ora) for the Oracle instance. If you omit this option, the default parameter file is used.
  3. Example of Creating an Oracle Service:
    • Let's create a new Oracle service for a database with the SID ORCL, set it to start automatically, and specify a parameter file:
              oradim -new -sid ORCL -startmode AUTO -pfile C:\oracle\admin\ORCL\pfile\initORCL.ora
              
    • -sid ORCL: The SID is set to ORCL.
    • -startmode AUTO: The instance will start automatically when the service starts.
    • -pfile C:\oracle\admin\ORCL\pfile\initORCL.ora: Specifies the location of the Oracle parameter file.
  4. Verify the Service:
    • After running the command, you can verify that the service has been created by checking the Windows Services panel:
      • Open the Services panel (services.msc).
      • Look for a new service named something like OracleServiceORCL, where ORCL is the SID you provided.
    • Alternatively, you can check the status of the Oracle service via the command line:
              sc query OracleServiceORCL
              
  5. Starting and Stopping the Service:
    • To start the Oracle service manually (if MANUAL mode was chosen or for any reason the service is not running), you can run:
              net start OracleServiceORCL
              
    • To stop the service, use:
              net stop OracleServiceORCL
              

Optional Parameters for Oradim:
You can add more options when creating an Oracle service, depending on your requirements:
  • -intpwd <password>: Specifies the password for the Oracle instance's internal or privileged users (e.g., SYS).
  • -maxusers <number>: Sets the maximum number of user processes that can connect to the instance.
  • -spfile: Instead of using a parameter file (pfile), you can use a server parameter file (spfile) if your Oracle instance is configured to use one.
  • -log <log_file>: Specifies a log file to which Oradim writes output.

Example with Additional Parameters:
oradim -new -sid ORCL -startmode AUTO -intpwd password123 -pfile C:\oracle\admin\ORCL\pfile\initORCL.ora -log C:\oracle\logs\oradim.log
  • In this example, an Oracle instance `ORCL` is created, set to start automatically, an internal password is provided, and the actions are logged in `oradim.log`.

Summary: For the following list of 4 elements, put the elements in a HTML ordered list .
  1. Open Command Prompt as Administrator.
  2. Run the oradim command with appropriate options to create a new Oracle service.
  3. Verify the service in the Services panel or via the command line.
  4. Optionally, start and stop the service using the net start and net stop commands.

This process will successfully create and configure a new Oracle service for your database instance on a Windows OS environment.

Oracle 19c DBA on AWS
On a Windows system, the Oracle background processes (DBW0, LGWR, as well as other processes) all run as one Windows service. Before you can start a new instance and execute the CREATE DATABASE statement that you just wrote, you must first create a new service for that instance. Oracle8 database provides a utility named ORADIM for this purpose. ORADIM is not Windows based, so you need to run it from the Windows command prompt. The following diagram explains the syntax to use when you create a new instance:
ORADIM: Is the command, and is different for different releases of Oracle
Oracle Database command script for creating a new service using ORADIM. Here’s the printed script based on the image:
ORADIM -NEW {-SID sid | -SRVC service}
          [-INTPWD password] [-MAXUSERS integer]
          [-STARTMODE auto|manual] [-PFILE filespec]
          [-TIMEOUT seconds]
This command is used to create a new Oracle database instance service or modify an existing one using ORADIM, which is specific to Windows environments for managing Oracle databases. Let me know if you need further details or explanations about this script!
  1. ORADIM: Is the command, and is different for different releases of Oracle. In Oracle8i (8.1.5), the command is simply ORADIM. In Oracle 8.0.x, the command is ORADIM80.
  2. Tells ORADIM that you are creating a new instance, as opposed to removing or modifying an existing one.
  3. SID sid: Specifies the SID name for the new instance.
  4. SRVC: Specifies the service name for the new instance. You must use either -SID or -SRVC, but not both. In this course we will use -SID
  5. INTPWD: Specifies the internal password for the new instance. This is optional, and you don't need to do this now.
  6. MAXUSERS integer: Reserves space for the specified number of database users.
  7. STARTMODE auto manual: Controls whether or not the service starts automatically (a) when Windows NT boots. A value of “auto” results in an automatic startup, while a value of “manual” requires you to manually start the service.
  8. PFILE filespec: Points to your database parameter file (the initialization file).
  9. TIMEOUT: This is in seconds, and controls the amount of time that is allowed to pass before ORADIM gives up on trying to create the service.

Using ORADIM to Administer an Oracle Database Instance

ORADIM is a command-line tool that is available with Oracle Database. You are required to use ORADIM only if you are manually creating, deleting, or modifying databases. Database Configuration Assistant is an easier tool to use for this purpose. The following sections describe ORADIM commands and parameters. Note that each command is preceded by a dash (-). To get a list of ORADIM parameters, enter:
oradim -? | -h | -help

Note: Specifying oradim without any options also returns a list of ORADIM parameters and descriptions. When you use ORADIM, a log file called oradim.log opens in
ORACLE_HOME\database, 

or in the directory specified by registry parameter ORA_CWD. All operations, whether successful or failed, are logged in this file. You must check this file to verify success of an operation.
If you have installed an Oracle Database service on Windows, then when logging in as SYSTEM user (LocalSystem), with startup mode set to Automatic, it is possible that the Oracle Database service starts but the database does not start automatically. The following error message is written to file ORADIM.LOG in directory ORACLE_HOME\database:
ORA-12640: Authentication adapter initialization failed

Oracle Enterprise Management Agent, Oracle Enterprise Manager Management Server and Oracle Internet Directory may also fail, because they cannot connect to the database for the same reason. The workarounds are:
  1. Modify SQLNET.ORA
    You can modify SQLNET.ORA, either by removing the line
    sqlnet.authentication_services=(NTS)
    or by changing it to
    sqlnet.authentication_services=(NONE)
    
  2. Start the database after the service starts
    You can start the database manually after the Oracle Database service has started, using SQL*Plus and connecting as SYSDBA.
  3. Start the service as a specific user

  • Services control panel
    In this lesson's exercise, you will create the instance for your new database. After completing the exercise, you will open up the Services control panel to look at your new service. In case you arenot familiar with the Services control panel, the following simulation shows you how to open it, and how to find the services related to Oracle8.
  • Find Oracle Services
    1. To get to the services control panel, first click the Start button.
    2. Next, go down towards the bottom of the Start menu, and click Settings.
    3. Open the control panel by clicking the Control Panel menu item.
    4. A window will open showing you the various NT control panel applications. We are interested in the one named Services, so double-click on that one.
    5. The Services control panel opens. Services are displayed in alphabetical order. We have scrolled down to the Oracle services for you. The one of interest to us is named OracleServicecoin. That is the service you just created by using the ORADIM command. The status should be started, and the startup mode should be automatic. This is the end of the simulation.

Create Oracle Service - Exercise

Now, go on to the exercise to create a service for your database, and open the services control panel on your own.
Create Oracle Service - Exercise

SEMrush Software 3 SEMrush Banner 3