Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force restore over existing database 2

Status
Not open for further replies.

password99

Technical User
Jul 19, 2002
122
US
Restore Database Option

How do I Force restore over existing database in Transact-SQL?
 
use the switch REPLACE as ...


RESTORE DATABASE { database_name | @database_name_var }
< file_or_filegroup > [ ,...n ]
[ FROM < backup_device > [ ,...n ] ]
[ WITH
{ PARTIAL }
[ [ , ] FILE = { file_number | @file_number } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]
[ ,...n ]
[ [ , ] NORECOVERY ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]

[ [ , ] REPLACE ]

[ [ , ] RESTRICTED_USER ]
[ [ , ] RESTART ]
[ [ , ] STATS [= percentage ] ]



Thanks

J. Kusch
 
The reason I need to do this is..when I used it itout this option and restores from backup the restored DB became unusable (suspect). Ideas?
 
If the database is suspect, you can also run the sp_resetstatus command. Refer to the Books OnLine.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top