能通过sql语句查询出服务器内存使用情况和cpu使用情况吗?
DBCC MemoryStatus
DBCC SQLPERF(THREADS)
select * from sys.dm_os_sys_info
declare @physicalMemoryInUseKB bigint
declare @totalSystemMemoryBytes bigint
select @physicalMemoryInUseKB = physical_memory_in_use_kb from sys.dm_os_process_memory
select @totalSystemMemoryBytes = physical_memory_in_bytes from sys.dm_os_sys_info
select convert(float, @physicalMemoryInUseKB) * 1024
/ convert(float, @totalSystemMemoryBytes) as memory_usage
sp_spaceused 精确查看,不过速度有点慢
sp_helpdb 看数据库的剩余可用空间数
已经使用的表空间大小. SQL> select tablespace_name,sum(bytes)/1024/1024 from dba_free_space group by tablespace_name;
不同数据库的函数不一样吧。
用什么数据库,在网站上下一个system adminstrator的宝典手册,用就好了。