Sorry, not to disparage Thomas' advice, but please take "general rules" with a grain of salt, or just throw them out the window altogether.
Baseline.
What is normal for your system? Is the system currently responding ok?
If there is no performance issue, don't try to compare your system to some number someone plucked out of the air or potentially based off some very specific system and workload years ago, and drop everything to try to "fix" it.
Specifically, batch requests and compilations don't have a very nice and handy correlation in ALL scenarios. You need to understand your workload before you start panicking because your counters hit some threshold someone put in a post somewhere. If all of your batches consist of exactly one statement, then yes, having more compilations/sec than batch requests/sec might seem out of the ordinary (but still might not indicate a problem). In most cases, you are sending more than one statement in a batch. If this is the case - and particularly if you are using things like ORMs or a lot of highly variable dynamic SQL, where you will be suffering from a high number of compilations - I would really not be surprised to see one counter higher than the other.
Whether you need to do something about that, in that case, is a completely different problem.
Yes, other than the 2012R2 bit what you are describing can be done, but to correct some of the terminology I think you are describing the following:
- A 4 server Window Geo cluster with 3 servers in Data Centre 1 (DC1) and one server in Data Centre 2 (DC2).
- Instance of SQL 2012 lets call it INST01 on server SQL1 in DC1. This instance will be used for your infrastructure dbs.
- Instance of SQL 2012 lets call it INST02 on server SQL2 in DC1. This instance will be used for your user dbs.
- Instance of SQL 2012 lets call it INST03 on server SQL3 in DC1. This instance will be used to run your local AOG replicas in normal running.
- Instance of SQL 2012 lets call it INST04 on server SQL4 in DC2. This instance will be used to run your DR AOG replicas in normal running.
From an always on perspective you will have:
- AOG group called ITDBS. This will exist across INST01, INST03 AND INST04. Always On Group ITDBS on INST01 would be the primary holding your infrastructure dbs and INST03 would be synchronous read only replicas (handy for reporting/scaling out) and INST04 would be asynch replicas for your DR scenario.
- AOG group called USERDBS. This will exist across INST02, INST03 AND INST04. Always On Group USERDBS on INST02 would be the primary holding your infrastructure dbs and INST03 would be synchronous read only replicas (handy for reporting/scaling out) and INST04 would be asynch replicas for your DR scenario.
The above Always On Group configuration assumes 1 AOG for each db type on each server, you will have to consider if you need to subdivide dbs if so just create more Always on groups. An AOG is basically just a way of grouping databases so they fail over as a logical consistent unit (unlike mirroring where there is no consistency across dbs in terms of failing over).
The above scenario gives you high availability with automatic failover if you wish due to synchronous replicas in DC1. It also gives you DR capability albeit with a manual failover to your SQL4 server in DC2.
If SQL1 and SQL2 are big enough you could use each as the others synchronous replicas thus avoiding the need for SQL3 (ie SQL1 sync reps would live on SQL2 and vice versa) but SQL1 and SQL2 would need to be big enough hardware to cater for the loads in the event of failure. This may save you some money. You would need to work out the costs of having SQL3 (hardware and SQL licenses) against the extra CPUs and memory you would need in SQL1 and SQL2 to run the extra load during failure.
From a licensing perspective and storage perspective quite expensive and all 4 servers need full Enterprise SQL licenses and all non shared storage.
One other possible way to save a bit on storage and everything is have a 3 server windows cluster with 2 in DC1 and 1 in DC2. Have SQL1 and SQL2 as a SQL failover active/passive cluster. This would mean in SQL2014 as long as you have Software Assurance for the license you get 28 days free failover to the passive node. This would save a lot on licensing but also storage as the 2 server SQL cluster would be using shared storage. The down side of this option is that failover is not instant as it is in your solution, there is a 20 second delay or so for the cluster service to failover (depends on disks etc). Your Always On Group would then include the FCI and the SQL3 in DC2. Also another downside of having an FCI in an AOG is you lose automatic failover, but the dbs in DC2 are asynch replicas so you wouldnt have feature anyway.
Also think about your quorum design, 3 would be a bit trickier you would need a vote from a witness disk and to use the DR server you would need to force quorum if both DC1 servers were down but once documented it is easy for your ops/dbas to follow.
Lots of info to consider, hope this helps.
Best Answer
The answer is: you cannot run heavy scripts and not slow down the DB server.
I quess all you have to do is to pick kind of light-workload-hours and
REBUILD
indexes one by one with your own hands monitoring blocking and overall server load.General advice would be to use
ALTER INDEX <IndexName> REBUILD;
instead of recreating them.
Also consider
ALTER INDEX
options here such as:Have a look at these useful links:
Take care about free space when rebuilding online, as stated here.