PIXNET Logo登入

DanBrother的部落格

跳到主文

歡迎光臨DanBrother在痞客邦的小天地. 部落格文章同步於=> http://blog.xuite.net/gem083/dba

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 9月 18 週五 202009:51
  • MySQL Array Simulation in Stored Procedure


drop procedure if exists sp_array_test;
DELIMITER //
create procedure sp_array_test ()
BEGIN
declare current_label varchar(10);
declare label_array varchar(100);

(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(117)

  • 個人分類:MySQL
▲top
  • 7月 07 週二 202015:44
  • Extracts, orders, and then prints grants for MySQL user accounts (pt-show-grants)

Extracts, orders, and then prints grants for MySQL user accounts (pt-show-grants)
# Extracts, orders, and then prints grants for MySQL user accounts
pt-show-grants --host 10.0.1.120 -u admin --ask-pass --port 3306 > testdb-grants.sql

 
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(24)

  • 個人分類:MySQL
▲top
  • 6月 29 週一 202013:21
  • MySQL Stored Procedure - Nested Loop Example

MySQL Stored Procedure - Nested Loop Example
DELIMITER $$
CREATE PROCEDURE sp_fix_dup_nickname()
BEGIN   
    DECLARE outer_done, inner_done BOOLEAN DEFAULT FALSE;    
    DECLARE current_id varchar(30);    
    DECLARE current_nickname varchar(60);
    DECLARE current_update_time timestamp(6);
    DECLARE current_ranking int;
    DECLARE new_nickname varchar(60);
    DECLARE outer_cur CURSOR FOR select nickname from tmp_dup_nickname;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET outer_done = TRUE;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(110)

  • 個人分類:MySQL
▲top
  • 6月 17 週三 202009:39
  • Metabase H2 DB Migration to MySQL 5.7

Metabase H2 DB Migration to MySQL 5.7
#### On Aurora New MySQL ####################
create database metabase charset utf8mb4;
create user `metabase_app`@`192.168.%` identified by 'xxxxxx';
grant all on metabase.* to `metabase_app`@`192.168.%`;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(67)

  • 個人分類:MySQL
▲top
  • 3月 04 週三 202014:00
  • Steps for Upgrading Percona-Toolkit to the Latest Version

MySQL 5.7 :  Steps for Upgrading Percona-Toolkit to the Latest Version
pt-online-schema-change --version
>>
pt-online-schema-change 2.2.20
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(4)

  • 個人分類:MySQL
▲top
  • 2月 27 週四 202016:42
  • MySQL Slave - Skip Replication for A Particular Table

MySQL Slave - Skip Replication for A Particular Table
mysql> stop slave sql_thread;
mysql> change replication filter Replicate_Wild_Ignore_Table=('mydb.my_unused_table1');
mysql> start slave sql_thread;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(8)

  • 個人分類:MySQL
▲top
  • 2月 26 週三 202010:59
  • MySQL - Export & Import Table Data Based on the SQL Query

Export Table Data:
mysql -utest_usr -p"xxx"-h127.0.0.1 -P3306 -e "select * from test_usr.test_table where flag = 1" > test_usr.test_table.txt 2>/dev/null
Import Table Data:   (ignore first row column name)
mysql> LOAD DATA LOCAL INFILE '/home/mysql/test_usr.test_table.txt' INTO TABLE my_new_test_table IGNORE 1 LINES;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(24)

  • 個人分類:MySQL
▲top
  • 2月 03 週一 202015:08
  • MySQL Table Fragmentation Detection and De-fragmentation Implementation

check_table_fragmentation.sql
>>
MySQL > source check_table_fragmentation.sql
SELECT table_schema, table_name, CONCAT(ROUND((data_free / 1024 / 1024),2),'MB') as data_free
FROM information_schema.tables
WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema','sys')
AND ENGINE LIKE 'InnoDB' AND data_free > 100 * 1024 * 1024;
+------------------+-----------------------------------+------------+
| table_schema     | table_name                        | data_free  |
+------------------+-----------------------------------+------------+
| test_usr        | test_frag_table                        | 15002.00MB |
# Performance Table Defragmentation Using Percona's toolket - pt-online-schema-change
nohup  pt-online-schema-change -u$dbuser  --socket=$socket_file --critical-load="Threads_running=100" \
--set-vars innodb_lock_wait_timeout=60 \
--execute --alter "
ENGINE=InnoDB;" --charset=utf8 --nocheck-replication-filters --recursion-method=processlist D=test_usr,t=test_frag_table 2>&1 &
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(13)

  • 個人分類:MySQL
▲top
  • 12月 17 週二 201918:13
  • Multiple Log File Viewer (Linux Bash)

cat log_file_viewer.sh
>>
#################################
# Multiple Log File Viewer (Linux Bash)
# Programmed By DanBrother
#################################
#!/bin/bash
function pause(){
   read -p "$*"
}
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(6)

  • 個人分類:Linux
▲top
  • 10月 28 週一 201914:03
  • Solving MySQL slave lag Issues

There're MySQL global variable settings that will help for improving the speed of SQL apply in slave db.
That would solve the issue of slave lagging.
slave_rows_search_algorithms comes to the rescue.
slave_rows_search_algorithms
default: TABLE_SCAN,INDEX_SCAN
improvement: INDEX_SCAN,TABLE_SCAN,HASH_SCAN
select @@global.slave_rows_search_algorithms;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(3)

  • 個人分類:MySQL
▲top
12...57»

廣告

個人資訊

DanBrother
暱稱:
DanBrother
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (49,256)Excel 2007 中文字顯示亂碼之修復步驟
  • (136)crsctl command usage
  • (83)ORA-15306: ASM Password File Update Failed On At Last One Node
  • (542)Workaround for NI cryptographic checksum mismatch error: 12599 (TNS-12599)
  • (1,847)FRM-91111 and FRM-10039 When Starting Oracle Forms Builder 11g on Linux
  • (21)PL/SQL BULK COLLECT Using LIMIT Clause Practice
  • (3,644)[OHS-2171] NZ Library Error: SSL negotiation error [Hint: too restrictive SSLCipherSuite]
  • (41)OPatch failed with error code 73 (Solved)
  • (137)Oracle HTTP Server 12c (12.1.3) standalone installation Procedures on Linux
  • (783)如何讓樞紐分析表區分大小寫

文章分類

  • Android (1)
  • Java (1)
  • MongoDB (1)
  • MariaDB (7)
  • Python (10)
  • HTML (1)
  • ORDS (1)
  • Apache Tomcat (1)
  • Oracle Streams (1)
  • Javascript (1)
  • Oracle Data Guard (2)
  • Oracle VirtualBox (3)
  • Grid Infrastructure (4)
  • Oracle SQL Tuning (6)
  • OEM11g / 12c (28)
  • IT Links (1)
  • 心靈饗宴 (161)
  • Oracle Clusterware (5)
  • ORACLE RAC (21)
  • Oracle ASM (18)
  • Oracle Export/Import (10)
  • MySQL (22)
  • Windows Series (18)
  • Oracle HTTP Server (8)
  • Linux (49)
  • Microsoft Office (6)
  • SQL SERVER (19)
  • Install Apache & PHP (2)
  • Oracle in General (111)
  • RMAN (15)
  • SQL / PL/SQL (30)
  • 未分類文章 (1)

最新文章

  • MySQL Array Simulation in Stored Procedure
  • Extracts, orders, and then prints grants for MySQL user accounts (pt-show-grants)
  • MySQL Stored Procedure - Nested Loop Example
  • Metabase H2 DB Migration to MySQL 5.7
  • Steps for Upgrading Percona-Toolkit to the Latest Version
  • MySQL Slave - Skip Replication for A Particular Table
  • MySQL - Export & Import Table Data Based on the SQL Query
  • MySQL Table Fragmentation Detection and De-fragmentation Implementation
  • Multiple Log File Viewer (Linux Bash)
  • Solving MySQL slave lag Issues

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣:

留言板