--routines, -R
Include stored routines (procedures and functions) for the dumped databases in the output. Use of this option requires theSELECT privilege for the mysql.proc
table. The output generated by using --routines contains CREATE PROCEDUREand CREATE FUNCTION statements to re-create the routines. However, these statements do not include attributes such as the routine creation and modification timestamps. This means that when the routines are reloaded, they will be created with the timestamps equal to the reload time.
带-R参数的mysqldump出来的文件中会包含create procedure语句,在5.1上dump出来的文件 source到5.5上可能会报错 Cannot load from mysql.proc. The table is probably corrupted,dump出来的文件包含了mysql.proc表重建的语句,create procedure执行在mysql.proc表重建之前则不会报错,否则就会报错,测试结果如下:
实例版本
|
Mysql.proc表版本
|
Create procedure版本
|
Source结果
|
5.5
|
5.1
|
5.1
|
failure
|
5.5
|
5.5
|
5.1
|
success
|
5.1
|
5.1
|
5.1
|
success
|
5.1
|
5.5
|
5.1
|
failure
|
最终,取消线上环境备份脚本中-R参数,procedure信息只使用mysql.proc表数据记录以便恢复,然后执行mysql_upgrade即可
ps:
5.1 mysql.proc中comment char(64)
5.5 mysql.proc中comment text
mysql_upgrade会升级char(64)--->text,其余字段都相同
阅读(7999) | 评论(0) | 转发(0) |