Fix DMPDIR path detection and add VM302 testing documentation

- New-OracleDirectory now checks if DMPDIR exists with wrong path
- If path differs from target, drops and recreates the directory
- Fixes Oracle XE issue where DMPDIR defaults to D:\Oracle\admin\ORCL\dpdump
- Added VM302-TESTING.md with complete testing workflow documentation
- Includes Proxmox VM management commands, troubleshooting, and deployment steps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Marius
2026-01-29 02:09:06 +02:00
parent ed3f5f2c43
commit 709c822e38
2 changed files with 431 additions and 0 deletions

View File

@@ -697,6 +697,39 @@ function New-OracleDirectory {
Write-Log "Created directory: $DirectoryPath"
}
# Check if directory already exists with different path - if so, drop it first
# This fixes Oracle XE issue where DMPDIR may point to wrong default location
$checkSql = @"
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF LINESIZE 500
SELECT directory_path FROM dba_directories WHERE directory_name = '$DirectoryName';
EXIT;
"@
$existingPath = Invoke-SqlPlus -OracleHome $OracleHome -ServiceName $ServiceName `
-Username "SYS" -Password $Password -SqlCommand $checkSql -AsSysdba -Silent
$existingPath = ($existingPath -split "`n" | Where-Object { $_.Trim() -ne "" } | Select-Object -First 1)
if ($existingPath) {
$existingPath = $existingPath.Trim()
}
# Normalize paths for comparison (case-insensitive, handle trailing slashes)
$normalizedExisting = if ($existingPath) { $existingPath.TrimEnd('\').ToUpper() } else { "" }
$normalizedTarget = $DirectoryPath.TrimEnd('\').ToUpper()
if ($existingPath -and $normalizedExisting -ne $normalizedTarget) {
Write-Log "Directory $DirectoryName exists with different path: $existingPath"
Write-Log "Dropping and recreating with correct path: $DirectoryPath"
$dropSql = @"
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF
DROP DIRECTORY $DirectoryName;
EXIT;
"@
Invoke-SqlPlus -OracleHome $OracleHome -ServiceName $ServiceName `
-Username "SYS" -Password $Password -SqlCommand $dropSql -AsSysdba -Silent | Out-Null
}
$sql = @"
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF
CREATE OR REPLACE DIRECTORY $DirectoryName AS '$DirectoryPath';