Commit Graph

38 Commits

Author SHA1 Message Date
Marius
f79331f7cc Oracle DR: Fix service recreation causing SSH disconnect
Remove service delete/recreate at step 3.3 that was causing 'Broken pipe' error
Service is already configured with auto-start at step 2.1 - no need to recreate

Issue: oradim -delete was killing running database and breaking SSH connection
Solution: Skip recreation, service already has correct auto-start configuration

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-11 02:29:38 +03:00
Marius
6accd1f996 Oracle DR: Fix verification commands and auto-start services
weekly-dr-test-proxmox.sh:
- Replace Unix commands (echo, grep) with PowerShell equivalents
- Use PowerShell Select-String for database status verification
- Fix table count query to work properly through SSH

rman_restore_from_zero.ps1:
- Set Oracle service to AUTOMATIC startup (was manual)
- Set Listener service to AUTOMATIC startup
- Auto-start Listener after database restore
- Add fallback to lsnrctl if service start fails

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-11 02:03:57 +03:00
Marius
026b0436ba Oracle DR: Complete migration to PowerShell scripts and cleanup
Changes:
- Remove obsolete .cmd scripts (cleanup_database.cmd, rman_restore_from_zero.cmd, rman_restore_final.cmd)
- Update weekly-dr-test-proxmox.sh to call PowerShell scripts with /SILENT parameter
- Add initROA.ora configuration file for reference

All DR test scripts now use PowerShell for SSH compatibility
Resolves input redirection issues with Windows SSH

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-11 01:47:39 +03:00
Marius
2f8c927bbe Oracle DR: Convert restore scripts to PowerShell for SSH compatibility
- Add cleanup_database.ps1: PowerShell version without input redirection issues
- Add rman_restore_from_zero.ps1: PowerShell version with inline SQL commands
- Update weekly-dr-test-proxmox.sh: Call .ps1 scripts via PowerShell

PowerShell scripts resolve SSH 'Input redirection not supported' errors
All SQL commands are piped directly to sqlplus (no temp files needed)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-11 01:26:35 +03:00
Marius
3c0beda819 Oracle DR: Add RMAN backup scripts with enhanced logging
- Add rman_backup.bat: FULL backup with live console output and log file
- Add rman_backup_incremental.bat: INCREMENTAL backup with live output
- Add rman_backup.txt: RMAN script for LEVEL 0 FULL backup
- Add rman_backup_incremental.txt: RMAN script for LEVEL 1 CUMULATIVE backup
- Scripts are portable: use current directory instead of hardcoded paths
- Logging: simultaneous output to console AND log file using PowerShell Tee-Object
- Log files saved in logs/ subdirectory with timestamps

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-10 23:41:42 +03:00
Marius
839f1b6b82 Oracle DR: Enhance notification templates with compact HTML layouts and improved data collection
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-10 22:41:32 +03:00
Marius
6f56e61b04 Oracle DR: Fix Gmail compatibility with plain text email templates
- Convert complex HTML/CSS templates to plain text format for Gmail compatibility
- Replace decorative characters (box drawing, special symbols) with simple text
- Use single-line bullet points instead of complex table layouts
- Improve readability across all email clients (Gmail, Outlook, mobile)
- Remove HTML templates completely, use only text format
- Keep informative structure with clear section separators
- Both text and HTML templates now identical for consistency
- Critical for Gmail users who only see plain text formatting

New format works perfectly in Gmail:
Oracle Backup WARNING - pveelite
WARNING

========================================
WARNINGS:
- FULL backup is 51 hours old (threshold: 25)

========================================
BACKUP STATUS:
FULL: 51h old TOO OLD (limit: 25h)
CUMULATIVE: 4h old OK (limit: 7h)
Total: 12 files | Size: 6.3GB | Disk: 2%

