-- 查看全部进程 show processlist; -- 查询进行中的进程 select *from information_schema.processlist where command not in('Sleep','Killed'); -- 查询某个库的进程 select *from information_schema.processlist where db='dw'; -- 杀掉某进程, 从上述进程中获取某任务的首字段即为进程id kill ***;
select concat( char(10),'drop procedure if exists ',ROUTINE_NAME,';',char(10), 'create procedure ',ROUTINE_NAME,'()',char(10), ROUTINE_DEFINITION,';',char(10) ) from information_schema.ROUTINES where routine_schema = 'dw' -- 目标库 and routine_name in('dw_test'); -- 目标存储过程名称
select concat( char(10),'drop procedure if exists ',ROUTINE_NAME,';',char(10), 'create procedure ',ROUTINE_NAME,'(', convert(( select param_list from mysql.proc n where n.db = 'dw' -- 目标库 and n.name = m.ROUTINE_NAME),char) ,')',char(10), ROUTINE_DEFINITION,';',char(10) ) from information_schema.ROUTINES m where routine_schema = 'dw' -- 目标库 and routine_name in('dw_test'); -- 目标存储过程名称
show create table 其实可以返回,然后借助shell语句截取处理一下
table_sqls=`mysql -h**** -u**** -p**** -P*** -D*** -e"show create table test_table"|awk -F'\t' '{print $2}'` echo "drop table if exists $line;"$table_sqls";">>$target_sql echo $target_sql