all groups > sql server dts > march 2007 >
You're in the

sql server dts

group:

SQL-DMO Question



RE: SQL-DMO Question Sundar Murugappan
3/15/2007 9:29:40 AM
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]
SQL-DMO Question Derrick
3/15/2007 11:18:02 AM
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

AddThis Social Bookmark Button