Compare commits
2 Commits
5bed910b1c
...
c4504cac70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4504cac70 | ||
|
|
eade344f28 |
@@ -91,13 +91,65 @@ if ($service) {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host " Oracle service not found, creating from PFILE..."
|
Write-Host " Oracle service not found, creating from PFILE..."
|
||||||
|
|
||||||
if (-not (Test-Path "C:\Users\oracle\admin\ROA\pfile\initROA.ora")) {
|
# Check if PFILE exists, create if missing
|
||||||
Write-Host "ERROR: PFILE not found at C:\Users\oracle\admin\ROA\pfile\initROA.ora" -ForegroundColor Red
|
$pfilePath = "C:\Users\oracle\admin\ROA\pfile\initROA.ora"
|
||||||
Write-Host "Cannot create Oracle service without PFILE!"
|
if (-not (Test-Path $pfilePath)) {
|
||||||
exit 1
|
Write-Host " PFILE not found, creating default initROA.ora..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Create directory if needed
|
||||||
|
$pfileDir = Split-Path $pfilePath -Parent
|
||||||
|
if (-not (Test-Path $pfileDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $pfileDir -Force | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
& oradim -new -sid ROA -startmode auto -pfile "C:\Users\oracle\admin\ROA\pfile\initROA.ora" 2>&1 | Out-Null
|
# Create PFILE with tested configuration
|
||||||
|
$pfileContent = @"
|
||||||
|
# Initialization Parameters for ROA Database - DR VM
|
||||||
|
# Auto-generated by rman_restore_from_zero.ps1 - $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')
|
||||||
|
|
||||||
|
# Database Identification
|
||||||
|
db_name=ROA
|
||||||
|
db_unique_name=ROA
|
||||||
|
|
||||||
|
# Memory Configuration
|
||||||
|
memory_target=1024M
|
||||||
|
memory_max_target=1024M
|
||||||
|
|
||||||
|
# File Locations
|
||||||
|
control_files=('C:\Users\oracle\oradata\ROA\control01.ctl', 'C:\Users\oracle\recovery_area\ROA\control02.ctl')
|
||||||
|
db_recovery_file_dest='C:\Users\oracle\recovery_area'
|
||||||
|
db_recovery_file_dest_size=50G
|
||||||
|
audit_file_dest='C:\Users\oracle\admin\ROA\adump'
|
||||||
|
|
||||||
|
# Redo and Archive Log
|
||||||
|
log_archive_format=%t_%s_%r.dbf
|
||||||
|
|
||||||
|
# Compatibility
|
||||||
|
compatible=19.0.0
|
||||||
|
|
||||||
|
# Character Set
|
||||||
|
nls_language=AMERICAN
|
||||||
|
nls_territory=AMERICA
|
||||||
|
|
||||||
|
# Processes and Sessions
|
||||||
|
processes=300
|
||||||
|
sessions=472
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
diagnostic_dest='C:\Users\oracle'
|
||||||
|
_allow_resetlogs_corruption=TRUE
|
||||||
|
"@
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pfileContent | Out-File -FilePath $pfilePath -Encoding ASCII -ErrorAction Stop
|
||||||
|
Write-Host " [OK] Created PFILE: $pfilePath" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host "ERROR: Failed to create PFILE: $_" -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& oradim -new -sid ROA -startmode auto -pfile $pfilePath 2>&1 | Out-Null
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Write-Host "ERROR: Failed to create Oracle service" -ForegroundColor Red
|
Write-Host "ERROR: Failed to create Oracle service" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user