Oracle DR: Fix service start hang - don't start stopped service

Critical fix for service preservation:

Problem:
- After cleanup, Oracle service is stopped
- Start-Service attempts to start the instance automatically
- Without database files, service startup hangs indefinitely
- PowerShell Start-Service blocks waiting for service to start

Root Cause:
- Oracle service on Windows tries to auto-start the instance
- With no controlfile/database files, it cannot start
- Start-Service waits forever (user reported 25+ warnings)

Solution:
- Do NOT attempt to start the stopped service
- SQL*Plus can connect '/ as sysdba' even if service is stopped
- STARTUP NOMOUNT will manually start the instance
- This is the correct Oracle workflow for restore from zero

Windows SQL*Plus requirements:
✓ ORACLE_SID set (we set this)
✓ Service exists in registry (preserved after cleanup)
✓ ORACLE_HOME set (we set this)
✗ Service running NOT required for NOMOUNT startup

The service will naturally transition to Running state when
STARTUP NOMOUNT successfully starts the instance.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
Marius
2025-10-11 15:12:21 +03:00
parent 4256d5a914
commit e4df4c11d8

View File

@@ -88,6 +88,7 @@ $service = Get-Service -Name "OracleServiceROA" -ErrorAction SilentlyContinue
if ($service) {
Write-Host "[OK] Oracle service already exists, skipping creation (15s saved!)" -ForegroundColor Green
Write-Host " Service will be reused for this restore"
Write-Host " Note: Service status is $($service.Status) (OK - will be started by NOMOUNT)"
} else {
Write-Host " Oracle service not found, creating from PFILE..."