========================================
Next check: 2025-10-10 + 24h | Proxmox Monitoring

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-10 17:41:33 +03:00
Marius
b34006a499 Oracle DR: Fix template variables and complete monitoring system testing
- Fix Proxmox template compatibility: {{hostname}} → {{node}}, {{timestamp}} → {{date}}
- Remove duplicate node fields and fix JSON structure
- Complete full testing plan execution for monitoring and DR test scripts
- Validate notification system functionality with PVE::Notify
- Sync tested scripts from production back to repository

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-10 17:17:27 +03:00
Marius
b44e3c8f9b Oracle DR: Complete cleanup and restore scripts with Proxmox integration
- Remove outdated planning documents and implementation guides
- Update README with comprehensive DR procedures and monitoring
- Enhance rman_restore_from_zero.cmd with SPFILE creation and auto-start
- Add Proxmox monitoring and weekly test scripts
- Archive old implementation documentation

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-10 15:13:29 +03:00
Marius
cbad9ee779 Oracle DR: Phase 6.5 - Complete cleanup and restore scripts (TESTING)
Major improvements to DR restore workflow:

**New Scripts:**
- cleanup_database.cmd: Complete cleanup using oradim + registry deletion
- rman_restore_from_zero.cmd: Copy backups to recovery_area + restore

**Key Solutions Implemented:**
1. RMAN AUTOBACKUP limitation: Must have backups in recovery_area
   - Solution: Copy ALL backups from F:\ (NFS) to C:\...\recovery_area
   - Performance: 6.7 GB copied in ~2 minutes

2. Oracle service persistence issue: Service remains after sc delete
   - Solution: Use oradim -delete -sid ROA (proper Oracle cleanup)
   - Bonus: Delete registry keys to ensure clean state

**Current Status:**
- Cleanup:  TESTED (oradim works perfectly)
- Backup copy:  TESTED (6.7 GB in 2 min)
- RMAN restore: 🟡 IN PROGRESS (expected completion 03:35-03:40)

**Updated:**
- DR_UPGRADE_TO_CUMULATIVE_PLAN.md: Progress tracking + solutions documented
- rman_restore_final.cmd: Use F:\ mount point

🤖 Generated with Claude Code
2025-10-10 03:29:25 +03:00
Marius
8682e0ee04 Oracle DR: Complete Phase 5 - NFS mount point configuration
Phase 5 implementation completed:
- NFS server installed on Proxmox (nfs-kernel-server)
- NFS export configured: /mnt/pve/oracle-backups → VM 109
- Windows NFS Client enabled in VM 109
- F:\ drive auto-mount at startup via scheduled task
- PowerShell script: D:\Oracle\Scripts\mount-nfs.bat
- Directory permissions set to 777 for Windows compatibility
- Mount persists across VM reboots

Files updated:
- DR_UPGRADE_TO_CUMULATIVE_PLAN.md: Status → Phases 1-3-5 COMPLETED
- Added detailed Phase 5 documentation with step-by-step setup
- Updated validation checklist (8 items completed)

Next: Phases 4, 6, 7 (scheduled tasks, restore script, testing)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 01:21:47 +03:00
Marius
ec77bb3ddf WIP: Oracle DR CUMULATIVE backup upgrade - Phases 1-3 completed
COMPLETED:
- Phase 1: Proxmox host storage (/mnt/pve/oracle-backups/ROA/autobackup)
- Phase 2: RMAN script already has CUMULATIVE keyword
- Phase 3: Transfer scripts updated for Proxmox host
  * transfer_incremental.ps1: 10.0.20.37:22122 → 10.0.20.202:22
  * transfer_to_dr.ps1: Same change
  * Converted Windows PowerShell to Linux bash commands
- VM 109 cleanup: ~6.4 GB freed, RMAN catalog cleaned

NEW FILES:
- copy_existing_key_to_proxmox.ps1: Setup script for SSH key
- setup_ssh_keys_for_proxmox.ps1: Alternative setup (not used)

PENDING (Next Session):
- Run copy_existing_key_to_proxmox.ps1 on PRIMARY as Administrator
- Phase 4: Modify scheduled tasks (13:00 + 18:00)
- Phase 5: Configure mount point on VM 109 (F:\ drive)
- Phase 6: Update restore script for F:\ mount
- Phase 7: Test FULL + CUMULATIVE backup and restore

