Percona-Tookit工具包之pt-find
pt-find [OPTIONS] [DATABASES]
Common parameters
Options:
--day-start //Specify the meassure mothed of time when using "--cmin,--mmin,--ctime,--mtime,etc".
--or //Change the combination test behavior as "or" instead of default "and". Actions:
--exec //Specify the executing sql statement with each item found.
--exec-plus //Specify the executing sql statement with all items at once.
--print //Print the target database and table name.
--printf //Print with a certain format. Tests:
--autoinc //Speicfy a value of auto_increment to test whether has auto_inrcrement column.
--avgrowlen //Specify the average
--cmin //Specify the target table created n minutes ago.
--ctime //Specify the target table created n days ago.
--mmin //Specify the target table modified n minutes ago.
--mtime //Specify the target table modified n days ago.
--kmim //Specify the target table checked n minutes ago.
--ktime //Specify the target table checked n days ago.
--rowformat //Specify the row format of tables to match pattern.
--rows //Specify the rows the table contains.
--tablesize //Specify the size the table is.
--empty //Specify the talbe which has no rows.
--engines //Specify the engine of tabls.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`engine_cost`
`mysql`.`event`
`mysql`.`func`
`mysql`.`general_log`
`mysql`.`gtid_executed`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`innodb_index_stats`
`mysql`.`innodb_table_stats`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`server_cost`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`slow_log`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`
`performance_schema`.`accounts`
`performance_schema`.`cond_instances`
`performance_schema`.`events_stages_current`
`performance_schema`.`events_stages_history`
`performance_schema`.`events_stages_history_long`
`performance_schema`.`events_stages_summary_by_account_by_event_name`
`performance_schema`.`events_stages_summary_by_host_by_event_name`
`performance_schema`.`events_stages_summary_by_thread_by_event_name`
`performance_schema`.`events_stages_summary_by_user_by_event_name`
`performance_schema`.`events_stages_summary_global_by_event_name`
`performance_schema`.`events_statements_current`
`performance_schema`.`events_statements_history`
`performance_schema`.`events_statements_history_long`
`performance_schema`.`events_statements_summary_by_account_by_event_name`
`performance_schema`.`events_statements_summary_by_digest`
`performance_schema`.`events_statements_summary_by_host_by_event_name`
`performance_schema`.`events_statements_summary_by_program`
`performance_schema`.`events_statements_summary_by_thread_by_event_name`
`performance_schema`.`events_statements_summary_by_user_by_event_name`
`performance_schema`.`events_statements_summary_global_by_event_name`
`performance_schema`.`events_transactions_current`
`performance_schema`.`events_transactions_history`
`performance_schema`.`events_transactions_history_long`
`performance_schema`.`events_transactions_summary_by_account_by_event_name`
`performance_schema`.`events_transactions_summary_by_host_by_event_name`
`performance_schema`.`events_transactions_summary_by_thread_by_event_name`
`performance_schema`.`events_transactions_summary_by_user_by_event_name`
`performance_schema`.`events_transactions_summary_global_by_event_name`
`performance_schema`.`events_waits_current`
`performance_schema`.`events_waits_history`
`performance_schema`.`events_waits_history_long`
`performance_schema`.`events_waits_summary_by_account_by_event_name`
`performance_schema`.`events_waits_summary_by_host_by_event_name`
`performance_schema`.`events_waits_summary_by_instance`
`performance_schema`.`events_waits_summary_by_thread_by_event_name`
`performance_schema`.`events_waits_summary_by_user_by_event_name`
`performance_schema`.`events_waits_summary_global_by_event_name`
`performance_schema`.`file_instances`
`performance_schema`.`file_summary_by_event_name`
`performance_schema`.`file_summary_by_instance`
`performance_schema`.`global_status`
`performance_schema`.`global_variables`
`performance_schema`.`host_cache`
`performance_schema`.`hosts`
`performance_schema`.`memory_summary_by_account_by_event_name`
`performance_schema`.`memory_summary_by_host_by_event_name`
`performance_schema`.`memory_summary_by_thread_by_event_name`
`performance_schema`.`memory_summary_by_user_by_event_name`
`performance_schema`.`memory_summary_global_by_event_name`
`performance_schema`.`metadata_locks`
`performance_schema`.`mutex_instances`
`performance_schema`.`objects_summary_global_by_type`
`performance_schema`.`performance_timers`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`pxc_cluster_view`
`performance_schema`.`replication_applier_configuration`
`performance_schema`.`replication_applier_status`
`performance_schema`.`replication_applier_status_by_coordinator`
`performance_schema`.`replication_applier_status_by_worker`
`performance_schema`.`replication_connection_configuration`
`performance_schema`.`replication_connection_status`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`
`performance_schema`.`rwlock_instances`
`performance_schema`.`session_account_connect_attrs`
`performance_schema`.`session_connect_attrs`
`performance_schema`.`session_status`
`performance_schema`.`session_variables`
`performance_schema`.`setup_actors`
`performance_schema`.`setup_consumers`
`performance_schema`.`setup_instruments`
`performance_schema`.`setup_objects`
`performance_schema`.`setup_timers`
`performance_schema`.`socket_instances`
`performance_schema`.`socket_summary_by_event_name`
`performance_schema`.`socket_summary_by_instance`
`performance_schema`.`status_by_account`
`performance_schema`.`status_by_host`
`performance_schema`.`status_by_thread`
`performance_schema`.`status_by_user`
`performance_schema`.`table_handles`
`performance_schema`.`table_io_waits_summary_by_index_usage`
`performance_schema`.`table_io_waits_summary_by_table`
`performance_schema`.`table_lock_waits_summary_by_table`
`performance_schema`.`threads`
`performance_schema`.`user_variables_by_thread`
`performance_schema`.`users`
`performance_schema`.`variables_by_thread`
`sys`.`host_summary`
`sys`.`host_summary_by_file_io`
`sys`.`host_summary_by_file_io_type`
`sys`.`host_summary_by_stages`
`sys`.`host_summary_by_statement_latency`
`sys`.`host_summary_by_statement_type`
`sys`.`innodb_buffer_stats_by_schema`
`sys`.`innodb_buffer_stats_by_table`
`sys`.`innodb_lock_waits`
`sys`.`io_by_thread_by_latency`
`sys`.`io_global_by_file_by_bytes`
`sys`.`io_global_by_file_by_latency`
`sys`.`io_global_by_wait_by_bytes`
`sys`.`io_global_by_wait_by_latency`
`sys`.`latest_file_io`
`sys`.`memory_by_host_by_current_bytes`
`sys`.`memory_by_thread_by_current_bytes`
`sys`.`memory_by_user_by_current_bytes`
`sys`.`memory_global_by_current_bytes`
`sys`.`memory_global_total`
`sys`.`metrics`
`sys`.`processlist`
`sys`.`ps_check_lost_instrumentation`
`sys`.`schema_auto_increment_columns`
`sys`.`schema_index_statistics`
`sys`.`schema_object_overview`
`sys`.`schema_redundant_indexes`
`sys`.`schema_table_lock_waits`
`sys`.`schema_table_statistics`
`sys`.`schema_table_statistics_with_buffer`
`sys`.`schema_tables_with_full_table_scans`
`sys`.`schema_unused_indexes`
`sys`.`session`
`sys`.`session_ssl_status`
`sys`.`statement_analysis`
`sys`.`statements_with_errors_or_warnings`
`sys`.`statements_with_full_table_scans`
`sys`.`statements_with_runtimes_in_95th_percentile`
`sys`.`statements_with_sorting`
`sys`.`statements_with_temp_tables`
`sys`.`sys_config`
`sys`.`user_summary`
`sys`.`user_summary_by_file_io`
`sys`.`user_summary_by_file_io_type`
`sys`.`user_summary_by_stages`
`sys`.`user_summary_by_statement_latency`
`sys`.`user_summary_by_statement_type`
`sys`.`version`
`sys`.`wait_classes_global_by_avg_latency`
`sys`.`wait_classes_global_by_latency`
`sys`.`waits_by_host_by_latency`
`sys`.`waits_by_user_by_latency`
`sys`.`waits_global_by_latency`
`sys`.`x$host_summary`
`sys`.`x$host_summary_by_file_io`
`sys`.`x$host_summary_by_file_io_type`
`sys`.`x$host_summary_by_stages`
`sys`.`x$host_summary_by_statement_latency`
`sys`.`x$host_summary_by_statement_type`
`sys`.`x$innodb_buffer_stats_by_schema`
`sys`.`x$innodb_buffer_stats_by_table`
`sys`.`x$innodb_lock_waits`
`sys`.`x$io_by_thread_by_latency`
`sys`.`x$io_global_by_file_by_bytes`
`sys`.`x$io_global_by_file_by_latency`
`sys`.`x$io_global_by_wait_by_bytes`
`sys`.`x$io_global_by_wait_by_latency`
`sys`.`x$latest_file_io`
`sys`.`x$memory_by_host_by_current_bytes`
`sys`.`x$memory_by_thread_by_current_bytes`
`sys`.`x$memory_by_user_by_current_bytes`
`sys`.`x$memory_global_by_current_bytes`
`sys`.`x$memory_global_total`
`sys`.`x$processlist`
`sys`.`x$ps_digest_95th_percentile_by_avg_us`
`sys`.`x$ps_digest_avg_latency_distribution`
`sys`.`x$ps_schema_table_statistics_io`
`sys`.`x$schema_flattened_keys`
`sys`.`x$schema_index_statistics`
`sys`.`x$schema_table_lock_waits`
`sys`.`x$schema_table_statistics`
`sys`.`x$schema_table_statistics_with_buffer`
`sys`.`x$schema_tables_with_full_table_scans`
`sys`.`x$session`
`sys`.`x$statement_analysis`
`sys`.`x$statements_with_errors_or_warnings`
`sys`.`x$statements_with_full_table_scans`
`sys`.`x$statements_with_runtimes_in_95th_percentile`
`sys`.`x$statements_with_sorting`
`sys`.`x$statements_with_temp_tables`
`sys`.`x$user_summary`
`sys`.`x$user_summary_by_file_io`
`sys`.`x$user_summary_by_file_io_type`
`sys`.`x$user_summary_by_stages`
`sys`.`x$user_summary_by_statement_latency`
`sys`.`x$user_summary_by_statement_type`
`sys`.`x$wait_classes_global_by_avg_latency`
`sys`.`x$wait_classes_global_by_latency`
`sys`.`x$waits_by_host_by_latency`
`sys`.`x$waits_by_user_by_latency`
`sys`.`x$waits_global_by_latency`
`zlm`.`t1`
`zlm`.`t2` //It shows all the tables in all databases one line each table.
Find out all the MyISAM tables.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --engine=MyISAM
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`event`
`mysql`.`func`
`mysql`.`ndb_binlog_index`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`tables_priv`
`mysql`.`user`
Find out all the tables in database "zlm" which does not have auto_increment column.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --dblike=zlm --autoinc=
`zlm`.`t1`
`zlm`.`t2`
Find out all the tables which is empty.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --empty
`mysql`.`columns_priv`
`mysql`.`event`
`mysql`.`func`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`procs_priv`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`performance_schema`.`metadata_locks`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`
Find out all the tables sorted descendingly by size.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --printf "%T\t%D.%N\n" | sort -rn
`mysql`.`help_topic`
`mysql`.`proc`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_category`
`zlm`.`t2`
`zlm`.`t1`
`sys`.`sys_config`
`mysql`.`time_zone_transition_type`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_name`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone`
`mysql`.`slave_worker_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_master_info`
`mysql`.`servers`
`mysql`.`server_cost`
`mysql`.`plugin`
`mysql`.`innodb_table_stats`
`mysql`.`innodb_index_stats`
`mysql`.`gtid_executed`
`mysql`.`engine_cost`
`mysql`.`tables_priv`
`mysql`.`proxies_priv`
`mysql`.`db`
`mysql`.`user`
`mysql`.`procs_priv`
`mysql`.`columns_priv`
`mysql`.`event`
`mysql`.`ndb_binlog_index`
`mysql`.`func`
`sys`.`x$waits_global_by_latency`
`sys`.`x$waits_by_user_by_latency`
`sys`.`x$waits_by_host_by_latency`
`sys`.`x$wait_classes_global_by_latency`
`sys`.`x$wait_classes_global_by_avg_latency`
`sys`.`x$user_summary_by_statement_type`
`sys`.`x$user_summary_by_statement_latency`
`sys`.`x$user_summary_by_stages`
`sys`.`x$user_summary_by_file_io_type`
`sys`.`x$user_summary_by_file_io`
`sys`.`x$user_summary`
`sys`.`x$statements_with_temp_tables`
`sys`.`x$statements_with_sorting`
`sys`.`x$statements_with_runtimes_in_95th_percentile`
`sys`.`x$statements_with_full_table_scans`
`sys`.`x$statements_with_errors_or_warnings`
`sys`.`x$statement_analysis`
`sys`.`x$session`
`sys`.`x$schema_tables_with_full_table_scans`
`sys`.`x$schema_table_statistics_with_buffer`
`sys`.`x$schema_table_statistics`
`sys`.`x$schema_table_lock_waits`
`sys`.`x$schema_index_statistics`
`sys`.`x$schema_flattened_keys`
`sys`.`x$ps_schema_table_statistics_io`
`sys`.`x$ps_digest_avg_latency_distribution`
`sys`.`x$ps_digest_95th_percentile_by_avg_us`
`sys`.`x$processlist`
`sys`.`x$memory_global_total`
`sys`.`x$memory_global_by_current_bytes`
`sys`.`x$memory_by_user_by_current_bytes`
`sys`.`x$memory_by_thread_by_current_bytes`
`sys`.`x$memory_by_host_by_current_bytes`
`sys`.`x$latest_file_io`
`sys`.`x$io_global_by_wait_by_latency`
`sys`.`x$io_global_by_wait_by_bytes`
`sys`.`x$io_global_by_file_by_latency`
`sys`.`x$io_global_by_file_by_bytes`
`sys`.`x$io_by_thread_by_latency`
`sys`.`x$innodb_lock_waits`
`sys`.`x$innodb_buffer_stats_by_table`
`sys`.`x$innodb_buffer_stats_by_schema`
`sys`.`x$host_summary_by_statement_type`
`sys`.`x$host_summary_by_statement_latency`
`sys`.`x$host_summary_by_stages`
`sys`.`x$host_summary_by_file_io_type`
`sys`.`x$host_summary_by_file_io`
`sys`.`x$host_summary`
`sys`.`waits_global_by_latency`
`sys`.`waits_by_user_by_latency`
`sys`.`waits_by_host_by_latency`
`sys`.`wait_classes_global_by_latency`
`sys`.`wait_classes_global_by_avg_latency`
`sys`.`version`
`sys`.`user_summary_by_statement_type`
`sys`.`user_summary_by_statement_latency`
`sys`.`user_summary_by_stages`
`sys`.`user_summary_by_file_io_type`
`sys`.`user_summary_by_file_io`
`sys`.`user_summary`
`sys`.`statements_with_temp_tables`
`sys`.`statements_with_sorting`
`sys`.`statements_with_runtimes_in_95th_percentile`
`sys`.`statements_with_full_table_scans`
`sys`.`statements_with_errors_or_warnings`
`sys`.`statement_analysis`
`sys`.`session_ssl_status`
`sys`.`session`
`sys`.`schema_unused_indexes`
`sys`.`schema_tables_with_full_table_scans`
`sys`.`schema_table_statistics_with_buffer`
`sys`.`schema_table_statistics`
`sys`.`schema_table_lock_waits`
`sys`.`schema_redundant_indexes`
`sys`.`schema_object_overview`
`sys`.`schema_index_statistics`
`sys`.`schema_auto_increment_columns`
`sys`.`ps_check_lost_instrumentation`
`sys`.`processlist`
`sys`.`metrics`
`sys`.`memory_global_total`
`sys`.`memory_global_by_current_bytes`
`sys`.`memory_by_user_by_current_bytes`
`sys`.`memory_by_thread_by_current_bytes`
`sys`.`memory_by_host_by_current_bytes`
`sys`.`latest_file_io`
`sys`.`io_global_by_wait_by_latency`
`sys`.`io_global_by_wait_by_bytes`
`sys`.`io_global_by_file_by_latency`
`sys`.`io_global_by_file_by_bytes`
`sys`.`io_by_thread_by_latency`
`sys`.`innodb_lock_waits`
`sys`.`innodb_buffer_stats_by_table`
`sys`.`innodb_buffer_stats_by_schema`
`sys`.`host_summary_by_statement_type`
`sys`.`host_summary_by_statement_latency`
`sys`.`host_summary_by_stages`
`sys`.`host_summary_by_file_io_type`
`sys`.`host_summary_by_file_io`
`sys`.`host_summary`
`performance_schema`.`variables_by_thread`
`performance_schema`.`user_variables_by_thread`
`performance_schema`.`users`
`performance_schema`.`threads`
`performance_schema`.`table_lock_waits_summary_by_table`
`performance_schema`.`table_io_waits_summary_by_table`
`performance_schema`.`table_io_waits_summary_by_index_usage`
`performance_schema`.`table_handles`
`performance_schema`.`status_by_user`
`performance_schema`.`status_by_thread`
`performance_schema`.`status_by_host`
`performance_schema`.`status_by_account`
`performance_schema`.`socket_summary_by_instance`
`performance_schema`.`socket_summary_by_event_name`
`performance_schema`.`socket_instances`
`performance_schema`.`setup_timers`
`performance_schema`.`setup_objects`
`performance_schema`.`setup_instruments`
`performance_schema`.`setup_consumers`
`performance_schema`.`setup_actors`
`performance_schema`.`session_variables`
`performance_schema`.`session_status`
`performance_schema`.`session_connect_attrs`
`performance_schema`.`session_account_connect_attrs`
`performance_schema`.`rwlock_instances`
`performance_schema`.`replication_group_member_stats`
`performance_schema`.`replication_group_members`
`performance_schema`.`replication_connection_status`
`performance_schema`.`replication_connection_configuration`
`performance_schema`.`replication_applier_status_by_worker`
`performance_schema`.`replication_applier_status_by_coordinator`
`performance_schema`.`replication_applier_status`
`performance_schema`.`replication_applier_configuration`
`performance_schema`.`pxc_cluster_view`
`performance_schema`.`prepared_statements_instances`
`performance_schema`.`performance_timers`
`performance_schema`.`objects_summary_global_by_type`
`performance_schema`.`mutex_instances`
`performance_schema`.`metadata_locks`
`performance_schema`.`memory_summary_global_by_event_name`
`performance_schema`.`memory_summary_by_user_by_event_name`
`performance_schema`.`memory_summary_by_thread_by_event_name`
`performance_schema`.`memory_summary_by_host_by_event_name`
`performance_schema`.`memory_summary_by_account_by_event_name`
`performance_schema`.`hosts`
`performance_schema`.`host_cache`
`performance_schema`.`global_variables`
`performance_schema`.`global_status`
`performance_schema`.`file_summary_by_instance`
`performance_schema`.`file_summary_by_event_name`
`performance_schema`.`file_instances`
`performance_schema`.`events_waits_summary_global_by_event_name`
`performance_schema`.`events_waits_summary_by_user_by_event_name`
`performance_schema`.`events_waits_summary_by_thread_by_event_name`
`performance_schema`.`events_waits_summary_by_instance`
`performance_schema`.`events_waits_summary_by_host_by_event_name`
`performance_schema`.`events_waits_summary_by_account_by_event_name`
`performance_schema`.`events_waits_history_long`
`performance_schema`.`events_waits_history`
`performance_schema`.`events_waits_current`
`performance_schema`.`events_transactions_summary_global_by_event_name`
`performance_schema`.`events_transactions_summary_by_user_by_event_name`
`performance_schema`.`events_transactions_summary_by_thread_by_event_name`
`performance_schema`.`events_transactions_summary_by_host_by_event_name`
`performance_schema`.`events_transactions_summary_by_account_by_event_name`
`performance_schema`.`events_transactions_history_long`
`performance_schema`.`events_transactions_history`
`performance_schema`.`events_transactions_current`
`performance_schema`.`events_statements_summary_global_by_event_name`
`performance_schema`.`events_statements_summary_by_user_by_event_name`
`performance_schema`.`events_statements_summary_by_thread_by_event_name`
`performance_schema`.`events_statements_summary_by_program`
`performance_schema`.`events_statements_summary_by_host_by_event_name`
`performance_schema`.`events_statements_summary_by_digest`
`performance_schema`.`events_statements_summary_by_account_by_event_name`
`performance_schema`.`events_statements_history_long`
`performance_schema`.`events_statements_history`
`performance_schema`.`events_statements_current`
`performance_schema`.`events_stages_summary_global_by_event_name`
`performance_schema`.`events_stages_summary_by_user_by_event_name`
`performance_schema`.`events_stages_summary_by_thread_by_event_name`
`performance_schema`.`events_stages_summary_by_host_by_event_name`
`performance_schema`.`events_stages_summary_by_account_by_event_name`
`performance_schema`.`events_stages_history_long`
`performance_schema`.`events_stages_history`
`performance_schema`.`events_stages_current`
`performance_schema`.`cond_instances`
`performance_schema`.`accounts`
`mysql`.`slow_log`
`mysql`.`general_log`
Find out all the tables over 16K.
[root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --tablesize +
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`engine_cost`
`mysql`.`event`
`mysql`.`func`
`mysql`.`gtid_executed`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`innodb_index_stats`
`mysql`.`innodb_table_stats`
`mysql`.`ndb_binlog_index`
`mysql`.`plugin`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`proxies_priv`
`mysql`.`server_cost`
`mysql`.`servers`
`mysql`.`slave_master_info`
`mysql`.`slave_relay_log_info`
`mysql`.`slave_worker_info`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`
`sys`.`sys_config`
`zlm`.`t1`
`zlm`.`t2`
Find out table in "zlm" database which name is like "t3" then drop it.
(zlm@192.168.1.101 )[zlm]>create table t3 like t2;
Query OK, rows affected (0.02 sec) (zlm@192.168.1.101 )[zlm]>show create table t3\G
*************************** . row ***************************
Table: t3
Create Table: CREATE TABLE `t3` (
`id` int() NOT NULL,
`name` char() DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
row in set (0.00 sec) (zlm@192.168.1.101 )[zlm]>show tables;
+---------------+
| Tables_in_zlm |
+---------------+
| t1 |
| t2 |
| t3 |
+---------------+
rows in set (0.00 sec) [root@zlm2 :: /data/mysql/mysql3308/data]
#pt-find -h192.168.1. -P3308 -uzlm -pzlmzlm --print zlm --tbllike=t3 --exec-plus "drop table %s"
`zlm`.`t3` (zlm@192.168.1.101 )[zlm]>show tables;
+---------------+
| Tables_in_zlm |
+---------------+
| t1 |
| t2 |
+---------------+
rows in set (0.00 sec) //The table has been droped directly by the last command in pt-find.
- pt-find is rather useful when retrieving target table with flexible conditions you defined.
- pt-find has a lot of options.We should be more careful when using ddl statement by "--exec" or "--exec-plus".
- We can use it to collect the important information about a bunch of tables easily which can increse the working efficiency.
Percona-Tookit工具包之pt-find的更多相关文章
- Linux后台开发工具箱
https://files-cdn.cnblogs.com/files/aquester/Linux后台开发工具箱.pdf 目录 目录 1 1. 前言 3 2. 脚本类工具 3 2.1. sed命令- ...
- Mysql: pt-table-checksum 和 pt-table-sync 检查主从一致性,实验过程
一.安装 percona 包 1.安装仓库的包 https://www.percona.com/doc/percona-repo-config/yum-repo.html sudo yum insta ...
- Linux后台开发工具箱-葵花宝典
Linux后台开发工具箱-葵花宝典 一见 2016/11/4 目录 目录 1 1. 前言 4 2. 脚本类工具 4 2.1. 双引号和单引号 4 2.2. 取脚本完整文件路径 5 2.3. 环境变量和 ...
- 推荐几款MySQL相关工具
前言: 随着互联网技术的不断发展, MySQL 相关生态也越来越完善,越来越多的工具涌现出来.一些公司或个人纷纷开源出一些不错的工具,本篇文章主要介绍几款 MySQL 相关实用工具.提醒下,这里并不介 ...
- [知识库分享系列] 二、.NET(ASP.NET)
最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...
- SQL慢查询安装过程
SQL慢查询 基本操作 打开防火墙 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload 安 ...
- 快速安装Percona pt工具
yum install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-Time-HiRes perl-IO-Socket-SSLwget http://pk ...
- Percona 工具包 pt-online-schema-change 简介
mysql的在线表结构修改,因为低效和阻塞读写.一直被诟病.至于ALTER TABLE 的原理,参看我上一篇文章.MySQL在线修改大表结构.看完后,发现的问题是还是会锁的,且对于在线更新的这块也是不 ...
- 安装percona工具包
1.安装percona源 sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona- ...
- percona pt toolkit 总结
##=====================================================##pt-osc之工作流程:1.检查更改表是否有主键或唯一索引,是否有触发器2.检查修改表 ...
随机推荐
- 2018.11.11 Java的 三大框架:Struts+Hibernate+Spring
·定义:Java三大框架主要用来做WEN应用.Struts主要负责表示层的显示: Spring利用它的IOC和AOP来处理控制业务(负责对数据库的操作): Hibernate主要是数据持久化到数据库. ...
- html5中event获取data和class
获取data和class var tare=$(e.relatedTarget).data("id");var tar=event.target;console.log(tare) ...
- 卸载由源码编译安装的软件(如OpenCV)
看安装软件的时候有没有使用--prefix这个参数,如果有那就把你指定的文件给删除了就行了. 如果没有用这个参数就麻烦一点了,那就进入到软件解压后的目录,执行sudo make uninstall看能 ...
- Android学习笔记_25_多媒体之在线播放器
一.布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andr ...
- 【题解】POJ1845 Sumdiv(乘法逆元+约数和)
POJ1845:http://poj.org/problem?id=1845 思路: AB可以表示成多个质数的幂相乘的形式:AB=(a1n1)*(a2n2)* ...*(amnm) 根据算数基本定理可 ...
- 还在占用存储的进程lsof grep deleted;
查看僵尸进程 lsof grep deleted; 用于查看已经停止但还在占用存储的进程
- wubiuefi-支持新版本ubuntu的wubi
由于某些原因,ubuntu官方不再提供新版的wubi 这就使得部分想快速且安全尝试新版ubuntu的用户望而却步 最近在外文网站找到了wubi的新版本wubiuefi,支持最新版的ubuntu 目前支 ...
- Oracle数据库补充
约束: 什么是约束以及约束的作用: 为保证数据的完整性(一致性,准确性),需要对数据进行限制,这个限制就叫做约束 目的:保证数据的完整性(一致性,正确性),使数据符合业务规则(业务逻辑) 约束 ...
- 如何在match中使用正则表达式
这是在实现搜索功能的时候遇到的一个问题,在搜索的场景中,会根据搜索框中输入的内容,匹配出包含搜索内容的部分.简单模拟还原使用场景: 首先定义一个遍历 value 用来接收输入的内容 var value ...
- MySql基本数据类型及约束
1. 常用的数据类型(data_type) 字符串类型 CHAR(n) : 固定长度 VARCHAR(n) : 可变长度 NCHAR(n) : 使用utf8存储,固定长度 NVARCHAR(n) : ...