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:
@@ -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';
|
||||
|
||||
398
proxmox/lxc108-oracle/roa-windows-setup/test/VM302-TESTING.md
Normal file
398
proxmox/lxc108-oracle/roa-windows-setup/test/VM302-TESTING.md
Normal file
@@ -0,0 +1,398 @@
|
||||
# VM 302 - ROA Windows Setup Testing
|
||||
|
||||
## VM Information
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| VM ID | 302 |
|
||||
| Name | oracle-test-302 |
|
||||
| Hostname | ROACENTRAL |
|
||||
| IP Address | 10.0.20.130 |
|
||||
| RAM | 4 GB |
|
||||
| Disk | 500 GB |
|
||||
| OS | Windows 11 |
|
||||
| Oracle | 21c XE (CDB/PDB) |
|
||||
| Proxmox Host | pvemini (10.0.20.201) |
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Start VM (if stopped)
|
||||
|
||||
```bash
|
||||
# From any machine with SSH access to Proxmox
|
||||
ssh root@10.0.20.201 "qm start 302"
|
||||
|
||||
# Wait for boot (~2-3 minutes)
|
||||
ssh root@10.0.20.201 "qm status 302"
|
||||
```
|
||||
|
||||
### 2. Connect to VM
|
||||
|
||||
```bash
|
||||
# SSH (if OpenSSH installed)
|
||||
ssh romfast@10.0.20.130
|
||||
|
||||
# Or use RDP
|
||||
mstsc /v:10.0.20.130
|
||||
# User: romfast
|
||||
```
|
||||
|
||||
### 3. Run Tests
|
||||
|
||||
```powershell
|
||||
# PowerShell as Administrator
|
||||
cd C:\roa-setup
|
||||
.\RunAll.cmd
|
||||
```
|
||||
|
||||
### 4. Stop VM (when done)
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm shutdown 302"
|
||||
# Or force stop:
|
||||
ssh root@10.0.20.201 "qm stop 302"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Proxmox VM Management
|
||||
|
||||
### Check Status
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm status 302"
|
||||
```
|
||||
|
||||
### Start VM
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm start 302"
|
||||
```
|
||||
|
||||
### Graceful Shutdown
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm shutdown 302"
|
||||
```
|
||||
|
||||
### Force Stop
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm stop 302"
|
||||
```
|
||||
|
||||
### Access Console (via Proxmox GUI)
|
||||
|
||||
```
|
||||
https://10.0.20.201:8006 → VM 302 → Console
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Current Configuration
|
||||
|
||||
### Oracle Connection
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| Host | 10.0.20.130 |
|
||||
| Port | 1521 |
|
||||
| Service | XEPDB1 |
|
||||
| SYS Password | romfastsoft |
|
||||
| SYSTEM Password | romfastsoft |
|
||||
|
||||
```bash
|
||||
# SQL*Plus connection
|
||||
sqlplus sys/romfastsoft@10.0.20.130:1521/XEPDB1 as sysdba
|
||||
sqlplus system/romfastsoft@10.0.20.130:1521/XEPDB1
|
||||
sqlplus CONTAFIN_ORACLE/ROMFASTSOFT@10.0.20.130:1521/XEPDB1
|
||||
```
|
||||
|
||||
### ROA Users (after installation)
|
||||
|
||||
| User | Password | Purpose |
|
||||
|------|----------|---------|
|
||||
| CONTAFIN_ORACLE | ROMFASTSOFT | Common schema |
|
||||
| CAPIDAVATOUR | ROMFASTSOFT | Test company |
|
||||
|
||||
### DMP Files Available
|
||||
|
||||
```
|
||||
C:\DMPDIR\
|
||||
├── contafin_oracle_72001.dmp (276 MB)
|
||||
└── capidavatour_72001.dmp (76 MB)
|
||||
```
|
||||
|
||||
### Setup Directory
|
||||
|
||||
```
|
||||
C:\roa-setup\
|
||||
├── config.ps1 # Current configuration
|
||||
├── scripts\ # PowerShell setup scripts
|
||||
├── sql\ # SQL scripts
|
||||
├── par\ # Import parameters
|
||||
└── logs\ # Execution logs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing Workflow
|
||||
|
||||
### Full Installation Test
|
||||
|
||||
```powershell
|
||||
# 1. Uninstall existing ROA (if any)
|
||||
cd C:\roa-setup
|
||||
.\scripts\99-uninstall-roa.ps1 -SystemPassword "romfastsoft" -Force
|
||||
|
||||
# 2. Run full installation
|
||||
.\RunAll.cmd
|
||||
|
||||
# 3. Verify
|
||||
.\scripts\07-verify-installation.ps1
|
||||
```
|
||||
|
||||
### Individual Script Test
|
||||
|
||||
```powershell
|
||||
cd C:\roa-setup
|
||||
|
||||
# Use Run.cmd wrapper (handles ExecutionPolicy)
|
||||
.\Run.cmd 01-setup-database.ps1
|
||||
.\Run.cmd 02-create-sys-objects.ps1
|
||||
.\Run.cmd 03-import-contafin.ps1
|
||||
.\Run.cmd 04-create-synonyms-grants.ps1
|
||||
.\Run.cmd 05-import-companies.ps1
|
||||
.\Run.cmd 08-post-install-config.ps1
|
||||
.\Run.cmd 07-verify-installation.ps1
|
||||
```
|
||||
|
||||
### Reset for Fresh Test
|
||||
|
||||
```powershell
|
||||
# Complete uninstall (drops all ROA objects)
|
||||
.\scripts\99-uninstall-roa.ps1 -SystemPassword "romfastsoft" -Force
|
||||
|
||||
# This removes:
|
||||
# - CONTAFIN_ORACLE user
|
||||
# - CAPIDAVATOUR user (and any other company users)
|
||||
# - ROA tablespace
|
||||
# - Public synonyms
|
||||
# - SYS objects (AUTH_PACK, NEWSCHEMA, etc.)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Script Execution Order
|
||||
|
||||
| # | Script | Duration | Purpose |
|
||||
|---|--------|----------|---------|
|
||||
| 1 | 01-setup-database.ps1 | ~30s | Tablespace, profile, CONTAFIN_ORACLE user |
|
||||
| 2 | 02-create-sys-objects.ps1 | ~15s | AUTH_PACK, NEWSCHEMA, UTL_MAIL config |
|
||||
| 3 | 03-import-contafin.ps1 | ~2 min | Import CONTAFIN_ORACLE schema (344 objects) |
|
||||
| 4 | 04-create-synonyms-grants.ps1 | ~30s | 81 public synonyms + grants |
|
||||
| 5 | 05-import-companies.ps1 | ~3 min | Import CAPIDAVATOUR (3418 objects) |
|
||||
| 6 | 08-post-install-config.ps1 | ~1 min | 54 directories, SERVER_INFO |
|
||||
| 7 | 07-verify-installation.ps1 | ~15s | Verification report |
|
||||
|
||||
**Total: ~8 minutes for full installation**
|
||||
|
||||
---
|
||||
|
||||
## Expected Results
|
||||
|
||||
### After Successful Installation
|
||||
|
||||
```
|
||||
07-verify-installation.ps1 output:
|
||||
|
||||
=== ROA Installation Verification ===
|
||||
Tablespace ROA: OK
|
||||
User CONTAFIN_ORACLE: OK (344 objects)
|
||||
User CAPIDAVATOUR: OK (3418 objects)
|
||||
Public Synonyms: OK (81 synonyms)
|
||||
SYS Objects: OK (AUTH_PACK, NEWSCHEMA, etc.)
|
||||
ROAUPDATE Directories: OK (54 directories)
|
||||
SERVER_INFO: OK (configured)
|
||||
```
|
||||
|
||||
### Object Counts
|
||||
|
||||
| Schema | Objects | Tables | Procedures | Packages |
|
||||
|--------|---------|--------|------------|----------|
|
||||
| CONTAFIN_ORACLE | 344 | ~80 | ~50 | ~20 |
|
||||
| CAPIDAVATOUR | 3418 | ~150 | ~100 | ~30 |
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Oracle Service Not Running
|
||||
|
||||
```powershell
|
||||
# Check service
|
||||
Get-Service OracleServiceXE
|
||||
|
||||
# Start service
|
||||
Start-Service OracleServiceXE
|
||||
|
||||
# Check listener
|
||||
lsnrctl status
|
||||
```
|
||||
|
||||
### DMPDIR Points to Wrong Path
|
||||
|
||||
Oracle XE has a pre-existing DMPDIR that points to `D:\Oracle\admin\ORCL\dpdump`.
|
||||
The setup scripts should now handle this automatically, but to verify/fix manually:
|
||||
|
||||
```sql
|
||||
-- Check existing directories
|
||||
SELECT directory_name, directory_path FROM dba_directories WHERE directory_name = 'DMPDIR';
|
||||
|
||||
-- If pointing to wrong path, recreate
|
||||
DROP DIRECTORY DMPDIR;
|
||||
CREATE OR REPLACE DIRECTORY DMPDIR AS 'C:\DMPDIR';
|
||||
GRANT READ, WRITE ON DIRECTORY DMPDIR TO PUBLIC;
|
||||
```
|
||||
|
||||
**Note:** The `New-OracleDirectory` function in `oracle-functions.ps1` now automatically
|
||||
detects and corrects this issue (drops and recreates if path differs).
|
||||
|
||||
### DATAFILE_DIR Wrong Path
|
||||
|
||||
If tablespace creation fails with ORA-01119, check the datafile path in config.ps1:
|
||||
|
||||
```powershell
|
||||
# Check actual datafile location
|
||||
sqlplus -S sys/romfastsoft@10.0.20.130:1521/XEPDB1 "as sysdba" <<< "SELECT file_name FROM dba_data_files WHERE ROWNUM = 1;"
|
||||
|
||||
# Common paths:
|
||||
# Oracle XE typical: C:\app\<user>\product\21c\oradata\XE\XEPDB1
|
||||
# Not: C:\app\<user>\oradata\XE\XEPDB1 (missing 'product\21c')
|
||||
```
|
||||
|
||||
Fix in config.ps1:
|
||||
```powershell
|
||||
$DATAFILE_DIR = "C:\app\romfast\product\21c\oradata\XE\XEPDB1"
|
||||
```
|
||||
|
||||
### Permission Error on C:\DMPDIR
|
||||
|
||||
```powershell
|
||||
# Grant Oracle service permissions
|
||||
icacls C:\DMPDIR /grant "NT SERVICE\OracleServiceXE:(OI)(CI)F" /T
|
||||
```
|
||||
|
||||
### PDB Not Open
|
||||
|
||||
```sql
|
||||
-- Connect as SYSDBA to CDB
|
||||
sqlplus sys/romfastsoft@localhost:1521/XE as sysdba
|
||||
|
||||
-- Open PDB
|
||||
ALTER PLUGGABLE DATABASE XEPDB1 OPEN;
|
||||
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE;
|
||||
```
|
||||
|
||||
### Script Execution Policy Error
|
||||
|
||||
```powershell
|
||||
# Use Run.cmd wrapper instead of direct execution
|
||||
.\Run.cmd 01-setup-database.ps1
|
||||
|
||||
# Or set policy manually (Admin PowerShell)
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
|
||||
### Check Logs
|
||||
|
||||
```powershell
|
||||
# View latest log
|
||||
Get-ChildItem C:\roa-setup\logs\ | Sort-Object LastWriteTime -Descending | Select-Object -First 5
|
||||
|
||||
# Read specific log
|
||||
Get-Content C:\roa-setup\logs\01-setup-database_*.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deploying Updated Scripts
|
||||
|
||||
### From WSL/Linux
|
||||
|
||||
```bash
|
||||
# Copy all scripts to VM
|
||||
scp -r /mnt/e/proiecte/ROMFASTSQL/proxmox/lxc108-oracle/roa-windows-setup/* romfast@10.0.20.130:C:/roa-setup/
|
||||
```
|
||||
|
||||
### From Windows
|
||||
|
||||
```powershell
|
||||
# Copy from network share or local path
|
||||
Copy-Item -Recurse E:\proiecte\ROMFASTSQL\proxmox\lxc108-oracle\roa-windows-setup\* C:\roa-setup\ -Force
|
||||
```
|
||||
|
||||
### Quick Script Update (single file)
|
||||
|
||||
```bash
|
||||
# Update specific script
|
||||
scp /mnt/e/proiecte/ROMFASTSQL/proxmox/lxc108-oracle/roa-windows-setup/scripts/03-import-contafin.ps1 romfast@10.0.20.130:C:/roa-setup/scripts/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## VM Snapshots
|
||||
|
||||
### Create Snapshot (for quick restore)
|
||||
|
||||
```bash
|
||||
# Before testing
|
||||
ssh root@10.0.20.201 "qm snapshot 302 pre-test --description 'Before ROA test'"
|
||||
|
||||
# List snapshots
|
||||
ssh root@10.0.20.201 "qm listsnapshot 302"
|
||||
```
|
||||
|
||||
### Restore Snapshot
|
||||
|
||||
```bash
|
||||
# Restore to clean state
|
||||
ssh root@10.0.20.201 "qm rollback 302 pre-test"
|
||||
```
|
||||
|
||||
### Delete Snapshot
|
||||
|
||||
```bash
|
||||
ssh root@10.0.20.201 "qm delsnapshot 302 pre-test"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Clone VM for Parallel Testing
|
||||
|
||||
```bash
|
||||
# Clone VM 302 to VM 303
|
||||
ssh root@10.0.20.201 "qm clone 302 303 --name oracle-test-303 --full"
|
||||
|
||||
# Start new VM
|
||||
ssh root@10.0.20.201 "qm start 303"
|
||||
|
||||
# Note: Change IP in Windows after boot (Network Settings)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- VM 302 is cloned from template VM 300 (clean Windows + Oracle XE)
|
||||
- Oracle XE has 2GB RAM limit - sufficient for testing
|
||||
- DMP files are already in C:\DMPDIR (persisted between tests)
|
||||
- Uninstall script preserves DMP files
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2026-01-29
|
||||
**Author:** Marius Mutu
|
||||
**Project:** ROMFASTSQL - ROA Windows Setup Testing
|
||||
Reference in New Issue
Block a user