Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Difference Between Restore And Attach Expand / Collapse
Author
Message
Posted Tuesday, September 03, 2013 9:53 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Yesterday @ 1:00 PM
Points: 413, Visits: 441
What is the difference between Attach And Restoring a Database in Sql Server?Looks like a Simple question?please folks share your comments?
Post #1491019
Posted Tuesday, September 03, 2013 9:56 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:20 PM
Points: 41,529, Visits: 34,445
Restore you take a database backup and SQL creates a database with database files from that backup
Attach you just have the database files (no backup) and SQL creates the database using those files.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1491020
Posted Tuesday, September 03, 2013 2:59 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 4:31 PM
Points: 32,780, Visits: 14,941
In practice, a restore typically has .bak, .trn., and .dif files. The attach usually has .mdf, .ldf, and .ndf files.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1491097
Posted Thursday, September 05, 2013 6:52 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, March 10, 2014 8:38 AM
Points: 107, Visits: 205
Shaw,
I think below one is also one of the differences what do you say?
Restore will create the new database and Attach will just create the existing database.
Thanks in advance for your input.


Thanks,
I’m nobody but still I’m somebody to someone………….
Post #1491760
Posted Thursday, September 05, 2013 7:08 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:20 PM
Points: 41,529, Visits: 34,445
Before you attach, there is no database. Just files in the file system. So no, that's not correct.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1491767
Posted Thursday, September 05, 2013 7:15 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 6:04 AM
Points: 3,517, Visits: 2,606
So we can say
"Attach is used to move a database physically and restore is used to create/modify database as per requirement based on backups"
Post #1491770
Posted Thursday, September 05, 2013 7:30 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, March 10, 2014 8:38 AM
Points: 107, Visits: 205
Ok accepted Shaw
If you check the created date i think restored database will be the recent date but attached DB date will be old date.


Thanks,
I’m nobody but still I’m somebody to someone………….
Post #1491785
Posted Thursday, September 05, 2013 8:42 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:20 PM
Points: 41,529, Visits: 34,445
sqlnaive (9/5/2013)
"Attach is used to move a database physically and restore is used to create/modify database as per requirement based on backups"


If you like. It's not true though.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1491824
Posted Thursday, September 05, 2013 8:51 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 6:04 AM
Points: 3,517, Visits: 2,606
GilaMonster (9/5/2013)
sqlnaive (9/5/2013)
"Attach is used to move a database physically and restore is used to create/modify database as per requirement based on backups"


If you like. It's not true though.


Which part Gail ? Would like to be rectified.
Post #1491827
Posted Thursday, September 05, 2013 8:54 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:20 PM
Points: 41,529, Visits: 34,445
Attach is not the only way to move a database physically and restore doesn't modify databases (doesn't create them technically, the database was created previously if a backup exists)


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1491830
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse