select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index_length) desc;
2.查看指定数据库各表容量大小
12
select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables where table_schema='mysql' order by data_length desc, index_length desc;
3.查看所有数据库各表容量大小
12
select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables order by data_length desc, index_length desc;
4.查看指定数据库容量大小
12
select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables where table_schema='mysql';
ipmitool -I open command
其中-I open表示使用OpenIPMI接口,command有以下项:
a) raw: 发送一个原始的IPMI请求,并且打印回复信息。
b) lan: 配置网络(lan)信道(channel)
c) chassis : 查看底盘的状态和设置电源
d) event: 向BMC发送一个已经定义的事件(event),可用于测试配置的SNMP是否成功
e) mc: 查看MC(Management Contollor)状态和各种允许的项
f) sdr: 打印传感器仓库中的所有监控项和从传感器读取到的值。
g) sensor: 打印详细的传感器信息。
h) fru: 打印内建的Field Replaceable Unit (FRU)信息
i) sel: 打印 System Event Log (SEL)
j) pef: 设置 Platform Event Filtering (PEF),事件过滤平台用于在监控系统发现有event时候,用PEF中的策略进行事件过滤,然后看是否需要报警。
k) sol/isol: 用于配置通过串口的Lan进行监控
l) user: 设置BMC中用户的信息 。
m) channel: 设置Management Controller信道。
ipmitool -I open sensor list 命令可以获取传感器中的各种监测值和该值的监测阈值,包括(CPU温度,电压,风扇转速,电源调制模块温度,电源电压等信息)
ipmitool -I open sensor get "CPU0Temp" 可以获取ID为CPU0Temp监测值,CPU0Temp是sensor的ID,服务器不同,ID表示也不同。
ipmitool -I open sensor thresh 设置ID值等于id的监测项的各种限制值。
ipmitool -I open chassis status 查看底盘状态,其中包括了底盘电源信息,底盘工作状态等
ipmitool -I open chassis restart_cause 查看上次系统重启的原因
ipmitool -I open chassis policy list 查看支持的底盘电源相关策略。
ipmitool -I open chassis power on 启动底盘,用此命令可以远程开机
ipmitool -I open chassis power off 关闭底盘,用此命令可以远程开机
ipmitool -I open chassis power reset 实现硬重启,用此命令可以远程开机
ipmi还可以设置系统启动boot的设备,具体见ipmitool帮助文档。
ipmitool -I open mc reset 使BMC重新硬启动
ipmitool -I open mc info 查看BMC硬件信息
ipmitool -I open mc getenables 列出BMC所有允许的选项
ipmitool -I open mc setenables =[on|off] 设置bmc相应的允许/禁止选项。
ipmitool-I open event 1 发送一个温度过高的消息到System Event Log中,可以发送的Event有:
1 Temperature: Upper Critical: Going High
2 Voltage Threshold: Lower Critical: Going Low
3 Memory: Correctable ECC Error Detected
ipmitool-I open event 命令可以用测试配置的IPMI中的snmp功能是否成功。
ipmitool -I open lan print 1 打印现咱channel 1的信息 。
ipmitool -I open lan set 1 ipsrc static (设置ipmi ip非DHCP)
ipmitool -I open lan set 1 ipaddr 192.168.0.1 (设置IPMI 地址)
ipmitool -I open lan set 1 netmask 255.255.255.0 (设置ipmi 子网掩码)
ipmitool -I open lan set 1 defgw ipaddr 192.168.0.1 (设置ipmi 网关
ipmitool -I open lan set 1 access on 设置channel 1允许访问。
ipmitool -I open lan set 1 snmp public 设置channel 1 上snmp的community为public。
ipmitool -I open pef info 打印Platform Event Filtering (pef)信息
ipmitool -I open pef status 查看Platform Event Filtering (pef)状态
ipmitool -I open pef policy 查看Platform Event Filtering (pef)策略设置
ipmitool -I open sdr list fru 读取fru信息并显示。
select COLUMN_NAME 列名, DATA_TYPE 字段类型, COLUMN_COMMENT 字段注释
from INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companies'##表名
AND table_schema = 'testhuicard'##数据库名
AND column_name LIKE 'c_name'##字段名
2
查看表注释的方法:
1
show create table tablename;
修改表的注释:
1
alter table test1 comment '修改后的表的注释';
修改字段的注释:
1
alter table test1 modify column field_name int comment '修改后的字段注释';