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>
This commit is contained in:
99
oracle/standby-server-scripts/03_setup_dr_transfer_task.ps1
Normal file
99
oracle/standby-server-scripts/03_setup_dr_transfer_task.ps1
Normal file
@@ -0,0 +1,99 @@
|
||||
# Setup Windows Task Scheduler pentru Oracle DR Transfer
|
||||
# Rulează ca Administrator!
|
||||
|
||||
# Verificare admin rights
|
||||
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Error "This script must be run as Administrator!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Setting up Oracle DR Transfer scheduled task..." -ForegroundColor Cyan
|
||||
|
||||
# Creare director logs dacă nu există
|
||||
$logDir = "D:\rman_backup\logs"
|
||||
if (-not (Test-Path $logDir)) {
|
||||
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
|
||||
Write-Host "Created log directory: $logDir" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Task pentru transfer DR (la 03:00 AM zilnic)
|
||||
$taskName = "Oracle_DR_Transfer"
|
||||
$scriptPath = "D:\rman_backup\transfer_to_dr.ps1"
|
||||
|
||||
# Verificare că scriptul există
|
||||
if (-not (Test-Path $scriptPath)) {
|
||||
Write-Error "Transfer script not found at: $scriptPath"
|
||||
Write-Host "Please copy 02_transfer_to_dr.ps1 to D:\rman_backup\transfer_to_dr.ps1" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Creare task action
|
||||
$action = New-ScheduledTaskAction `
|
||||
-Execute "PowerShell.exe" `
|
||||
-Argument "-ExecutionPolicy Bypass -NoProfile -File `"$scriptPath`""
|
||||
|
||||
# Trigger: zilnic la 03:00 AM (după backup RMAN de la 02:00)
|
||||
$trigger = New-ScheduledTaskTrigger -Daily -At "03:00AM"
|
||||
|
||||
# Principal: SYSTEM account cu highest privileges
|
||||
$principal = New-ScheduledTaskPrincipal `
|
||||
-UserId "SYSTEM" `
|
||||
-LogonType ServiceAccount `
|
||||
-RunLevel Highest
|
||||
|
||||
# Settings
|
||||
$settings = New-ScheduledTaskSettingsSet `
|
||||
-AllowStartIfOnBatteries `
|
||||
-DontStopIfGoingOnBatteries `
|
||||
-StartWhenAvailable `
|
||||
-RestartCount 3 `
|
||||
-RestartInterval (New-TimeSpan -Minutes 5)
|
||||
|
||||
# Șterge task-ul dacă există deja
|
||||
$existingTask = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||
if ($existingTask) {
|
||||
Write-Host "Removing existing task: $taskName" -ForegroundColor Yellow
|
||||
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
|
||||
}
|
||||
|
||||
# Înregistrare task nou
|
||||
try {
|
||||
Register-ScheduledTask `
|
||||
-TaskName $taskName `
|
||||
-Action $action `
|
||||
-Trigger $trigger `
|
||||
-Principal $principal `
|
||||
-Settings $settings `
|
||||
-Description "Oracle DR - Transfer RMAN backups to DR server 10.0.20.37 daily at 3 AM" `
|
||||
-ErrorAction Stop
|
||||
|
||||
Write-Host "✅ Task created successfully: $taskName" -ForegroundColor Green
|
||||
|
||||
# Afișare detalii
|
||||
Write-Host "`nTask details:" -ForegroundColor Cyan
|
||||
Write-Host " Name: $taskName"
|
||||
Write-Host " Schedule: Daily at 03:00 AM"
|
||||
Write-Host " Script: $scriptPath"
|
||||
Write-Host " Logs: $logDir\transfer_YYYYMMDD.log"
|
||||
|
||||
# Test manual (opțional)
|
||||
Write-Host "`nTo test the task manually, run:" -ForegroundColor Yellow
|
||||
Write-Host " Start-ScheduledTask -TaskName '$taskName'" -ForegroundColor White
|
||||
|
||||
# Verificare task
|
||||
$task = Get-ScheduledTask -TaskName $taskName
|
||||
Write-Host "`nTask status: $($task.State)" -ForegroundColor Green
|
||||
|
||||
} catch {
|
||||
Write-Error "Failed to create scheduled task: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "`n=========================================" -ForegroundColor Green
|
||||
Write-Host "Setup complete!" -ForegroundColor Green
|
||||
Write-Host "=========================================" -ForegroundColor Green
|
||||
Write-Host "`nNext steps:"
|
||||
Write-Host "1. Setup SSH keys for passwordless login to DR server"
|
||||
Write-Host "2. Test the transfer script manually:"
|
||||
Write-Host " PowerShell -File $scriptPath"
|
||||
Write-Host "3. Verify the scheduled task runs successfully tomorrow at 03:00 AM"
|
||||
Reference in New Issue
Block a user