查看数据库负载主要是查询数,连接进程数,正在运行的进程如下: #!/bin/bash # screen -D -m -S check_mysql_status sh /path2script/script & while true; do sudo mysql --execute='show global status;' | awk '/Queries/{q=$2} /Threads_connected/{tc=$2} /Threads_running/{printf"%20s %20
下面列出:1.增加一个字段alter table user add COLUMN new1 VARCHAR(20) DEFAULT NULL; //增加一个字段,默认为空alter table user add COLUMN new2 VARCHAR(20) NOT NULL; //增加一个字段,默认不能为空2.删除一个字段alter table user DROP COLUMN new2; //删除一个字段3.修改一个字段alter table user MODIFY new1 VARCHAR
exec sp_spaceused 以上语法可以查看数据库大小 以下可以查看数据库中每个表的数据条数 SELECT a.name, b.rows FROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.id WHERE (a.type = 'u') AND (b.indid IN (0, 1)) ORDER BY b.rows DESC
mysql查看数据库中所有表的行数,并进行排序: 进行数据库迁移或还原后,可以通过比较行数,检查数据是否正确. mysql> use information_schema; mysql> select table_name,table_rows from tables where TABLE_SCHEMA= 'kpsumi' order by table_rows desc; 原文地址:http://blog.51cto.com/9285090/2119096
查看所有表对应的数据量 SELECT a.name AS 表名, MAX(b.rows) AS 记录条数 FROM sys.sysobjects AS a INNER JOIN sys.sysindexes AS b ON a.id = b.id WHERE (a.xtype = 'u') GROUP BY a.name ORDER BY 记录条数 DESC 查看数据库的总数据量 SELECT SUM(记录条数) AS 总记录数 FROM (SELECT TOP (10000) a.name A