DOCUMENTATION:
- DR_UPGRADE_TO_CUMULATIVE_PLAN.md: Added implementation status

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 22:45:32 +03:00
Marius
ac2340c967 Oracle DR: Complete Windows VM implementation and cleanup
Major changes:
- Implemented Windows VM 109 as DR target (replaces Linux LXC)
- Tested RMAN restore successfully (12-15 min RTO, 24h RPO)
- Added comprehensive DR documentation:
  * DR_WINDOWS_VM_STATUS_2025-10-09.md - Current implementation status
  * DR_UPGRADE_TO_CUMULATIVE_PLAN.md - Plan for cumulative incremental backups
  * DR_VM_MIGRATION_GUIDE.md - Guide for VM migration between Proxmox nodes
- Updated DR_WINDOWS_VM_IMPLEMENTATION_PLAN.md with completed phases

New scripts:
- add_system_key_dr.ps1 - SSH key setup for automated transfers
- configure_listener_dr.ps1 - Oracle Listener configuration
- fix_ssh_via_service.ps1 - SSH authentication fix
- rman_restore_final.cmd - Working RMAN restore script (tested)
- transfer_to_dr.ps1 - FULL backup transfer (renamed from 02_*)
- transfer_incremental.ps1 - Incremental backup transfer (renamed from 02b_*)

Cleanup:
- Removed 19 obsolete scripts for Linux LXC DR
- Removed 8 outdated documentation files
- Organized project structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 18:54:08 +03:00
Marius
6a6ffe84af standby roa vm windows 2025-10-08 15:33:07 +03:00
Marius
a68f6c381f Fix: Preserve original encoding in claude-mcp-toggle
The save_config function was using json.dump with default ensure_ascii=True,
which converted all Romanian characters to \uXXXX escape sequences, making
the entire ~/.claude.json file appear modified even when only changing MCP
server configuration for a specific project.

Added ensure_ascii=False to preserve original UTF-8 encoding and minimize
file changes to only the intended MCP server modifications.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 15:27:16 +03:00
Marius
dfc64ec632 Add Claude Code MCP Server Manager utility and Oracle DR troubleshooting
- Add claude-mcp-toggle: CLI tool for managing MCP servers
  - Enable/disable individual MCP servers
  - Enable/disable all servers
  - Set specific servers (disable all, enable selected)
  - Interactive mode with menu
  - List servers with enabled/disabled status
- Add comprehensive README with usage examples
- Add Oracle DR restore troubleshooting documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 14:58:23 +03:00
Marius
d5bfc6b5c7 Add Oracle DR standby server scripts and Proxmox troubleshooting docs
- Add comprehensive Oracle backup and DR strategy documentation
- Add RMAN backup scripts (full and incremental)
- Add PowerShell transfer scripts for DR site
- Add bash restore and verification scripts
- Reorganize Oracle documentation structure
- Add Proxmox troubleshooting guide for VM 201 HA errors and NFS storage issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 13:37:33 +03:00
Marius
95f76d7ffb Fix: Add LXC container shutdown to UPS emergency shutdown script
The ups-shutdown-cluster.sh script was missing LXC container shutdown
functionality, only shutting down VMs. This could leave containers
running during UPS power failure, causing ungraceful shutdown.

Changes:
- Added Step 2: LXC container shutdown on all cluster nodes
- Uses 'pct list' to find running containers
- Shuts down each container with 60s timeout
- Parallel shutdown with '&' for speed
- Both local (pvemini) and remote nodes (pve1, pveelite)
- Updated step numbers (now 6 steps total vs 5 before)
- Fixed log_message() to use dynamic timestamp
- Fixed node name comment (pve2 → pveelite)

Shutdown order:
1. VMs on all nodes (timeout 60s)
2. LXC containers on all nodes (timeout 60s) [NEW]
3. Wait 90 seconds for graceful shutdown
4. Secondary nodes shutdown (pve1, pveelite)
5. Wait 30 seconds
6. Primary node shutdown (pvemini)

This matches the behavior in ups-maintenance-shutdown.sh which already
had LXC support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 21:49:28 +03:00
Marius
cc72a5f96e Add UPS battery replacement procedure and maintenance shutdown script
Adds complete procedure for replacing UPS battery when entire cluster
is powered by the same UPS, requiring full cluster shutdown.

New files:
- scripts/ups-maintenance-shutdown.sh: Automated orchestrated shutdown
  for maintenance operations with confirmation prompts and progress display
