標記爲您在註釋中規定
「我不能保證我將有適當的特權」
要麼你有在你的安裝程序中寫入某種功能,以確保你擁有適當的權限ges(也許不會在沒有管理員設置權限的情況下安裝)用於遠程perf。計數器訪問。
您沒有說明正是你所要監控,但是,我可能會建議使用內置INT的SQL Server動態管理視圖(DMV的)
MSDN
Good Articles Videos
Very Useful Examples
這些在SQL服務器的最新版本中已經變得非常強大,並且允許您監視您在perfmon(CPU,IO,MEMORY等等)中使用的大多數統計信息。也許不像perfmon那麼精細,但通常我發現它們更有用,然後現在執行快速相關的數據。只要你的連接字符串用戶有管理權限,你不必擔心服務器權限。而且這個功能已經內置到sql-server中了。看一看。
編輯... @馬克下面是我用得到IO時間在數據庫上有些DMV腳本,而不是精確的性能監視器但它可以讓你專注在一個特定的數據庫文件。
時退房「dm_io_virtual_file_stats」 DMV
select
read_stall_ms = case when num_of_reads = 0 then 0 else (io_stall_read_ms/num_of_reads) end,
write_stall_ms = case when io_stall_write_ms = 0 then 0 else (io_stall_write_ms/num_of_writes) end,
total_stall_ms = case when (num_of_reads = 0 and num_of_writes = 0) then 0 else (io_stall/(num_of_reads + num_of_writes)) end,
db = db_name(vfs.database_id),
mf.physical_name,
vfs.*
from sys.dm_io_virtual_file_stats(null, null) as vfs
join sys.master_files as mf on vfs.database_id = mf.database_id and vfs.file_id = mf.file_id
order by total_stall_ms desc
select m.database_id,
db_name(m.database_id) as database_name,
m.file_id,
m.name as file_name,
m.physical_name,
m.type_desc,
fs.num_of_reads,
fs.num_of_bytes_read,
fs.io_stall_read_ms,
fs.num_of_writes,
fs.num_of_bytes_written,
fs.io_stall_write_ms
from sys.dm_io_virtual_file_stats(NULL, NULL) fs
join sys.master_files m on fs.database_id = m.database_id and fs.file_id = m.file_id
東西有點票友......
select db_name(d.database_id) as database_name,
quotename(object_schema_name(d.object_id, d.database_id)) + N'.' + quotename(object_name(d.object_id, d.database_id)) as object_name,
d.database_id,
d.object_id,
d.page_io_latch_wait_count,
d.page_io_latch_wait_in_ms,
d.range_scans,
d.index_lookups,
case when mid.database_id is null then 'N' else 'Y' end as missing_index_identified
from (select
database_id,
object_id,
row_number() over (partition by database_id order by sum(page_io_latch_wait_in_ms) desc) as row_number,
sum(page_io_latch_wait_count) as page_io_latch_wait_count,
sum(page_io_latch_wait_in_ms) as page_io_latch_wait_in_ms,
sum(range_scan_count) as range_scans,
sum(singleton_lookup_count) as index_lookups
from sys.dm_db_index_operational_stats(NULL, NULL, NULL, NULL)
where page_io_latch_wait_count > 0
group by database_id, object_id) as d
left join (select distinct database_id, object_id from sys.dm_db_missing_index_details) as mid on mid.database_id = d.database_id and mid.object_id = d.object_id
只是爲了說明一下,您希望您的數據庫能夠收集運行應用程序的計算機的性能計數器統計信息,對嗎? – 2012-01-13 16:46:33
MS-SQL CLR有一個安全模式,我相信您可以根據您的要求使用 - 請參閱http://msdn.microsoft.com/en-us/library/ms345101.aspx – 2012-01-13 16:55:41
@ M.Babcock我想要我的應用程序或SQL服務器收集運行SQL Server的計算機的性能計數器統計信息。 – Mark 2012-01-13 19:19:58