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>
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
|
||||
param(
|
||||
[string]$SourceFRA = "C:\Users\Oracle\recovery_area\ROA",
|
||||
[string]$DRHost = "10.0.20.37",
|
||||
[int]$DRPort = 22122,
|
||||
[string]$DRUser = "romfast",
|
||||
[string]$DRPath = "D:/oracle/backups/primary",
|
||||
[string]$DRHost = "10.0.20.202",
|
||||
[int]$DRPort = 22,
|
||||
[string]$DRUser = "root",
|
||||
[string]$DRPath = "/mnt/pve/oracle-backups/ROA/autobackup",
|
||||
[string]$SSHKeyPath = "$env:USERPROFILE\.ssh\id_rsa",
|
||||
[int]$RetentionDays = 2,
|
||||
[string]$LogFile = "D:\rman_backup\logs\transfer_$(Get-Date -Format 'yyyyMMdd').log"
|
||||
@@ -87,8 +87,8 @@ function Transfer-FileToDR {
|
||||
$fileSizeMB = [math]::Round($File.Length / 1MB, 2)
|
||||
|
||||
try {
|
||||
# Check dacă fișierul există deja pe DR (skip duplicates) - Windows PowerShell command
|
||||
$checkCmd = "powershell -Command `"Test-Path '$DestPath/$fileName'`""
|
||||
# Check dacă fișierul există deja pe DR (skip duplicates) - Linux bash command
|
||||
$checkCmd = "test -f '$DestPath/$fileName' && echo 'True' || echo 'False'"
|
||||
$checkResult = & ssh -n -p $DRPort -i $SSHKeyPath "${DRUser}@${DRHost}" $checkCmd 2>&1
|
||||
|
||||
if ($checkResult -match "True") {
|
||||
@@ -119,12 +119,11 @@ function Cleanup-OldBackupsOnDR {
|
||||
Write-Log "Cleaning up old backups on DR (keeping last $RetentionDays days)..."
|
||||
|
||||
try {
|
||||
# Cleanup: șterge fișiere mai vechi de $RetentionDays zile - Windows PowerShell command
|
||||
$retentionDate = (Get-Date).AddDays(-$RetentionDays).ToString("yyyy-MM-dd")
|
||||
$cleanupCmd = "powershell -Command `"Get-ChildItem -Path '$DRPath' -Recurse -File | Where-Object { `$_.LastWriteTime -lt '$retentionDate' } | Remove-Item -Force -ErrorAction SilentlyContinue`""
|
||||
# Cleanup: șterge fișiere mai vechi de $RetentionDays zile - Linux find command
|
||||
$cleanupCmd = "find '$DRPath' -type f -mtime +$RetentionDays -delete 2>/dev/null || true"
|
||||
$result = & ssh -n -p $DRPort -i $SSHKeyPath "${DRUser}@${DRHost}" $cleanupCmd 2>&1
|
||||
|
||||
Write-Log "Cleanup completed on DR (removed files older than $retentionDate)"
|
||||
Write-Log "Cleanup completed on DR (removed files older than $RetentionDays days)"
|
||||
} catch {
|
||||
Write-Log "Cleanup warning: $_" "WARNING"
|
||||
}
|
||||
@@ -154,9 +153,9 @@ try {
|
||||
throw "Cannot connect to DR server via SSH"
|
||||
}
|
||||
|
||||
# Creare director pe DR - Windows PowerShell command
|
||||
# Creare director pe DR - Linux mkdir command
|
||||
Write-Log "Ensuring DR directory exists..."
|
||||
$null = & ssh -n -p $DRPort -i $SSHKeyPath "${DRUser}@${DRHost}" "powershell -Command `"New-Item -ItemType Directory -Path '$DRPath' -Force | Out-Null`"" 2>&1
|
||||
$null = & ssh -n -p $DRPort -i $SSHKeyPath "${DRUser}@${DRHost}" "mkdir -p '$DRPath'" 2>&1
|
||||
|
||||
# Găsește backup-uri
|
||||
$backupFiles = Get-TodaysBackups
|
||||
|
||||
Reference in New Issue
Block a user