oak-online-alter-table

今天花了1个多小时,安装了oak-online-alter-table,安装过程还是遇到很多问题,通过google都解决了。记录一下:

使用oak-online-alter-table还是有一定要求的,具体说明:http://openarkkit.googlecode.com/svn/trunk/openarkkit/doc/html/oak-online-alter-table.html,但文章中有点没有提到,在DDL过程中,报错:– ERROR: (1419, ‘You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)’)。必须把log_bin_trust_function_creators设置成ON才行。

为test表中的name加个索引

oak-online-alter-TABLE --host=10.XX.XX.XX --user=luoxuan --password=luoxuan --database=luoxuan
 --port=3306 --table=test --alter="ADD KEY(b,c,d)"

更多例子可以参考:
http://openarkkit.googlecode.com/svn/trunk/openarkkit/doc/html/oak-online-alter-table.html

具体帮助信息:

[root@hello mysql]# oak-online-alter-TABLE --help
usage: oak-online-alter-TABLE [options]
 
options:
  -h, --help            show this help message and exit
  -u USER, --user=USER  MySQL user
  -H HOST, --host=HOST  MySQL host (default: localhost)
  -p PASSWORD, --password=PASSWORD
                        MySQL password
  --ask-pass            Prompt for password
  -P PORT, --port=PORT  TCP/IP port (default: 3306)
  -S SOCKET, --socket=SOCKET
                        MySQL socket file. ONLY applies WHEN host IS localhost
  --defaults-file=DEFAULTS_FILE
                        READ FROM MySQL configuration file. Overrides ALL
                        other options
  -d DATABASE, --database=DATABASE
                        DATABASE name (required unless TABLE IS fully
                        qualified)
  -t TABLE, --table=TABLE
                        TABLE TO ALTER (OPTIONALLY fully qualified)
  -g GHOST, --ghost=GHOST
                        TABLE name TO serve AS ghost. This TABLE will be
                        created AND synchronized WITH the original TABLE
  -a ALTER_STATEMENT, --alter=ALTER_STATEMENT
                        Comma delimited ALTER statement details, excluding the
                        'ALTER TABLE t' itself
  -c CHUNK_SIZE, --chunk-size=CHUNK_SIZE
                        NUMBER OF ROWS TO act ON IN chunks. DEFAULT: 1000
  -l, --lock-chunks     Use LOCK TABLES for each chunk
  --sleep=SLEEP_MILLIS  Number of milliseconds to sleep between chunks.
                        DEFAULT: 0
  --cleanup             Remove custom triggers, ghost table from possible
                        previous runs
  -v, --verbose         Print user friendly messages
  -q, --quiet           Quiet mode, do not verbose

One Response to “oak-online-alter-table”

Post a Comment