How to get physical memory and quickly available? (Windows)

0

I would like to get the full and available physical memory of Windows to store them in a SQL Server table or by CMD and send them in a report. Ideally, the CMD would show something like this

Memoria Total    Memoria Disponible
3,509            1,352 MB

The systeminfo shows something that helps:

C:\Windows\system32>systeminfo |find "física"
Cantidad total de memoria física:          3,509 MB
Memoria física disponible:                 1,352 MB

But I would like to see it in tabular format to be able to store it as records in SQL Server and send a report. Any ideas?

    
asked by Camilo Vega 18.05.2016 в 16:16
source

1 answer

1

Camilo, if you want to have the memory data available from SQL, you can use this query:

 select 
total_physical_memory_kb TamanoTotalMemoriaFisicaDisponible,
available_physical_memory_kb MemoriaFisicaDisponible,
available_page_file_kb CantidadTotalArchivoPaginacionNoUsado,
system_cache_kb CantidadTotalMemoriaCacheSistema,
system_memory_state_desc
from sys.dm_os_sys_memory

This will show you some interesting data from the computer's memory. Now, if you want to dump these results to a table ... you can modify the query like this:

select  
total_physical_memory_kb TamanoTotalMemoriaFisicaDisponible,
available_physical_memory_kb MemoriaFisicaDisponible,
available_page_file_kb CantidadTotalArchivoPaginacionNoUsado,
system_cache_kb CantidadTotalMemoriaCacheSistema,
system_memory_state_desc
into {nombre_de_la_tabla}
from sys.dm_os_sys_memory

select * from {nombre_de_la_tabla}

In this way, you access the available data about the computer's memory from SQL Server.

You can review the documentation for this system table: " sys.dm_os_sys_memory " here: link

I hope this helps you.

    
answered by 18.05.2016 в 21:18