Hello, is there a way to set DATA DIR for temp table (not changing original table datadir) while changing schema via pt-online-schema change ?
I haven’t enough free space for temp table.
If i’m right only one solution to do it is:
- use pt-online-schema-change with --data-dir, --no-drop-new-table and --no-swap-tables
- ALTER TABLE
old_table
DISCARD TABLESPACE; - FLUSH TABLES
new_table
FOR EXPORT; - move idb,cfg from new_table to old_table (mv /tmp/datadir/db/new_table.ibd /old/datadir/db/old_table.idb) and chown to mysql user
- UNLOCK TABLES;
- ALTER TABLE
old_table
IMPORT TABLESPACE; - drop new_table;
as i’m right ?
The steps you mentioned are risky and won’t be “online”
You could run pt-osc twice using --data-dir. The first run will alter your table with the new structure and the second time will move it again to the original location.
Could you help me by step ? =)