Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jrahman777
Starting Member
6 Posts |
Posted - 2012-07-03 : 14:30:45
|
| I have a question:While the database is online can we restore the same database over? What happens if we don't use any parameters like overwrite existing database or something?Any reply will be appreciated.jannat rahman |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2012-07-04 : 01:54:49
|
| Read up on the RESTORE..WITH REPLACE option. Basically , will allow an overwrite over an existing db.Jack Vamvas--------------------http://www.sqlserver-dba.com |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2012-07-04 : 03:52:50
|
| umm..you can't you have to kick everyone out and set the db to single user modeWHY? |
 |
|
|
jrahman777
Starting Member
6 Posts |
Posted - 2012-07-04 : 10:46:04
|
| Thank you both.jannat rahman |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2012-07-04 : 14:31:17
|
Or, you can just drop the database before running the restore. Makes things simpler because no one can be connected to a database that doesn't exist.use master-- Set database offline to kick everyone outalter database [MyDatabase] set offline with rollback immediate-- Set database online before dropping it because database files-- are only deleted when database is dropped while it is online. alter database [MyDatabase] set online with rollback immediatedrop database [MyDatabase]restore database [MyDatabase]... rest of restore command ... CODO ERGO SUM |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2012-07-05 : 01:50:18
|
| Added to my earlier RESTORE..WITH REPLACE , for extra clarity - kill existing connections first,Jack Vamvas--------------------http://www.sqlserver-dba.com |
 |
|
|
|
|
|