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.检查修改表 ...
随机推荐
- SpringMVC学习记录五——功能开发及参数处理
15 包装类型pojo参数绑定 15.1 需求 商品查询controller方法中实现商品查询条件传入. 15.2 实现方法 第一种方法:在形参中 添加HttpServ ...
- SpringBoot非官方教程 | 第一篇:构建第一个SpringBoot工程
转载请标明出处: https://www.fangzhipeng.com/springboot/2017/07/11/springboot1 本文出自方志朋的博客 简介 spring boot 它的设 ...
- GET&&POST请求编码过程
编码.解码 我们在开发过程中不可避免的一个话题就是编码和解码,那么什么是编码什么是解码呢?为什么要进行编码和解码呢?下面我们一一分析! 编码和解码的概念 编码是信息从一种形式或格式转换为另一种形式的过 ...
- Anaconda的使用—Spyder常用快捷键
Ctrl + 1: 注释/反注释 Ctrl + 4/5: 块注释/块反注释 Ctrl + L: 跳转到行号 Tab/Shift + Tab: 代码缩进/反缩进 Ctrl +I:显示帮助
- SpringBoot学习15:springboot异常处理方式5(通过实现HandlerExceptionResolver类)
修改异常处理方式4中的全局异常处理controller package com.bjsxt.exception; import org.springframework.context.annotati ...
- Object C学习笔记20-结构体(转)
在学习Object C中的过程中,关于struct的资料貌似非常少,查阅了C方面的资料总结了一些学习心得! 一. 定义结构 结构体是一种数据类型的组合和数据抽象.结构体的定义语法如下: struct ...
- LeetCode 简单 - 路径总和(112)
给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和. 说明: 叶子节点是指没有子节点的节点. 示例: 给定如下二叉树,以及目标和 sum = 22 ...
- ABAP术语-Customer Enhancement
Customer Enhancement 原文:http://www.cnblogs.com/qiangsheng/archive/2008/01/18/1043874.html Adjustment ...
- 【解决】MongoDB 线上业务处理,数据去重脚本实现
mongo客户端工具下载 https://robomongo.org/download 线上业务,k线 展示出现问题,相同时间戳的数据多次插入导致数据不真实,后经排查发现是每次都是写的四条数据, ...
- php访问url(get和post请求)
get请求 /* * php访问url路径,get请求 */ function curl_file_get_contents($durl){ // header传送格式 $headers = arra ...