猿问

请教下mysql load 语句能写入存储过程吗?

BEGIN

LOAD DATA LOCAL INFILE 'E://0711//bks.log' INTO TABLE t_diaoyonglian CHARACTER SET utf8 FIELDS TERMINATED BY '|' set Site='bks';
LOAD DATA LOCAL INFILE 'E://0711//nss.log' INTO TABLE t_diaoyonglian CHARACTER SET utf8 FIELDS TERMINATED BY '|' set Site='nss';
LOAD DATA LOCAL INFILE 'E://0711//content.log' INTO TABLE t_diaoyonglian CHARACTER SET utf8 FIELDS TERMINATED BY '|' set Site='content';

LOAD DATA LOCAL INFILE 'E://0711//cns.log' INTO TABLE t_diaoyonglian CHARACTER SET utf8 FIELDS TERMINATED BY '|' set Site='cns';

SET @sqlStr:=CONCAT("CREATE TABLE ",ta," LIKE t_diaoyonglian");
PREPARE stmt from @sqlStr;
EXECUTE stmt;
INSERT INTO ta SELECT * FROM t_diaoyonglian
PREPARE stmt from @sqlStr;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END

慕后森
浏览 145回答 1
1回答

江户川乱折腾

使用SHOW MASTER LOGS获得主服务器上的一系列日志。在所有的从属服务器中判定最早的日志,这个是目标日志,如果所有的从属服务器是更新的,就是清单上的最后一个日志。清理所有的日志,但是不包括目标日志,因为从服务器还要跟它同步。清理日志方法为:PURGE MASTER LOGS TO 'mysql-bin.010';PURGE MASTER LOGS BEFORE '2008-12-19 21:00:00';如果你确定从服务器已经同步过了,跟主服务器一样了,那么可以直接RESET MASTER将这些文件删除。
随时随地看视频慕课网APP
我要回答