SQL Server數(shù)據(jù)庫服務(wù)器高性能設(shè)置
導(dǎo)讀:數(shù)據(jù)庫服務(wù)器主要用于存儲(chǔ)、查詢、檢索企業(yè)內(nèi)部的信息,因此需要搭配專用的數(shù)據(jù)庫系統(tǒng),對服務(wù)器的兼容性、可靠性和穩(wěn)定性等方面都有很高的要求。SQL Server數(shù)據(jù)庫就是一款很好用的數(shù)據(jù)庫管理系統(tǒng),要想實(shí)現(xiàn)SQL Server數(shù)據(jù)庫更強(qiáng)大的功能,就得提高服務(wù)器的性能。下文將為大家介紹實(shí)現(xiàn)SQL Server數(shù)據(jù)庫服務(wù)器高性能的設(shè)置。
下面是進(jìn)行籠統(tǒng)的技術(shù)點(diǎn)說明,為的是讓大家有一個(gè)整體的概念,如果想深入可以逐個(gè)擊破;
<!--[if !supportLists]-->一、<!--[endif]-->服務(wù)器規(guī)劃:
<!--[if !supportLists]-->1. <!--[endif]-->使用64位的操作系統(tǒng),***是2008的;(Windows Server 2008 64位)
<!--[if !supportLists]-->2. <!--[endif]-->使用64位的數(shù)據(jù)庫程序,***是2008的;(SQL Server 2008 64位)
<!--[if !supportLists]-->3. <!--[endif]-->使用千兆網(wǎng)卡;
<!--[if !supportLists]-->4. <!--[endif]-->使用硬RAID5;
<!--[if !supportLists]-->5. <!--[endif]-->使用64K的簇大?。?/p>
<!--[if !supportLists]-->6. <!--[endif]-->LUN0用作系統(tǒng)盤,LUN1用作程序(主要是數(shù)據(jù)庫程序)安裝盤,LUN2用作數(shù)據(jù)庫文件盤,動(dòng)態(tài)盤;
<!--[if !supportLists]-->二、<!--[endif]-->系統(tǒng)設(shè)置:
如果服務(wù)器使用的配置是:Windows Server 2003 x86 + SQL Server 2005 x86 + 12G內(nèi)存
<!--[if !supportLists]-->1. <!--[endif]-->使用Windows Server 2003 Enterprise Edition,如果有可能的話也可以使用Windows 2003 Datacenter Edition;
<!--[if !supportLists]-->2. <!--[endif]-->在boot.ini中啟用pae;
<!--[if !supportLists]-->3. <!--[endif]-->使用gpedit.msc設(shè)置【內(nèi)存中鎖定頁】;
<!--[if !supportLists]-->4. <!--[endif]-->設(shè)置虛擬內(nèi)存到系統(tǒng)盤之外的物理磁盤中,如果是同一塊物理磁盤,分到其它邏輯分區(qū)也可以;設(shè)置大小看情況而定;
<!--[if !supportLists]-->5. <!--[endif]-->去掉【***化文件共享數(shù)據(jù)吞吐量】,選擇【***化網(wǎng)絡(luò)應(yīng)用程序數(shù)據(jù)吞吐量】
<!--[if !supportLists]-->三、<!--[endif]-->數(shù)據(jù)庫設(shè)置:
<!--[if !supportLists]-->1. <!--[endif]-->設(shè)置數(shù)據(jù)庫的AWE,如果是16G的內(nèi)存,一般是分配80%內(nèi)存給數(shù)據(jù)庫程序使用;
<!--[if !supportLists]-->2. <!--[endif]-->設(shè)置數(shù)據(jù)庫實(shí)例的增長為10%,具體需要設(shè)置多少需要看你的業(yè)務(wù)需要,其目的就是盡量減少磁盤空間的分配次數(shù)還有較少磁盤碎片的產(chǎn)生;
<!--[if !supportLists]-->3. <!--[endif]-->設(shè)置數(shù)據(jù)庫實(shí)例的恢復(fù)模式為簡單模式,如果在可以的情況下;
<!--[if !supportLists]-->4. <!--[endif]-->設(shè)置TempDB的大小,一般來說可以給到4G以上,看具體需要和環(huán)境;
<!--[if !supportLists]-->5. <!--[endif]-->把除了SQL Server和SQL Server Browser 的其它數(shù)據(jù)庫服務(wù)都停止掉,除非你有使用到這些服務(wù)的需要;
<!--[if !supportLists]-->四、<!--[endif]-->數(shù)據(jù)庫設(shè)計(jì):
<!--[if !supportLists]-->1. <!--[endif]-->表分區(qū);(單臺(tái)數(shù)據(jù)庫服務(wù)器)
<!--[if !supportLists]-->2. <!--[endif]-->事件復(fù)制讀寫分離;(兩臺(tái)數(shù)據(jù)庫服務(wù)器)
<!--[if !supportLists]-->3. <!--[endif]-->對等事務(wù)復(fù)制;(多臺(tái)數(shù)據(jù)庫服務(wù)器)
<!--[if !supportLists]-->五、<!--[endif]-->SQL優(yōu)化:
<!--[if !supportLists]-->1. <!--[endif]-->創(chuàng)建合適的索引;
<!--[if !supportLists]-->2. <!--[endif]-->減少游標(biāo)的使用;
<!--[if !supportLists]-->3. <!--[endif]-->可以考慮CLR編程,比如一些頻繁查詢并且變動(dòng)很小的表;
<!--[if !supportLists]-->4. <!--[endif]-->使用批量操作,減少頻繁而小的操作;
<!--[if !supportLists]-->5. <!--[endif]-->這里的調(diào)優(yōu)細(xì)節(jié)很多,大家可以慢慢深入了解;
這里就為大家總結(jié)到這些,更多的經(jīng)驗(yàn)還需要大家在平時(shí)的工作中,細(xì)心的去總結(jié)發(fā)現(xiàn),如果大家有更多更好的方法經(jīng)驗(yàn),要拿出來曬曬哦,要與大家分享哦。
【編輯推薦】