How to Control Program Startup Sequence on Windows Most UNIX/Linux users know how to let the system run shell scripts in correct order on system bootup. It's not well known how to do this on Windows. Windows allows you to set "primitive" dependency among different services. But one limitation is that OS service dependency check is rarely sufficient for the parent service to be fully ready and functional; child service usually needs to wait longer. Second, you can't easily change your own script (.bat, .vbs, .pl, etc.) into a service. Questions related to Windows service startup sequence and dependency often come in like this. > Is is possible to create automatic startup of 9ias using the Services > only (i.e. without starting any components from the command prompt or > from the EM website)? > If yes, what is the right order of starting the services? > I have the Infrastructure and MidTier on the same machine. > If what i'm asking can't be done, does anyone have any good ways used > to automate the startup of 9ias. This is a frequently asked question. We know that OID relies on iasdb and the midtier startup relies on OID. But iasdb could startup too late, due to e.g. earlier unclean shutdown. We need to delay OID startup. Metalink Note:158983.1 and Note:216269.1 suggest creating a separate service to achieve this goal. I think that's an overkill. Not many people are aware of the method Windows starts up services or runs programs in specified order on reboot (although the way UNIX achieves this is well known). Try this to see if it works for you. 1. Change OID service startup type from Automatic to Manual. 2. Create a file start_oidsvc.bat, which contains something like this: rem Hope a minute is enough for iasdb to recover (if needed); sleep 60 set ORACLE_HOME=D:\Oracle\product\10.1.4\oid set ORACLE_SID=iasdb set PATH=%ORACLE_HOME%\ldap\bin;%ORACLE_HOME%\bin;%PATH% oidmon start oidctl connect=iasdb server=oidldapd instance=1 start where sleep.exe can be found on the Internet, and psexec.exe from sysinternals.com. Make sure they're in %PATH%. Note that the above commands oidmon and oidctl are run by the system at startup. (If you run them interactively as you, prepend with "psexec -s -d" to run as Local System so the processes won't exit after you log off. Psexec is from sysinternals.com.) 3. Create a shortcut start_oidsvc.lnk under C:\windows\system32\GroupPolicy\Machine\Scripts\Startup pointing to your start_oidsvc.bat. 4. Add the shortcut to the Local Computer Policy startup script folder. That is, run command gpedit.msc. Go to Local Computer Policy | Computer Configuration | Windows Settings | Scripts (Startup/Shutdown) | Startup. Click Show Files button to make sure the shortcut is shown. Click Add to add the shortcut to the Scripts window (selecting the shortcut changes the filename display to the real target file start_oidsvc.bat). ******************************************************************************** One anomaly. C:\WINDOWS\system32\grouppolicy folder is not created until you launch gpedit.msc once. C:\WINDOWS\system32\GroupPolicy\Machine\Scripts is not created until you navigate to Windows Settings inside GPEdit. ******************************************************************************** Unfortunately we're not taking advantage of Windows's capability of running scripts in order, because once iasdb service is started, it's hard to determine when it's fully ready. But feel free to write a script to login and select from dual to make sure it's ready, if you don't want to rely on sleep 60 in your start_oidsvc.bat. To test, create a big transaction in iasdb. Kill the database process in task manager (or shutdown abort from another session). Reboot and check for "Beginning crash recovery of 1 threads" in alert.log. And make sure you see process hierarchy like this oidservice.exe (3040) oidldapd.exe (2896) oidldapd.exe (892) in indented format with `tlist -t' or `pslist -t'. Yong Huang