Hi all,
A few months ago I came here to be able to restore sql server databases using the API instead of the qcommands
So I have the xml file to restore the database and I have a STOPAT parameter.
In the xml it shows like this :
<pointInTime>
<timeValue>2023-05-19 09:54:04</timeValue>
</pointInTime>
My xml file works if I run sth like :
qoperation.exe" execute -cs $CVLTServer -af $CVLTXMLFile -tf $CVLTToken
Then it doesn’t if I run :
$cvrestendpoint = "http://$CVLTServer:81/SearchSvc/CVWebService.svc"
$token = (Get-CVSessionDetail 'Get-CVVersionInfo').sessionToken
$restParameters = @{# Variables for holding rest parameters for the request
URI = ""
Method = ""
Headers = @{"Authtoken" = $token;"Accept" = "application/json"}
body = ""
}Get-Variable | Where-Object {$_.name -eq '$xml'} | Remove-Variable
$xml = get-content CVLTXMLFile$restParameters.URI = $cvrestendpoint + "/ExecuteQCommand"
$restParameters.Headers.'Content-Type' = 'application/x-www-form-urlencoded'
$restParameters.Method = "POST"
$restParameters.Body = "command=qoperation%20execute&inputRequestXML=" + $xml
$result = Invoke-RestMethod @restParameters
$result.jobIds
I get the error :
Error Code: /19:861] Description: Killed by . Reason:o]. Source: , Process: JobManager Query Result >Microsoft.SqlServer.Management.Common.ExecutionFailureException:
The specified STOPAT time is too early. All or part of the database is already rolled forward beyond that point.
RESTORE LOG is terminating abnormally. An exception occurred while executing a Transact-SQL statement or batch.]. Source: wesvsqlu001-bkp, Process: SQLRestore
My sql trace gives me the script run on the instance :
RESTORE LOG bmydb] FROM VIRTUAL_DEVICE = 'c48643e5-05aa-44b2-9328-1cfdd41b3e6e', VIRTUAL_DEVICE = 'c48643e5-05aa-44b2-9328-1cfdd41b3e6e_1'
WITH NORECOVERY, MAXTRANSFERSIZE=2097152, BLOCKSIZE=65536, BUFFERCOUNT=20, STOPAT = '01-01-1970 01:00:00', REPLACE, ...
go
You’ll note the :
STOPAT = '01-01-1970 01:00:00'
I have tried reformatting the date for different cultures and nothing helps.
It starts to look like a bug.
Anyone can help me here ?
thanks,