给mysql innodb的表空间添加新数据文件太麻烦了。
需要编辑my.ini文件中innodb_data_file_path条目。且需要调整已有数据文件的大小,比方说现在autoextend 的/ibdata/ibdata1为18.5M,而在旧的my.ini中为10M,则需要修改为innodb_data_file_path = /ibdata/ibdata1:19M; 且必须是19M,如果指定20M,就会报错。
然后添加新文件到innodb_data_file_path ,”/ibdata/ibdata1:19M;/disk2/ibdata2:50M”.这个ibdata2先不能在文件系统存在,重新启动后mysql将会自动创建并识别这个新增加的这个ibdata2。
重新启动mysql,会有纪录增加数据文件的日志。
InnoDB: Error: data file C:\MySQL InnoDB Datafiles\ibdata1 is of a different size
InnoDB: 1152 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 1280 pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
080504 13:34:42 [ERROR] Default storage engine (InnoDB) is not available
080504 13:34:42 [ERROR] Aborting
080504 13:34:42 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: Shutdown complete
080504 13:36:25 InnoDB: Data file C:\MySQL InnoDB Datafiles\ibdata2 did not exist: new to be created
080504 13:36:25 InnoDB: Setting file C:\MySQL InnoDB Datafiles\ibdata2 size to 10 MB
InnoDB: Database physically writes the file full: wait…
080504 13:36:25 InnoDB: Data file C:\MySQL InnoDB Datafiles\ibdata3 did not exist: new to be created
080504 13:36:25 InnoDB: Setting file C:\MySQL InnoDB Datafiles\ibdata3 size to 10 MB
InnoDB: Database physically writes the file full: wait…
080504 13:36:27 InnoDB: Started; log sequence number 0 1134722
080504 13:36:27 [Note] C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt: ready for connections.
Version: ‘5.0.27-community-nt-log’ socket: ” port: 3306 MySQL Community Edition (GPL)
但这个重起操作,实在是影响了存储引擎innodb的高可用效果。