- docs/UPS-BATTERY-REPLACEMENT.md: Complete step-by-step guide for battery
  replacement including pre-shutdown, physical replacement, and post-startup
  verification procedures

Features:
- Orchestrated shutdown: VMs → LXC containers → secondary nodes → primary
- Interactive confirmation before shutdown
- Color-coded progress indicators
- Countdown timers for each phase
- Post-replacement verification checklist
- Troubleshooting guide for common issues
- Recovery procedures for cluster/quorum problems

The procedure accounts for all 3 cluster nodes (pve1, pvemini, pveelite)
being on the same UPS, requiring complete infrastructure shutdown.

Documentation includes:
- When to replace battery (based on monthly test results)
- Pre-planning and user notification templates
- Physical battery replacement safety procedures
- Cluster recovery and VM restart procedures
- Post-replacement testing and verification
- 24-hour and 1-week monitoring checklists

Estimated maintenance window: 30-60 minutes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 21:46:28 +03:00
Marius
87b9709a0d Add complete UPS monitoring system with monthly battery testing
This commit adds a comprehensive UPS monitoring and management system for
the Proxmox cluster with automated shutdown orchestration and monthly
battery health testing.

Features:
- NUT (Network UPS Tools) configuration for INNO TECH USB UPS
- Automated cluster shutdown on power failure (3-minute grace period)
- Monthly automated battery testing with health evaluation
- Email notifications via PVE::Notify system
- WinNUT monitoring client for Windows VM 201

Components added:
- config/: NUT configuration files (ups.conf, upsd.conf, upsmon.conf, etc.)
- scripts/ups-shutdown-cluster.sh: Orchestrated cluster shutdown
- scripts/ups-monthly-test.sh: Monthly battery test with email reports
- scripts/upssched-cmd: Event handler for UPS state changes
- docs/: Complete installation and usage documentation

Key findings:
- UPS battery.charge reporting has 10-40 second delay after test start
- Test must monitor voltage drop (1.5-2V) and charge drop (9-27%)
- Battery health evaluation: EXCELLENT/GOOD/FAIR/POOR based on discharge rate
- Email notifications use Handlebars templates without Unicode emojis for compatibility

Configuration:
- UPS: INNO TECH (Voltronic protocol, vendor 0665:5161)
- Primary node: pvemini (10.0.20.201) with USB connection
- Monthly test: cron 0 0 1 * * /opt/scripts/ups-monthly-test.sh
- Shutdown timer: 180 seconds on battery before cluster shutdown

Documentation includes complete installation guides for NUT server,
WinNUT client, and troubleshooting procedures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 21:39:46 +03:00
Marius
238c02fdf0 mutat scripturi 2025-10-06 18:53:45 +03:00
Marius
f3fca1f96e Update Proxmox HA monitoring script - remove qdevice support
Changes:
- Remove qdevice verification (qdevice no longer exists in cluster)
- Fix cluster nodes detection (updated pvecm status output format)
- Add --help parameter with complete usage documentation
- Update notification templates (remove qdevice references)
- Simplify quorum check (only verify total_votes = expected_votes)

The script now correctly monitors:
- HA Services (pve-ha-lrm, pve-ha-crm)
- Cluster Quorum (3/3 votes)
- Online nodes (3 nodes detected via Membership information)

Tested successfully on pvemini.romfast.ro (10.0.20.201)
Status: SUCCESSFUL with all checks passing

Also updated proxmox-ssh-guide.md with current cluster configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 18:48:05 +03:00
Marius
8795b92887 Add Oracle 10g compatible version of scrie_jc_2007
- Created scrie_jc_2007_oracle10g.sql with FOR LOOP instead of FORALL
- Resolves PLS-00436 error on Oracle 10.2.0.5 and older versions
- Added README_ORACLE10G.md with technical documentation
- Added INSTRUCTIUNI_ORACLE10G.txt with client instructions
- Main version (scrie_jc_2007.sql) remains optimized with FORALL for Oracle 11g+

