sql server - Restoring database - Cannot access file because it is in use by another process -
i have backup of database sql server 2005 machine. i'm attempting restore sql server 2008 instance.
i have created new database restore go in to, when attempting restore following (generated ssms):
restore database [wendyuat] disk = n'd:\wanda20130503.bak' file = 1, move n'wendy' n'd:\databases\\wendyuat.mdf', move n'wendy_log' n'd:\databases\\wendyuat.ldf', move n'sysft_wendyfti' n'd:\databases\\wendyuat.wendyfti', nounload, replace, stats = 10
i following error:
system.data.sqlclient.sqlerror: operating system returned error '32 (the process cannot access file because being used process.)' while attempting 'restorecontainer::validatetargetforcreation' on 'd:\databases\wendyuat.mdf'.
as far can tell (using process explorer etc) nothing else using file. i've disabled real-time protection in windows defender. cannot understand why sql server thinks file in use windows explorer lets me delete no problems windows doesn't seem think it's in use.
any gratefully received.
how connecting sql server in application before running backup? database connecting to?
you cannot connect wendyuat
database , use when want restore - you'll have explicitly use other database, e.g. master
, before running smo restore code
all t-sql restore scripts include:
use [master] go restore database [wendyuat] ......
so if run backup app, make sure explicitly connect e.g. master
before running t-sql restore script
update:
is did on purpose, or might typo??
move n'wendy' n'd:\databases\\wendyuat.mdf', * ** * * * * 2 backslashes here -why??? * 1 backslash here...
does work if use single backslashes only??
restore database [wendyuat] disk = n'd:\wanda20130503.bak' file = 1, move n'wendy' n'd:\databases\wendyuat.mdf', move n'wendy_log' n'd:\databases\wendyuat.ldf', move n'sysft_wendyfti' n'd:\databases\wendyuat.wendyfti', nounload, replace, stats = 10
Comments
Post a Comment