1. buffer pool的記憶體主要是由那個資料庫佔了?
select
count
(*)*8 as cached_pages_kb,
case database_id
when 32767 then
'resourcedb'
else
db_name
(database_id)
endas database_name
from
sys.
dm_os_buffer_descriptors
group
bydb_name
(database_id)
,database_id
order
by cached_pages_kb desc;
2. 再具體一點,當前資料庫的哪個表或者索引占用pool緩衝空間最多?
select
count
(*)*8 as cached_pages_kb
,obj.name ,obj.index_id,b.type_desc,b.name
from
sys.
dm_os_buffer_descriptors
as bd
inner
join (
select
object_name
(object_id
)as name
,index_id ,allocation_unit_id,
object_id
from
sys.
allocation_units
as au
inner
join
sys.
partitions
as p
on au.container_id = p.hobt_id
and(au.
type
= 1 or au.
type
= 3)
union
all
select
object_name
(object_id
)as name
,index_id, allocation_unit_id,
object_id
from
sys.
allocation_units
as au
inner
join
sys.
partitions
as p
on au.container_id = p.partition_id
and au.
type
= 2)
as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left
join
sys.
indexes b on b.
object_id
= obj.
object_id
and b.index_id =obj.index_id
where database_id =
db_id()
group
by obj.name, obj.index_id ,b.name,b.type_desc
order
by cached_pages_kb desc;
3.buffer pool緩衝池裡面修改過的頁總數大小。這個比較容易:
select
count
(*)*8 as cached_pages_kb,
convert
(varchar
(5),
convert
(decimal
(5,2),(100-1.0*(
select
count
(*)from
sys.
dm_os_buffer_descriptors b where b.database_id=a.database_id andis_modified=0)/
count
(*)*100.0)))+
'%' modified_percentage
,case database_id
when 32767 then
'resourcedb'
else
db_name
(database_id)
endas database_name
from
sys.
dm_os_buffer_descriptors a
group
bydb_name
(database_id)
,database_id
order
by cached_pages_kb desc;
8080被誰占用了?
之前電腦上安裝postgrego的時候,預設裝了一堆元件,其中包含了乙個apache http元件,導致8080埠一直被占用,之前一直按照網上教程,找到占用程序然後kill掉 netstat ano findstr 8080taskkill pid 4708 f每次都這樣操作,顯得治標不治本,於是採...
飄逸的python inspect誰呼叫了我
當程式出現詭異的bug時,我們需要層層去跟蹤,尤其是要理清順序。這時如果有個清晰的呼叫脈絡除錯就容易多了。利用inspect模組的getframeinfo方法來實現這需求。上 感受下。python view plain copy import inspect deffoo who inspect.g...
我的scratchbox不能用了。
see scratchbox doc for documentation.inconsistency detected by ld.so rtld.c 1192 dl main assertion void ph p vaddr rtld local.dl sysinfo dso failed in...