Performance: ~20-50ms for <10k rows (vs 15-30ms FORALL, but 2400x faster than old MERGE)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 13:03:19 +03:00
Marius
88b87a58c0 Add Oracle connection settings documentation
- Created CONEXIUNI-ORACLE.md with complete connection details
- Oracle XE 21c Docker (LXC 108): CDB XE with PDBs ROA and ROA2
- Oracle 10g VM 107 Windows: connection strings and migration notes
- Updated SYS/SYSTEM passwords to romfastsoft (CONTAINER=ALL)
- Connection strings for SQL*Plus, JDBC, and TNS
- Troubleshooting commands and useful queries
- Export/import examples for Data Pump

PDB ROA2 fully configured:
- CONTAFIN_ORACLE and FIRMANOUA schemas imported
- 232 public synonyms created
- 149 grants to PUBLIC
- All critical packages VALID (PACK_CONTAFIN, PACK_UPDATE, PACK_UTILS, PACK_DREPTURI)
- SYS custom objects: AUTH_PACK, UPDATESQLPLUS, EXECUTESCRIPTOS, UTL_MAIL
- Ready for DMP template exports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 19:05:20 +03:00
Marius
f894544d9c Optimize scrie_jc_2007: Replace FOR LOOP with FORALL BULK operations
- Replace row-by-row processing with FORALL bulk UPDATE/INSERT/DELETE
- Improve readability: l_data(i) → S(i), l_data(l_insert_indices(i)) → SI(i)
- Use dedicated collections: S (source), SI (insert), SD (delete)
- Reduce context switches from 3*N to 3 operations
- Performance improvement: ~15-30ms vs ~80-120ms (3-4x faster for 10k rows)
- Maintain exact same business logic as original implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 18:26:23 +03:00
Marius
9f7e9779d2 Optimize scrie_jc_2007: Replace long MERGE with BULK COLLECT cursor loop
- Replaced 1,886-line MERGE statement with cursor loop + BULK COLLECT to avoid Oracle XE internal bugs with very long MERGE statements
- Reduced code size from 1,925 to 1,861 lines (-64 lines, -3.3%)
- Benefits:
  * Single SELECT execution (data loaded into PGA memory via BULK COLLECT)
  * Zero temporary table writes
  * Minimal PL/SQL overhead (~30-50ms for <10k rows)
  * Uses c_source%ROWTYPE for automatic structure adaptation
  * Preserves original alias 'S' for consistency
  * Maintains exact logic: UPDATE → DELETE (if nStergere + all zeros) → INSERT
- Added backup file: scrie_jc_2007_original_merge_backup.sql
- Added reusable transformation script: merge_to_bulk_collect.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 16:49:46 +03:00
Marius
02ef8775ab oracle migrare 2025-10-01 16:08:13 +03:00
Marius
b414b3c338 vm 107 monitor 2025-09-30 02:12:25 +03:00
Marius
24c8c75eb6 proxmox monitori 2025-09-30 02:06:34 +03:00
Marius
e3085884d9 migrare oracle central 2025-09-30 01:41:58 +03:00
Marius
ad07606de0 oracle install LXC docker 2025-09-30 01:27:33 +03:00
Marius
87785f703a proxmox 2025-09-29 15:23:31 +03:00
Marius
b83983b6ed scrie jtva 2025-09-23 11:32:03 +03:00
Marius
f2880f1ef7 Update system prompt and create D300 migration script
- Enhanced system_prompt.md with mandatory initial questions, explicit examples, operation types, error handling, and BEGIN/END structure requirements
- Created ff_2025_09_10_01_CONTABILITATE_D300.sql migration script for DECONTTVA table with DELETE/INSERT approach
- Removed obsolete files: CLAUDE.md, README.md, CSV input files
- Updated input/scrie_jc_2007.sql

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 15:45:46 +03:00
Marius
3c61b5f617 test 2025-09-09 12:12:19 +03:00
Marius
865052597a scrie_jc 2025-08-19 14:27:23 +03:00
Marius
1afc7dc29b urlwatch 2025-08-12 10:15:47 +03:00
Marius
82950b81a5 Initial commit: Romanian ERP database migration system
Complete project setup with:
- PACK_MIGRARE utility package
- Migration script examples and patterns
- Comprehensive documentation in CLAUDE.md and README.md
- System instructions for SQL generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-08 16:55:07 +03:00