8. 創(chuàng)建兩個(gè)數(shù)據(jù)庫(kù),用來(lái)做測(cè)試
IF DB_ID ('MarketingDB') IS NULL CREATE DATABASE MarketingDB; GO IF DB_ID ('DevelopmentDB') IS NULL CREATE DATABASE DevelopmentDB; GO
9. 創(chuàng)建classifier function
IF OBJECT_ID ('dbo.MyClassifier') IS NOT NULL DROP FUNCTION dbo.MyClassifier; GO
CREATE FUNCTION dbo.MyClassifier () RETURNS SYSNAME WITH SCHEMABINDING AS BEGIN DECLARE @GroupName SYSNAME; IF ORIGINAL_DB_NAME () = 'MarketingDB' SET @GroupName = 'MarketingGroup'; ELSE IF ORIGINAL_DB_NAME () = 'DevelopmentDB' SET @GroupName = 'DevelopmentGroup'; ELSE SET @GroupName = 'Default'; RETURN @GroupName; END; GO
這里,Sqlserver2008對(duì)于 Resource Governor 的設(shè)計(jì)方式,很類似代理。Resource Governor 通過(guò)一個(gè)方法來(lái)綁定數(shù)據(jù)庫(kù)對(duì)象到WorkLoad Group ,這個(gè)方法需要外部給出定義,并且手動(dòng)綁定到Resource Governor 上面,定義方式可以參照上面代碼。分別將兩個(gè)測(cè)試用數(shù)據(jù)庫(kù)綁定到各自的Group中,其他的數(shù)據(jù)庫(kù)綁定到Default上面。
10. 綁定Classifier Function 到Resource Governor上面。
ALTER RESOURCE GOVERNOR WITH (CLASSIFIER_FUNCTION = dbo.MyClassifier); GO
11. 更新Resource Governor 配置信息
ALTER RESOURCE GOVERNOR RECONFIGURE; GO
出處:哈利路亞
責(zé)任編輯:bluehearts
上一頁(yè) SQL Server2008 Resource Governor [2] 下一頁(yè) SQL Server2008 Resource Governor [4]
◎進(jìn)入論壇網(wǎng)絡(luò)編程版塊參加討論
|