分类目录归档:DBA工具脚本

AIX运行健康状态检查脚本


当用户抱怨数据库缓慢时,除了检查数据库本身状态以外,还需要检查UNIX操作系统本身的资源使用情况,确保系统本身没有性能瓶颈。

这是以前工作中自己写的对AIX系统资源利用率检查的小工具,可以很快显示系统的负载情况,如有异常会给出提示。 功能包括:

# Check CPU usage:
# Check Memory usage:
# Check Disk usage:
# Check DISK IO, iostat:
# Check Network:
# Check system error report:
# Top 10 CPU process:
#!/bin/sh

# config fil

全部内容

另外一个perl写的alert log错误监控脚本


#!/usr/bin/perl
##########################################
# This script checks alert logs for all 
# Oracle instances on the server where 
# it's scehduled to run and pages dba oncall
# in case of any new ORA- errors 
#########################################
#

$ORATAB_FILE="/etc/oratab&q

全部内容

监控ORACLE报警日志错误的shell脚本


工作中用到的检查alert.log日志ORA错误的脚本, adrci也能显示, 不过如果查询视图的话可以集中管理.

#!/usr/bin/ksh 


if [ ! -z "$1" ]
then
ORASID=$1
else
ORASID=`cat /etc/oratab|grep -v "^#" |cut -d":" -f1`
fi

. ~/.bash_profile
HOST=`hostname`

for SID in $ORASID 
do
export ORACLE_SID=$SID
export ORACLE_HOME=

全部内容

MySQL运行性能监控脚本


github上go语言开发的MySQL运行性能监控脚本,试了一下还不错,类似于linux top:

源代码地址:https://github.com/dblucyne/dodba_tools

运行结果如下:

[root@zttang dodba_tools]# ./doDBA -innodb; ./doDBA -mysql; ./doDBA -mytop
DoDBA tools on host 127.0.0.1
---------+------innodb--rows-----+---------innodb--pages--------+-------innodb--data-------

全部内容

MySQL数据库结构同步工具


github上的MySQL数据库结构同步工具,真的很好用,还能自动生成升级脚本。如果能生成数据库差异报告就更好了,这样可以先评估变更的影响。

源代码网址:https://github.com/mmatuson/SchemaObject

运行结果:

python3 sync_mysql_schema.py mysql://xxx:xxxxx@localhost:3306/test1 mysql://xxx:xxxxx@localhost:3306/test2
=== start compare mysql db schema ===
** sync mysql schema from datab

全部内容

Python显示mysql执行计划脚本


网上的一个很牛的python脚本,用来分析mysql的执行计划,不过是python2写的,改了一下支持python3,并且支持数据库名.表名这种SQL写法

原文地址:https://dbaplus.cn/blog-77-736-1.html

执行结果如下: /usr/bin/python3 mysql_tuning.py -s "select count(*) from slow_db.dbinfo,slow_db.mysql_slow_query_r" 主要内容包括:

===== BASIC INFORMATION =====
===== ORIGINAL SQL TEXT ====

全部内容