Add ROA Oracle Database Windows setup scripts with old client support
PowerShell scripts for setting up Oracle 21c/XE with ROA application: - Automated tablespace, user creation and imports - sqlnet.ora config for Instant Client 11g/ODBC compatibility - Oracle 21c read-only Home path handling (homes/OraDB21Home1) - Listener restart + 10G password verifier for legacy auth - Tested on VM 302 with CONTAFIN_ORACLE schema import Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
390
proxmox/lxc108-oracle/roa-windows-setup/README.md
Normal file
390
proxmox/lxc108-oracle/roa-windows-setup/README.md
Normal file
@@ -0,0 +1,390 @@
|
||||
# ROA Oracle Database Setup for Windows
|
||||
|
||||
## Overview
|
||||
|
||||
Scripts and documentation for setting up ROA Oracle Database on Windows servers:
|
||||
|
||||
| Scenario | Description |
|
||||
|----------|-------------|
|
||||
| **New Server** | Oracle 21c SE (non-CDB) or XE (CDB/PDB) + CONTAFIN_ORACLE.dmp |
|
||||
| **Migration** | Import existing DMP files (CONTAFIN_ORACLE + 30-50 companies) |
|
||||
| **Add Company** | Add new company schema to existing server |
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Windows Server 2016+ or Windows 10/11
|
||||
- Oracle 21c Standard Edition or Express Edition installed
|
||||
- Administrator privileges
|
||||
- PowerShell 5.1+
|
||||
- Minimum 8GB RAM (16GB recommended for SE)
|
||||
- 50GB free disk space
|
||||
|
||||
---
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. Download Oracle 21c XE or SE from Oracle
|
||||
2. Install Oracle (see `docs/00-INSTALL-ORACLE-XE.md` or `docs/00-INSTALL-ORACLE-SE.md`)
|
||||
3. Copy DMP files to `C:\DMPDIR\`
|
||||
4. Copy `config.example.ps1` to `config.ps1` and edit values
|
||||
5. Run scripts in order: `01` -> `07`
|
||||
|
||||
```powershell
|
||||
# Example workflow
|
||||
.\01-setup-database.ps1
|
||||
.\02-create-sys-objects.ps1
|
||||
.\03-import-contafin.ps1
|
||||
.\04-create-synonyms-grants.ps1
|
||||
.\05-import-companies.ps1
|
||||
.\07-verify-installation.ps1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
Copy `config.example.ps1` to `config.ps1` and edit:
|
||||
|
||||
| Parameter | XE Value | SE Value |
|
||||
|-----------|----------|----------|
|
||||
| `ORACLE_HOME` | `C:\app\oracle\product\21c\dbhomeXE` | `C:\app\oracle\product\21c\dbhome_1` |
|
||||
| `SERVICE_NAME` | `XEPDB1` | `ROA` |
|
||||
| `DATAFILE_DIR` | `C:\app\oracle\oradata\XE\XEPDB1` | `C:\app\oracle\oradata\ROA` |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
roa-windows-setup/
|
||||
├── README.md # This file
|
||||
├── config.example.ps1 # Configuration template
|
||||
│
|
||||
├── docs/ # Installation guides
|
||||
│ ├── 00-INSTALL-ORACLE-XE.md # Oracle 21c XE installation
|
||||
│ └── 00-INSTALL-ORACLE-SE.md # Oracle 21c SE installation
|
||||
│
|
||||
├── scripts/ # PowerShell setup scripts
|
||||
│ ├── 01-setup-database.ps1 # Tablespace, profile, CONTAFIN_ORACLE user
|
||||
│ ├── 02-create-sys-objects.ps1# SYS objects (AUTH_PACK, NEWSCHEMA, etc.)
|
||||
│ ├── 03-import-contafin.ps1 # Import CONTAFIN_ORACLE schema
|
||||
│ ├── 04-create-synonyms-grants.ps1 # Public synonyms and grants
|
||||
│ ├── 05-import-companies.ps1 # Batch import company schemas
|
||||
│ ├── 06-add-company.ps1 # Add new company to existing server
|
||||
│ └── 07-verify-installation.ps1# Verify installation completeness
|
||||
│
|
||||
├── config/ # Configuration templates
|
||||
│ └── sqlnet.ora # Compatibility for Instant Client 10/11
|
||||
│
|
||||
├── par/ # Data Pump parameter files
|
||||
│ ├── import-contafin.par # CONTAFIN_ORACLE import parameters
|
||||
│ └── import-company.par # Company schema import template
|
||||
│
|
||||
├── sql/ # SQL scripts
|
||||
│ └── (to be added)
|
||||
│
|
||||
└── test/ # Testing scripts
|
||||
└── clone-vm300.sh # Proxmox VM cloning for testing
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Scripts Overview
|
||||
|
||||
| Script | Purpose | Required |
|
||||
|--------|---------|----------|
|
||||
| `01-setup-database.ps1` | Create tablespace ROA, configure profile, create CONTAFIN_ORACLE user | Yes |
|
||||
| `02-create-sys-objects.ps1` | Install SYS objects: AUTH_PACK, NEWSCHEMA, EXECUTESCRIPTOS, UTL_MAIL | Yes |
|
||||
| `03-import-contafin.ps1` | Import CONTAFIN_ORACLE schema from DMP | Yes |
|
||||
| `04-create-synonyms-grants.ps1` | Create public synonyms and grants for CONTAFIN_ORACLE | Yes |
|
||||
| `05-import-companies.ps1` | Batch import company schemas from DMP files | Yes |
|
||||
| `06-add-company.ps1` | Add new company to existing server | Optional |
|
||||
| `07-verify-installation.ps1` | Verify installation completeness (objects, grants, synonyms) | Yes |
|
||||
|
||||
---
|
||||
|
||||
## Architecture Differences
|
||||
|
||||
### Oracle 21c Standard Edition (non-CDB)
|
||||
|
||||
Traditional single-database architecture (legacy compatibility).
|
||||
|
||||
| Feature | Value |
|
||||
|---------|-------|
|
||||
| Architecture | Single database (non-CDB) |
|
||||
| Database Name | ROA |
|
||||
| Service Name | ROA |
|
||||
| SID | ROA |
|
||||
| Connection | `system/pass@ROA` |
|
||||
| Datafiles | `C:\app\oracle\oradata\ROA\` |
|
||||
|
||||
**Advantages:**
|
||||
- Simpler administration
|
||||
- Compatible with Oracle 10g migration scripts
|
||||
- No PDB management overhead
|
||||
|
||||
### Oracle 21c Express Edition (CDB/PDB)
|
||||
|
||||
Modern multitenant architecture with Container Database.
|
||||
|
||||
| Feature | Value |
|
||||
|---------|-------|
|
||||
| Architecture | Container + Pluggable Database |
|
||||
| CDB Name | XE |
|
||||
| PDB Name | XEPDB1 |
|
||||
| Service Name | XEPDB1 (for applications) |
|
||||
| Connection | `system/pass@XEPDB1` |
|
||||
| Datafiles | `C:\app\oracle\oradata\XE\XEPDB1\` |
|
||||
|
||||
**Advantages:**
|
||||
- Free license (Express Edition)
|
||||
- Modern architecture
|
||||
- Easy backup/clone of PDB
|
||||
|
||||
**Connection Warning:**
|
||||
> Always connect to **XEPDB1** (PDB), not to **XE** (CDB root) for ROA operations!
|
||||
|
||||
---
|
||||
|
||||
## Standard Passwords
|
||||
|
||||
| User | Password | Notes |
|
||||
|------|----------|-------|
|
||||
| SYS | romfastsoft | SYSDBA |
|
||||
| SYSTEM | romfastsoft | DBA |
|
||||
| CONTAFIN_ORACLE | ROMFASTSOFT | Common schema |
|
||||
| Company schemas | From NOM_FIRME.parola | See company-specific config |
|
||||
|
||||
> **Security Note:** Change passwords in production environments!
|
||||
|
||||
---
|
||||
|
||||
## DMP Files Required
|
||||
|
||||
### For New Installation
|
||||
|
||||
| File | Description | Size |
|
||||
|------|-------------|------|
|
||||
| `contafin_oracle.dmp` | Common schema (rights, updates, etc.) | ~50MB |
|
||||
| `[company].dmp` | Company schema (one per company) | ~100-500MB each |
|
||||
|
||||
### Obtaining DMP Files
|
||||
|
||||
Export from existing Oracle 18c server (for compatibility):
|
||||
|
||||
```bash
|
||||
# From LXC 108 (Oracle 18c - port 1522)
|
||||
docker exec oracle18-xe expdp system/romfastsoft@localhost:1521/XEPDB1 \
|
||||
SCHEMAS=CONTAFIN_ORACLE DIRECTORY=DMPDIR DUMPFILE=contafin_oracle.dmp \
|
||||
LOGFILE=export_contafin.log VERSION=11.2
|
||||
```
|
||||
|
||||
Copy to Windows:
|
||||
```powershell
|
||||
# Using SCP from WSL/Linux
|
||||
scp root@10.0.20.201:/opt/oracle18/oradata/dmpdir/contafin_oracle.dmp C:\DMPDIR\
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Examples
|
||||
|
||||
### New Server Installation
|
||||
|
||||
```powershell
|
||||
# 1. Install Oracle 21c XE (see docs/00-INSTALL-ORACLE-XE.md)
|
||||
|
||||
# 2. Configure
|
||||
Copy-Item config.example.ps1 config.ps1
|
||||
notepad config.ps1 # Edit values
|
||||
|
||||
# 3. Copy DMP files
|
||||
mkdir C:\DMPDIR
|
||||
Copy-Item \\server\dmp\*.dmp C:\DMPDIR\
|
||||
|
||||
# 4. Run setup scripts
|
||||
.\01-setup-database.ps1
|
||||
.\02-create-sys-objects.ps1
|
||||
.\03-import-contafin.ps1
|
||||
.\04-create-synonyms-grants.ps1
|
||||
.\05-import-companies.ps1
|
||||
.\07-verify-installation.ps1
|
||||
```
|
||||
|
||||
### Add New Company
|
||||
|
||||
```powershell
|
||||
# Copy company DMP
|
||||
Copy-Item \\server\dmp\NEWCOMPANY.dmp C:\DMPDIR\
|
||||
|
||||
# Run add company script
|
||||
.\06-add-company.ps1 -CompanyName "NEWCOMPANY" -Password "ROMFASTSOFT"
|
||||
```
|
||||
|
||||
### Migration from Oracle 10g
|
||||
|
||||
```powershell
|
||||
# 1. Export from Oracle 10g (on source Windows server)
|
||||
exp system/password@ORCL file=C:\backup\COMPANY.dmp owner=COMPANY
|
||||
|
||||
# 2. Convert with Oracle 21c imp (if needed)
|
||||
# Or use impdp with VERSION parameter
|
||||
|
||||
# 3. Import using scripts
|
||||
.\05-import-companies.ps1 -DmpFile "COMPANY.dmp"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### ORA-28040: No matching authentication protocol
|
||||
|
||||
**Problem:** Old clients (Instant Client 10/11) cannot connect to Oracle 21c.
|
||||
|
||||
**Solution:** Configure `sqlnet.ora` for backward compatibility:
|
||||
|
||||
```powershell
|
||||
# Copy sqlnet.ora template
|
||||
Copy-Item config\sqlnet.ora $env:ORACLE_HOME\network\admin\sqlnet.ora
|
||||
|
||||
# Restart listener
|
||||
lsnrctl reload
|
||||
```
|
||||
|
||||
### ORA-01017: invalid username/password
|
||||
|
||||
**After configuring sqlnet.ora for old clients, reset passwords:**
|
||||
|
||||
```sql
|
||||
ALTER USER CONTAFIN_ORACLE IDENTIFIED BY ROMFASTSOFT;
|
||||
ALTER USER [COMPANY] IDENTIFIED BY [PASSWORD];
|
||||
```
|
||||
|
||||
### ORA-12514: TNS:listener does not currently know of service
|
||||
|
||||
**Check listener status:**
|
||||
|
||||
```powershell
|
||||
lsnrctl status
|
||||
lsnrctl services
|
||||
```
|
||||
|
||||
**For XE, ensure PDB is open:**
|
||||
|
||||
```sql
|
||||
ALTER SESSION SET CONTAINER = XEPDB1;
|
||||
ALTER PLUGGABLE DATABASE XEPDB1 OPEN;
|
||||
ALTER PLUGGABLE DATABASE XEPDB1 SAVE STATE;
|
||||
```
|
||||
|
||||
### Import Errors
|
||||
|
||||
**ORA-00959: tablespace 'ROA' does not exist:**
|
||||
```powershell
|
||||
# Use REMAP_TABLESPACE in impdp
|
||||
impdp ... REMAP_TABLESPACE=ROA:USERS
|
||||
```
|
||||
|
||||
**ORA-39405: Oracle Data Pump does not support importing from a source database with TSTZ version newer:**
|
||||
|
||||
Use DMP files exported from Oracle 18c (TSTZ 31) instead of Oracle 21c (TSTZ 35).
|
||||
|
||||
### Service Not Starting
|
||||
|
||||
Check Windows Services:
|
||||
- `OracleServiceXE` (for XE)
|
||||
- `OracleServiceROA` (for SE)
|
||||
- `OracleOraDB21Home1TNSListener`
|
||||
|
||||
```powershell
|
||||
# Restart services
|
||||
net stop OracleServiceXE
|
||||
net start OracleServiceXE
|
||||
net stop OracleOraDB21Home1TNSListener
|
||||
net start OracleOraDB21Home1TNSListener
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Connection Strings
|
||||
|
||||
### SQL*Plus
|
||||
|
||||
```bash
|
||||
# Oracle XE (connect to PDB)
|
||||
sqlplus system/romfastsoft@localhost:1521/XEPDB1
|
||||
sqlplus CONTAFIN_ORACLE/ROMFASTSOFT@localhost:1521/XEPDB1
|
||||
|
||||
# Oracle SE (connect to database)
|
||||
sqlplus system/romfastsoft@localhost:1521/ROA
|
||||
sqlplus CONTAFIN_ORACLE/ROMFASTSOFT@localhost:1521/ROA
|
||||
```
|
||||
|
||||
### JDBC
|
||||
|
||||
```
|
||||
# Oracle XE
|
||||
jdbc:oracle:thin:@localhost:1521/XEPDB1
|
||||
|
||||
# Oracle SE
|
||||
jdbc:oracle:thin:@localhost:1521/ROA
|
||||
```
|
||||
|
||||
### ODBC (Instant Client)
|
||||
|
||||
| Parameter | XE Value | SE Value |
|
||||
|-----------|----------|----------|
|
||||
| Host | localhost | localhost |
|
||||
| Port | 1521 | 1521 |
|
||||
| Service Name | XEPDB1 | ROA |
|
||||
| User | CONTAFIN_ORACLE | CONTAFIN_ORACLE |
|
||||
| Password | ROMFASTSOFT | ROMFASTSOFT |
|
||||
|
||||
### TNS Entry
|
||||
|
||||
```
|
||||
# For Oracle XE
|
||||
ROA =
|
||||
(DESCRIPTION =
|
||||
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
|
||||
(CONNECT_DATA = (SERVICE_NAME = XEPDB1))
|
||||
)
|
||||
|
||||
# For Oracle SE
|
||||
ROA =
|
||||
(DESCRIPTION =
|
||||
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
|
||||
(CONNECT_DATA = (SERVICE_NAME = ROA))
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing with Proxmox VM Clone
|
||||
|
||||
For testing installations, use the VM cloning script:
|
||||
|
||||
```bash
|
||||
# On Proxmox host (pvemini)
|
||||
./test/clone-vm300.sh 301 # Creates VM 301 from template 300
|
||||
```
|
||||
|
||||
See `test/clone-vm300.sh` for details.
|
||||
|
||||
---
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- **Oracle LXC 108 (Docker):** `../README.md`
|
||||
- **Migration Oracle 10g -> 21c:** `../migration/README.md`
|
||||
- **SQL Migration Guidelines:** `/system_instructions/system_prompt.md`
|
||||
- **Proxmox Infrastructure:** `../../README.md`
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2026-01-28
|
||||
**Author:** Marius Mutu
|
||||
**Project:** ROMFASTSQL - ROA Oracle Database Windows Setup
|
||||
Reference in New Issue
Block a user