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>
This commit is contained in:
@@ -373,11 +373,13 @@ run_dr_test() {
|
||||
step_start=$(date +%s)
|
||||
log "STEP 5: Verifying database"
|
||||
|
||||
# Use PowerShell to query database status
|
||||
db_status=$(ssh -p "$DR_VM_PORT" "$DR_VM_USER@$DR_VM_IP" \
|
||||
"cmd /c 'echo SELECT STATUS FROM V\$INSTANCE; | sqlplus -s / as sysdba' | findstr OPEN" || echo "")
|
||||
"powershell -Command \"'SELECT STATUS FROM V\`\$INSTANCE;' | sqlplus -s / as sysdba | Select-String 'OPEN'\"" || echo "")
|
||||
|
||||
# Use PowerShell to count tables
|
||||
tables_restored=$(ssh -p "$DR_VM_PORT" "$DR_VM_USER@$DR_VM_IP" \
|
||||
"cmd /c 'echo SELECT COUNT(*) FROM DBA_TABLES WHERE OWNER NOT IN (''SYS'',''SYSTEM''); | sqlplus -s / as sysdba' | grep -o '[0-9]*' | tail -1" || echo "0")
|
||||
"powershell -Command \"'SELECT COUNT(*) FROM DBA_TABLES WHERE OWNER NOT IN (''SYS'',''SYSTEM'');' | sqlplus -s / as sysdba | Select-String -Pattern '[0-9]+' | ForEach-Object { \$_.Matches[0].Value } | Select-Object -Last 1\"" || echo "0")
|
||||
tables_restored=$(echo "$tables_restored" | tr -cd '0-9')
|
||||
[ -z "$tables_restored" ] && tables_restored=0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user