oracledba.help
Windows

Oracle Services on Windows

<- Windows

Overview

There are instances when you may need to recreate the database and listener services on an existing Windows database system. One such instance is finding that Oracle on Windows is much more stable using the local Windows Administrator account rather than a domain or other account. Others include exporting to a UNC path, fixing OEM (dbconsole) etc.. What follows are the essential steps to achieve this.

Prerequisites

Backup the following directories:

 %ORACLE_HOME%\dbs
 %ORACLE_HOME%\database

You must be logged in as THE local Administrator account. Not an Administrator equivalent or Domain Administrator. This is very important.

Procedure

Replace MyInstanceName as required.

0. Shutdown Oracle services.
   - Set all services to start as "Local System" account (default).

1. Recreate Password File
   a. cd %ORACLE_HOME%\dbs
   b. del orapwMyInstanceName
   c. orapwd file=orapwMyInstanceName password=MySysPassword

2. Recreate Windows Database Instance 
   a. cd %ORACLE_HOME%\database

   b. Delete existing Oracle database service and files.
      oradim -delete -sid MyInstanceName
      del hc_MyInstanceName.dat
      del PWDMyInstanceName.ora
      - Ensure service not started and gone.

   c. oradim -new -sid MyInstanceName -intpwd MySysPassword -startmode AUTO -spfile

      Manually go and set your database instance service to "Manual" startup
      if not already set.  Note: using the AUTO option also starts the
      database service but is essential in creating a new service that will
      start the databse too (this is not documented well that I can see).

   d. Stop the database service. 

3. Drop then recreate the Listener service.

4. Start all database services.

purgeOraCfg.bat

@echo off
rem File: purgeOraCfg.bat
rem Change MySID to you SID name.

rem Confirmation
cls
echo About to Purge Oracle MySID Initial Cfg Files
echo.
echo Ensure all Oracle services stopped.
echo.
pause

rem Process
cd %ORACLE_HOME%\dbs
del %ORACLE_HOME%\dbs\orapwMySID

cd %ORACLE_HOME%\database
oradim -delete -sid MySID
del %ORACLE_HOME%\database\orapwMySID
del %ORACLE_HOME%\database\PWDMySID.ORA
del %ORACLE_HOME%\database\hc_MySID.dat

rem End
echo.
echo *** Process Ended ***
echo.