ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã«ããå®æçãªãã¼ã¿åé
SQL Server 2008 ããã¯ããã¼ã¿ ã³ã¬ã¯ã·ã§ã³æ©è½ããµãã¼ãããã¾ãããããã¯ãå®æçãªãã¼ã¿åéãè¡ããæ©è½ã§ãããã©ã¼ãã³ã¹ ãã¥ã¼ãã³ã°æã«å¤§å¤å½¹ç«ã¤æ©è½ã§ãããã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã§ã¯ãä»»æã® Transact-SQL ã¹ãã¼ãã¡ã³ãã¨ãããã©ã¼ãã³ã¹ ã«ã¦ã³ã¿ããã¬ã¼ã¹ãããã¼ã¿ãåéãããã¨ãã§ããã®ã§ãããã©ã¼ãã³ã¹ç¶æ³ãç£è¦ã§ããåç管çãã¥ã¼ï¼DMVï¼Dynamic Management Viewï¼ãå®æçã«ã¯ã¨ãªããããCPU ãã¡ã¢ãªãªã©ã®ããã©ã¼ãã³ã¹ ã«ã¦ã³ã¿ãå®æçã«åå¾ããã¨ãã£ã使ãæ¹ãã§ãã¾ãã
ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã¯ã次ã®ããã«è¨å®ãããã¨ãã§ãã¾ãã
ã¾ãã¯ã[管çï¼½ãã©ã«ããå±éãã¦ï¼»ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ï¼½ãå³ã¯ãªãã¯ãã[管çãã¼ã¿ã¦ã§ã¢ãã¦ã¹ã®æ§æï¼½ãã¯ãªãã¯ãã¾ãã
[管çãã¼ã¿ ã¦ã§ã¢ãã¦ã¹æ§æã¦ã£ã¶ã¼ãï¼½ã®æåã®ãã¼ã¸ã§ã¯ã[管çãã¼ã¿ã¦ã§ã¢ãã¦ã¹ãä½æã¾ãã¯ã¢ããã°ã¬ã¼ãããï¼½ãé¸æãã¦ã[次ã¸ï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã§ã¯ãåéãããã¼ã¿ããã¼ã¿ãã¼ã¹ã¸æ ¼ç´ããã®ã§ããã®æ ¼ç´å
ã¨ãªããã¼ã¿ãã¼ã¹ãä½æãã¦ããå¿
è¦ãããã¾ããããã§ã¯ã次ã®ããã«ï¼»æ°è¦ä½æï¼½ãã¿ã³ãã¯ãªãã¯ãã¦ããDataCollectionDWHãã¨ããååã§ä½æãã¦ããã¾ãã
ç¶ãã¦ããã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã®ç®¡çè
ã¢ã«ã¦ã³ãã¨ãã¦è¿½å ããããã°ã¤ã³ ã¢ã«ã¦ã³ããä»»æã§æå®ãã[次ã¸ï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
æå¾ã®ãã¼ã¸ï¼»ã¦ã£ã¶ã¼ãã®å®äºï¼½ã§ã¯ãï¼»å®äºï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
次ã«ãããä¸åº¦ï¼»ç®¡çãã¼ã¿ ã¦ã§ã¢ãã¦ã¹æ§æã¦ã£ã¶ã¼ãï¼½ãèµ·åãã¾ãã
ï¼»æ§æã¿ã¹ã¯ã®é¸æï¼½ç»é¢ã§ã¯ãä»åº¦ã¯ãï¼»ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ãã»ããã¢ããããï¼½ãé¸æãã¦ã[次ã¸ï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
次ã®ï¼»ç®¡çãã¼ã¿ ã¦ã§ã¢ãã¦ã¹ ã¹ãã¬ã¼ã¸ã®æ§æï¼½ç»é¢ã§ã¯ãåã®æé ã§ä½æãããã¼ã¿ãã¼ã¹ã¨ä»»æã® Windows ä¸ã®ãã©ã«ããæå®ãã¦ã[次ã¸ï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
æå¾ã®ï¼»ã¦ã£ã¶ã¼ãã®å®äºï¼½ç»é¢ã§ã¯ãï¼»å®äºï¼½ãã¿ã³ãã¯ãªãã¯ãã¾ãã
ã¦ã£ã¶ã¼ãã®å®äºå¾ããªãã¸ã§ã¯ã ã¨ã¯ã¹ããã¼ã©ã§ã次ã®ããã« DataCollectionDWH ãã¼ã¿ãã¼ã¹å
ã®ãã¼ãã«ãåç
§ããã¨ãã¦ã£ã¶ã¼ãã«ãã£ã¦å¤ãã®ãã¼ãã«ãèªåä½æããã¦ãããã¨ã確èªã§ãã¾ãã
ç¶ãã¦ãCollection Set 㨠Collection Item ãä½æããããã«ã次㮠SQL ã¹ãã¼ãã¡ã³ããå®è¡ãã¾ãã
-- CollectorSchedule_Every_5min ã®uid ãåå¾ USE msdb DECLARE @schedule_uid uniqueidentifier SELECT @schedule_uid = (SELECT schedule_uid FROM sysschedules_localserver_view WHERE name=N'CollectorSchedule_Every_5min') -- Collection Set ã®ä½æ DECLARE @collection_set_id int EXEC dbo.sp_syscollector_create_collection_set @name = N'DCtest1', @schedule_uid = @schedule_uid, @collection_mode = 1, @days_until_expiration = 30, @description = N'ãã¹ã', @collection_set_id = @collection_set_id output DECLARE @params XML SELECT @params = CONVERT(XML, N'<ns:TSQLQueryCollector xmlns:ns="DataCollectorType"> <Query> <Value>SELECT GETDATE() AS ç¾å¨æå»</Value> <OutputTable>DCtest_GetDate</OutputTable> </Query> </ns:TSQLQueryCollector>') -- Collection Item ã®ä½æ -- @collector_type_uid ã®'302Eã' ã¯ãT-SQL Query Collector Type DECLARE @collection_item_id int EXEC dbo.sp_syscollector_create_collection_item @collection_set_id = @collection_set_id, @collector_type_uid = N'302E93D1-3424-4BE7-AA8E-84813ECF2419', @name = 'DMVtest1', @frequency = 30, @parameters = @params, @collection_item_id = @collection_item_id output;
ãã㧠GETDATE é¢æ°ã§åå¾ããçµæã DCtest_GetDate ãã¼ãã«ã¸æ ¼ç´ã§ããããã«ãªãã¾ãã
å®è¡å¾ãä½æãã ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ ã»ãããèµ·åããããã«ã次ã®ããã«ãDCtest1ããå³ã¯ãªãã¯ãã¦ãï¼»ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ ã»ããã®éå§ï¼½ãã¯ãªãã¯ãã¾ãã
次ã«ãæåã§ãã¼ã¿ãåéããããã«ãDCtest1 ãå³ã¯ãªãã¯ãã¦ï¼»ä»ããåéãã¦ã¢ãããã¼ãï¼½ãã¯ãªãã¯ãã¾ãã
æ£å¸¸ã«ãã¼ã¿ãåéããããã©ããã確èªããããã«ãDCtest1 ãå³ã¯ãªãã¯ãã¦ï¼»ãã°ã®è¡¨ç¤ºï¼½ãã¯ãªãã¯ãããã°ãåç
§ãã¾ãã
åéããããã¼ã¿ã確èªããããã«ãDataCollectionDWH ãã¼ã¿ãã¼ã¹å
ã®ãã¼ãã«ãåç
§ãã¾ãã
custom_snapshot ã¹ãã¼ãã®ãDCtest_GetDateããã¼ãã«ãä½æãããGETDATE ã®å®è¡çµæãæ ¼ç´ããã¦ãããã¨ã確èªã§ãã¾ãã
ãã®ããã« ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³æ©è½ãå©ç¨ããã¨ãä»»æã® Transact-SQL ã¹ãã¼ãã¡ã³ããå®æçã«å®è¡ãã¦ããã¼ã¿ãåéãããã¨ãã§ããã®ã§ãããã©ã¼ãã³ã¹ ãã¥ã¼ãã³ã°æã«å¤§å¤å½¹ç«ã¡ã¾ããã¾ãããã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã§ã¯ãããã©ã¼ãã³ã¹ ã«ã¦ã³ã¿ã¨ãã¬ã¼ã¹ããããã¼ã¿ãåéãããã¨ãã§ããã®ã§ããããã便å©ã§ãã
ã¾ãããã¼ã¿ ã³ã¬ã¯ã·ã§ã³ã§ã¯ãå®ã¯ãã·ã¹ãã ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ãã¨å¼ã°ããçµã¿è¾¼ã¿ã® ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ãç¨æããã¦ãã¦ã主è¦ãªåç管çãã¥ã¼ã¨ããã©ã¼ãã³ã¹ ã«ã¦ã³ã¿ãèªåçã«åå¾ããã¦ãã¾ãããã®æ©è½ã¯ãããã©ã¼ãã³ã¹ ãã¼ã¿ ã³ã¬ã¯ã·ã§ã³ãã¨å¼ã°ããã°ã©ãã£ã«ã«ãªã¬ãã¼ãã表示å¯è½ã«ãªãã¾ããããã«ã¤ãã¦ã¯ãå¼ç¤¾å·çã® SQL Server 2008 èªç¿æ¸ã·ãªã¼ãºï¼ä¸è¨ URLï¼ã®ãSQL Server 2008 ã®æ³¨ç®ã®æ°æ©è½ãã¤ãæ©ã試ãã¦ã¿ãã! ãç·¨ãåèã«ãã¦ã¿ã¦ãã ããã
http://www.microsoft.com/japan/sqlserver/2008/self-learning/default.mspx