# Renseigner les variables ci-dessous avec les valeurs appropriees a votre environnnement avant de lancer le script

$JAVA_HOME =

$DBFOLDERPATH =
$DELETEDBFOLDER = "true"
$ZIPFILEPATH =
$DPDUMPFOLDERPATH =
$SCHEMANAME =
$DPDUMPONLY = "false"
$ORACLEHOSTNAME =
$ORACLESERVICE = 
$ORACLESID =
$ORACLEPORT =
#$SQLSCRIPTPATH=


$ORACLEADMINACCOUNTNAME = "SYSTEM"
$ORACLEADMINACCOUNTPWD = "SYSTEM"
#$ORACLEADMINACCOUNTPWDFILE=
$USERSPASSWORDSREMOVAL = "false"

if ($PSVersionTable.PSVersion.Major -lt 3) 
{
	$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}

$LIB = "$PSScriptRoot\DBManagerCmdLine.jar"
$JAVA = "'$JAVA_HOME\bin\java.exe'"
$CMD = "$JAVA -cp '$LIB' db.manager.cmd.DBRestoreCmd"


$CMD = "$CMD -dbfolderpath '$DBFOLDERPATH'"
$CMD = "$CMD -deletedbfolder $DELETEDBFOLDER"
$CMD = "$CMD -zipfilepath '$ZIPFILEPATH'"
$CMD = "$CMD -dpdumpfolderpath '$DPDUMPFOLDERPATH'"
$CMD = "$CMD -schemaname $SCHEMANAME"
$CMD = "$CMD -oraclehostname $ORACLEHOSTNAME"
#$CMD = "$CMD -oraclesid $ORACLESID"
$CMD = "$CMD -oracleservice $ORACLESERVICE"
$CMD = "$CMD -oracleport $ORACLEPORT"
$CMD = "$CMD -oracleadminaccountname $ORACLEADMINACCOUNTNAME"
$CMD = "$CMD -oracleadminaccountpwd $ORACLEADMINACCOUNTPWD"
#$CMD="$CMD -oracleadminaccountpwdfile $ORACLEADMINACCOUNTPWDFILE"
$CMD = "$CMD -userspasswordsremoval $USERSPASSWORDSREMOVAL"
$CMD = "$CMD -dpdumponly $DPDUMPONLY"
#$CMD="$CMD -sqlscriptpath '$SQLSCRIPTPATH'"

Invoke-Expression "& $CMD"

exit $LASTEXITCODE



