Oracle 10.2 Fails to Startup with Windows Server 2003 After a Reboot

I spent all Friday trying to debug a problem with Oracle 10.2 starting up. I use Microsoft Virtual PC 2007 to virtualize Windows Server 2003, Oracle, and IIS 6 and I could not get Oracle to come up clean after a reboot of my server. The symptom – connect as SYS (sysdba) and the instance reports being idle.

Here’s what shows up in the oradim.log:

Mon Mar 31 10:38:58 2008
C:\oracle\product\10.2.0\db_1\bin\oradim.exe -startup -sid josaims -usrpwd * -log oradim.log -nocheck 0
Mon Mar 31 10:38:58 2008
ORA-12560: TNS:protocol adapter error

 What threw me for a loop was the ORA-12560 error pointing at listener or low level protocol errors. The solution for me turned out to be a fortunate blog post: Oracle Service Doesn’t Autostart The Instance in MS SERVER 2003R2?

Note – since I initially posted this, I discovered that this does not start the batch file at boot – it actually starts it when a user logs in. 

I’m still using the batch file, but I’m now using a utility from the Windows 2003 Resource Kit:

How to Run a Batch File Before Logging on to Your Computer

I needed to create a cmd interpreter batch file to start up the instance manually as follows:

@echo off
sleep 60
set ORACLE_SID=josaims
echo set echo on > %0.tmp
echo connect sys/password as sysdba; >> %0.tmp
echo startup; >> %0.tmp
echo exit; >> %0.tmp
sqlplus /nolog @%0.tmp
del %0.tmp

This file was placed on my Server 2003 file system and pointed to in the registry at the following key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

Now Oracle starts the instance on a reboot. 

What is going on here? My guess is that the Oracle instance service is starting up when networking hasn’t been fully configured in Windows Server 2003. The TNS protocol adapter error is the result since it isn’t a permanent error once the server responds to command line interpreter commands.