02-27-2023 11:21 PM
Hi all :
I am trying to restore from a sqlserver database by restore script with command line. But I cannot make it to work because I did not find a command what can execute the restore script.
I found "bprestore" in Administrator guide but it seems like uselessly for sqlserver
Looking forward to your reply,thanks in advance
Solved! Go to Solution.
03-01-2023 01:23 AM - edited 03-01-2023 01:23 AM
The same command you use to backup a SQL database can be used for restores.
The command is
dbbackex -f <bch file> -np
The problem is that you have to create the bch restore script every time. I suggest you to create it in the GUI for the first time and change what needs to be changed with your script.
You have to use the bplist command to find the SQL backup you need to restore. something like this.
bplist -C <SQLHOST> -S <master server> -t 15 -R 99 -s <start date> -e <enddate>
02-28-2023 09:19 PM
@littleboy124 initiating MSSQL restore with bprestore command would be way complicated...
but why do you want to do that when you have easier options available ?
For many years i used to initiate MSSQL restore little differently than others.. check the steps here
1. Ensure you have a restore script available on MSSQL Server in .bch or .bat format.
2. create dummy MSSQL policy on Master Server. Add the target MSSQL Server in clients section. Select the restore script in backup selection. Finally add a dummy schedule which should not have a start window.
3. Initiate a manual backup. This will start a dummy backup job.. which will not be doing anything. This will also start the restore job. Depending on the parameters passed in restore script you may observe the behaviour for restore job.
This proceudre is helpful when DBA dont allow you login to server or you really have challenges in keep logged in yourself.
Thanks,
03-01-2023 01:14 AM - edited 03-01-2023 01:49 AM
@sanket_pathak1 Thank you so much for your reply,it is useful for me
03-01-2023 01:23 AM - edited 03-01-2023 01:23 AM
The same command you use to backup a SQL database can be used for restores.
The command is
dbbackex -f <bch file> -np
The problem is that you have to create the bch restore script every time. I suggest you to create it in the GUI for the first time and change what needs to be changed with your script.
You have to use the bplist command to find the SQL backup you need to restore. something like this.
bplist -C <SQLHOST> -S <master server> -t 15 -R 99 -s <start date> -e <enddate>
03-01-2023 01:48 AM
Thanks so much for your reply ,it means a lot to me