I have several Tb databases in the Windows Server 2008. I would like to keep alive the service when the server is failing or the raids are needs to be rebuild.
Which model to choose Replication or Mirroring? And how to setup that the alive server will takeover the dead one?
Thans Arman.
Ah now that is the ultimate question! You will get 101 responses no doubt but if your question is actually asking which of these technologies is probably best suited to making a database available then I would go for Mirroring every single time. Replication is fantastic for scaling of data, and improving availability of subsets of data.
If your question is what infrastructure can I put in place to aim towards 5 nines or better availability then I would start talking about Clustering, Virtualization and Peer to peer replication (last I'd only go for in SQL 2008 R2).
Going back to the Mirroring, for automatic failover you will need a witness server and your server name resolution will need to be addressed (one solution is that you can use failover partner in connection string).
See URL Database Mirroring
Mirroring that is set up in high-safety mode with the presence of a witness can allow for a switch of the active database instance in a way that is seamless to the application. The catch is that it's a synchronous operation every time there's a transaction... meaning it must be committed on both nodes before the transaction is complete. Therefore, there is increased latency.
With replication, the application has to be aware and be ready to do the switch if it detects a node not up. This is not automatic and definitely not seamless to the application. However, you don't have the transaction latency because it's not synchronous (changes are replicated as soon as possible but not confirmed across all nodes before the transaction is committed).