Fix DMPDIR handling and datafile auto-detection for ROA Windows setup

- New-OracleDirectory: Improved verification with direct SQL check, preserves
  existing DMPDIR path instead of blindly recreating
- Get-DatafilePath: Better fallback logic using ORACLE_HOME to derive path,
  no longer hardcodes C:\app\oracle
- grants-public.sql: Fixed DMPDIR creation - now preserves existing path
  instead of overriding with wrong D:\Oracle\admin\ORCL\dpdump
- config.example.ps1: Added DATAFILE_DIR parameter with documentation

These fixes ensure scripts work without manual intervention on fresh Oracle XE
installations where default DMPDIR points to non-existent paths.

Tested on VM 302 - full installation (01-08) now completes successfully.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Marius
2026-01-29 02:38:54 +02:00
parent 709c822e38
commit f50bfcf8d8
3 changed files with 96 additions and 49 deletions

View File

@@ -274,12 +274,22 @@ GRANT SELECT ON CONTAFIN_ORACLE.VDEF_PROGRAME_SERII TO CONTAFIN_ORACLE;
PROMPT [8/9] Granting directory and system permissions...
-- Create DMPDIR directory if it doesn't exist (adjust path as needed)
-- DMPDIR directory should already exist (created by 01-setup-database.ps1)
-- Only grant permissions here - don't override the path
-- If DMPDIR doesn't exist, create with standard path C:\DMPDIR
DECLARE
v_count NUMBER;
BEGIN
EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY DMPDIR AS ''D:\Oracle\admin\ORCL\dpdump''';
SELECT COUNT(*) INTO v_count FROM dba_directories WHERE directory_name = 'DMPDIR';
IF v_count = 0 THEN
EXECUTE IMMEDIATE 'CREATE DIRECTORY DMPDIR AS ''C:\DMPDIR''';
DBMS_OUTPUT.PUT_LINE(' Created DMPDIR directory (C:\DMPDIR)');
ELSE
DBMS_OUTPUT.PUT_LINE(' DMPDIR directory already exists - preserving existing path');
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Note: DMPDIR directory may already exist or path needs adjustment');
DBMS_OUTPUT.PUT_LINE('Note: DMPDIR ' || SQLERRM);
END;
/