sql server dts:
Check this code snipet for Restore
1) Remove backup devices if any
Set moRST = New sqldmo.Restore
With moRST
..DataBase =
..Devices =
..ReplaceDatabase =
..PercentCompleteNotification = 10
..SQLRestore moSRV
End With
Cheers
Sundar
[quoted text, click to view] "Derrick" wrote:
> Hi All,
>
> I found a sample of how to backup/restore a database .bak using sql dmo and
> have it working.
>
> Question on one thing, if I want to restore the .bak into a new database...
> What I did was to allow input of new db name, create new db using sql-dmo,
> and then use that db as the db to restore into.
>
> Problem is that if I set ReplaceDatabase=false, it complains about the new
> db name not being the backup db name. If I set ReplaceDatabase=true, then
> it attempts to use the data file names in the backup, which are already
> present in the data dir for another db.
>
> So, question is, how do i tell sql dmo to restore a .back file, over an
> existing (new really) db, but to use the data file names in the db, not the
> backup? You can do it thru the mmc ui, so I am guessing there is a way to
> do it thru sql-dmo.
>
> Is there any "restoreAs" some new db option so I don't have to screw around
> with creating a new database myself?
>
> Thanks in advance!
>
> Derrick
>
>
Hi All,
I found a sample of how to backup/restore a database .bak using sql dmo and
have it working.
Question on one thing, if I want to restore the .bak into a new database...
What I did was to allow input of new db name, create new db using sql-dmo,
and then use that db as the db to restore into.
Problem is that if I set ReplaceDatabase=false, it complains about the new
db name not being the backup db name. If I set ReplaceDatabase=true, then
it attempts to use the data file names in the backup, which are already
present in the data dir for another db.
So, question is, how do i tell sql dmo to restore a .back file, over an
existing (new really) db, but to use the data file names in the db, not the
backup? You can do it thru the mmc ui, so I am guessing there is a way to
do it thru sql-dmo.
Is there any "restoreAs" some new db option so I don't have to screw around
with creating a new database myself?
Thanks in advance!
Derrick