欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

mysql太大怎么搬移的簡單介紹

mysql數(shù)據(jù)庫 文件過大 如何導(dǎo)入

點(diǎn)擊電腦‘運(yùn)行’,輸入cmd,然后點(diǎn)擊確定。

專注于為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)登封免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

cmd

2.找到sql的安裝路徑,打開命令行,進(jìn)入Binn目錄,輸入:cmd,回車執(zhí)行。

binn大致就在這個(gè)里面D:\Program Files\Microsoft SQL Server\100\Tools\Binn

3.執(zhí)行下列語句:

sqlcmd -S localhost -U sa -P pwzyy!@#123 -i C:\Users\Administrator\Desktop\script.sql

說明:

-S:數(shù)據(jù)庫服務(wù)器地址,我這里是本機(jī)直接用localhost

-U:用戶名

-P:密碼

-d:數(shù)據(jù)庫名

-i:sql文件

MySQL8數(shù)據(jù)遷移大表捷徑【表空間遷移】

0. 目標(biāo)端必須有同名表,沒有則建一個(gè)空表;

####################################

1、 源端文件準(zhǔn)備

源端:?

flush tables t for export;?

復(fù)制?

t.ibd, t.cfg到目標(biāo)端。?

###############################

flush tables tt7? ?for export;?

cp? tt7*? ?../ops

2、 目標(biāo)端存在同樣的表則丟棄原來的數(shù)據(jù)文件

目標(biāo)端:?

alter table tt7? discard tablespace;

3、 目標(biāo)端加載新的數(shù)據(jù)文件 t.ibd

alter table tt7 import tablespace;?

4、源端釋放鎖

源端:?

unlock tables;?

過程中主要異常處理:

#####################################################

SELECT? * FROM? ?ops2.tt7? ? ;

SELECT? * FROM? ?ops.tt7? ? ;

import tablespace報(bào)錯(cuò):

mysql alter table tt7 import tablespace;?

ERROR 1812 (HY000): Tablespace is missing for table ops.tt7.

確認(rèn)再相應(yīng)的目錄存在兩個(gè)文件

確認(rèn)屬主和權(quán)限

#####################################################

過程

[root@qaserver120 ops]# ll

total 80

drwxr-xr-x 2 root? root? ? ? 36 Dec? 2 21:42 000

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

[root@qaserver120 ops]#?

[root@qaserver120 ops]#?

[root@qaserver120 ops]#?

[root@qaserver120 ops]# cp 000

[root@qaserver120 ops]# ll

drwxr-xr-x 2 root? root? ? ? 36 Dec? 2 21:42 000

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 root? root? ? ?627 Dec? 2 21:45 tt7.cfg

-rw-r----- 1 root? root? 114688 Dec? 2 21:45 tt7.ibd

[root@qaserver120 ops]# chown mysql.mysql tt7*

[root@qaserver120 ops]#?

[root@qaserver120 ops]# ll

drwxr-xr-x 2 root? root? ? ? 36 Dec? 2 21:42 000

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 mysql mysql? ? 627 Dec? 2 21:45 tt7.cfg

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:46 tt7.ibd

[root@qaserver120 ops]#?

#####################################################

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

| tt7? ? ? ? ? ?|

+---------------+

2 rows in set (0.00 sec)

mysql select * from tt7;

ERROR 1814 (HY000): Tablespace has been discarded for table 'tt7'

mysql alter table tt7 import tablespace;?

ERROR 1812 (HY000): Tablespace is missing for table ops.tt7.

mysql?

mysql alter table tt7 import tablespace;

Query OK, 0 rows affected (0.08 sec)

mysql?

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql

###############################################

################################################

mysql mysql show tables;

+----------------+

| Tables_in_ops2 |

+----------------+

| tt2? ? ? ? ? ? |

| tt3? ? ? ? ? ? |

| tt7? ? ? ? ? ? |

+----------------+

3 rows in set (0.00 sec)

mysql?

mysql use ops

Database changed

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

+---------------+

1 row in set (0.00 sec)

mysql?

mysql use ops2;

Database changed

mysql select * from tt7;

+--------+------+

| x? ? ? | y? ? |

+--------+------+

| BBBBBB | NULL |

+--------+------+

1 row in set (0.00 sec)

mysql?

mysql?

mysql insert into tt7 select * from tt3;

Query OK, 3 rows affected (0.00 sec)

Records: 3? Duplicates: 0? Warnings: 0

mysql insert into tt7 select * from tt3;

Query OK, 3 rows affected (0.00 sec)

Records: 3? Duplicates: 0? Warnings: 0

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql?

mysql commit;

Query OK, 0 rows affected (0.00 sec)

mysql?

mysql exit

Bye

[root@qaserver120 pkg]# cd /data/mysql/ops2

[root@qaserver120 ops2]# ll

total 240

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt3.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:36 tt7.ibd

[root@qaserver120 ops2]#?

[root@qaserver120 ops2]#?

[root@qaserver120 ops2]#?

[root@qaserver120 ops2]# mysql -u'root'? -p'fgxkB9;Zq40^MFQUi$PJ'? ? ? ? -A

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.? Commands end with ; or \g.

Your MySQL connection id is 56

Server version: 8.0.18 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql use ops2

Database changed

mysql?

mysql flush tables tt7? ?for export;?

Query OK, 0 rows affected (0.00 sec)

mysql show tables;

+----------------+

| Tables_in_ops2 |

+----------------+

| tt2? ? ? ? ? ? |

| tt3? ? ? ? ? ? |

| tt7? ? ? ? ? ? |

+----------------+

3 rows in set (0.01 sec)

mysql exit

Bye

[root@qaserver120 ops2]# ll

total 240

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt3.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:36 tt7.ibd

[root@qaserver120 ops2]# ll

total 240

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt3.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:36 tt7.ibd

[root@qaserver120 ops2]# pwd

/data/mysql/ops2

[root@qaserver120 ops2]# cd? cd /data/mysql?

-bash: cd: cd: No such file or directory

[root@qaserver120 ops2]#? cd /data/mysql/ops2

[root@qaserver120 ops2]# ll

total 240

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:17 tt3.ibd

-rw-r----- 1 mysql mysql 114688 Dec? 2 21:36 tt7.ibd

[root@qaserver120 ops2]# ll -al

total 244

drwxr-x---? 2 mysql mysql? ? ?51 Dec? 2 21:38 .

drwxr-xr-x 12 mysql mysql? ?4096 Dec? 2 21:17 ..

-rw-r-----? 1 mysql mysql 114688 Dec? 2 21:17 tt2.ibd

-rw-r-----? 1 mysql mysql 114688 Dec? 2 21:17 tt3.ibd

-rw-r-----? 1 mysql mysql 114688 Dec? 2 21:36 tt7.ibd

[root@qaserver120 ops2]# pwd

/data/mysql/ops2

[root@qaserver120 ops2]# mysql -u'root'? -p'fgxkB9;Zq40^MFQUi$PJ'? ? ? ? -A

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.? Commands end with ; or \g.

Your MySQL connection id is 57

Server version: 8.0.18 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql use ops2

Database changed

mysql show tables;

+----------------+

| Tables_in_ops2 |

+----------------+

| tt2? ? ? ? ? ? |

| tt3? ? ? ? ? ? |

| tt7? ? ? ? ? ? |

+----------------+

3 rows in set (0.00 sec)

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql flush tables tt7? ?for export;?

Query OK, 0 rows affected (0.00 sec)

mysql use ops

Database changed

mysql ll

- ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'll' at line 1

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

+---------------+

1 row in set (0.00 sec)

mysql?

mysql?

mysql alter table tt7 import tablespace;?

ERROR 1100 (HY000): Table 'tt7' was not locked with LOCK TABLES

mysql?

mysql?

mysql use ops2

Database changed

mysql show tables;

+----------------+

| Tables_in_ops2 |

+----------------+

| tt2? ? ? ? ? ? |

| tt3? ? ? ? ? ? |

| tt7? ? ? ? ? ? |

+----------------+

3 rows in set (0.00 sec)

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql unlock tables;

Query OK, 0 rows affected (0.00 sec)

mysql show create table? tt7;

+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Table | Create Table? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|

+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| tt7? ?| CREATE TABLE `tt7` (

`x` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs DEFAULT NULL,

`y` int(11) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_as_cs |

+-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

mysql use ops

Database changed

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

+---------------+

1 row in set (0.01 sec)

mysql? CREATE TABLE `tt7` (

-? ?`x` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_as_cs DEFAULT NULL,

-? ?`y` int(11) DEFAULT NULL

- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_as_cs ;

Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql?

mysql?

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

| tt7? ? ? ? ? ?|

+---------------+

2 rows in set (0.00 sec)

mysql select * from tt7;

Empty set (0.00 sec)

mysql?

mysql alter table tt7? discard tablesapce;?

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tablesapce' at line 1

mysql alter table tt7? discard tablespace;

Query OK, 0 rows affected (0.03 sec)

mysql?

mysql?

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

| tt7? ? ? ? ? ?|

+---------------+

2 rows in set (0.00 sec)

mysql select * from tt7;

ERROR 1814 (HY000): Tablespace has been discarded for table 'tt7'

mysql?

mysql?

mysql?

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

| tt7? ? ? ? ? ?|

+---------------+

2 rows in set (0.00 sec)

mysql select * from tt7;

ERROR 1814 (HY000): Tablespace has been discarded for table 'tt7'

mysql?

mysql?

mysql alter table tt7 import tablespace;?

ERROR 1812 (HY000): Tablespace is missing for table `ops`.`tt7`.

mysql?

mysql?

mysql?

mysql alter table tt7 import tablespace;

Query OK, 0 rows affected (0.08 sec)

mysql?

mysql?

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql SELECT? * FROM? ?ops2.tt7? ? ;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql SELECT? * FROM? ?ops.tt7? ? ;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql?

mysql?

mysql?

mysql unlock tables;?

Query OK, 0 rows affected (0.00 sec)

mysql unlock tables;?

Query OK, 0 rows affected (0.00 sec)

mysql use ops

Database changed

mysql show tables;

+---------------+

| Tables_in_ops |

+---------------+

| tt2? ? ? ? ? ?|

| tt7? ? ? ? ? ?|

+---------------+

2 rows in set (0.00 sec)

mysql?

mysql?

mysql?

mysql use ops2;

Database changed

mysql?

mysql?

mysql show tables;

+----------------+

| Tables_in_ops2 |

+----------------+

| tt2? ? ? ? ? ? |

| tt3? ? ? ? ? ? |

| tt7? ? ? ? ? ? |

+----------------+

3 rows in set (0.01 sec)

mysql?

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

mysql?

mysql use ops;

Database changed

mysql?

mysql?

mysql select * from tt7;

+--------------+------+

| x? ? ? ? ? ? | y? ? |

+--------------+------+

| BBBBBB? ? ? ?| NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

| AAAAAA? ? ? ?| NULL |

| BBBBBB? ? ? ?| NULL |

| 555555555555 | NULL |

+--------------+------+

7 rows in set (0.00 sec)

數(shù)據(jù)庫太大了,mysql的,我怎么弄能夠快一點(diǎn),并且不出錯(cuò)!

你應(yīng)該做下數(shù)據(jù)庫的優(yōu)化了

數(shù)據(jù)庫優(yōu)化也不是一兩句就能說完的

如果是你個(gè)程序員,應(yīng)該加強(qiáng)數(shù)據(jù)庫這方面知識(shí)的提高

建議你看本書O'Reilly - High Performance MySQL.chm

網(wǎng)上有中文版的了

你看完會(huì)對(duì)你有很大的幫助,完全理解了,你就成數(shù)據(jù)庫高手了

一個(gè)PHPER的意見

mysql 的sql文件太大怎么導(dǎo)入

我有個(gè)大的 SQL 文件要回放,需要馬上做,但又怕壓死業(yè)務(wù),怎么辦?

先來建一個(gè)測試庫:

塞一些數(shù)據(jù)進(jìn)去:

看看我們填充數(shù)據(jù)的成果:

使用 mysqldump 導(dǎo)出一份數(shù)據(jù):

現(xiàn)在我們假設(shè)要把這個(gè) dump 文件,回放到一個(gè)數(shù)據(jù)庫中,并且現(xiàn)在數(shù)據(jù)庫正在承擔(dān)很重的業(yè)務(wù),我們不希望業(yè)務(wù)受到太大影響。

先來看看如果直接回放 dump 文件,會(huì)發(fā)生什么?

我們看到 MySQL 的 cpu 會(huì)彪起來,

我們換一個(gè)方式來回放 dump:

看看 CPU 壓力:

可以看到 CPU 已經(jīng)非常冷靜,并且緩慢的處理數(shù)據(jù)。

????小貼士:pv 工具既可以用于顯示文件流的進(jìn)度,也可以用于文件流的限速。在本實(shí)驗(yàn)中,我們用 PV 來限制 SQL 文件發(fā)到 MySQL client 的速度,從而限制 SQL 的回放速度,達(dá)到不影響其他業(yè)務(wù)的效果。

MySQL占用內(nèi)存過高怎么辦

服務(wù)器內(nèi)存占用過高的解決方法:

1,首先通過任務(wù)管理器進(jìn)行進(jìn)程排序,查找占用內(nèi)存較大的程序進(jìn)程。一般占用內(nèi)存較大的進(jìn)程有W3WP、sqlserver、mysqld-nt.exe;

2, 站點(diǎn)進(jìn)程w3wp 可以在cmd命令行中通過 iisapp 命令來對(duì)應(yīng)是那個(gè)網(wǎng)站占用內(nèi)存較大。可以通過設(shè)置回收時(shí)間、內(nèi)存最大使用值或共用進(jìn)程池來減少內(nèi)存的占用,但是如果要保證網(wǎng)站的訪問質(zhì)量,還是建議升級(jí)至更高型號(hào)來解決;

3,數(shù)據(jù)庫 sql server 也可以通過數(shù)據(jù)庫的企業(yè)管理器來設(shè)置最大內(nèi)存占用,但是如果網(wǎng)站程序必須要占用較大內(nèi)存的話,設(shè)置后會(huì)發(fā)生頁面報(bào)錯(cuò)、打不開等問題;

4,MYSQL本身會(huì)占用較大虛擬內(nèi)存,如果不使用mysql數(shù)據(jù)庫的話,可以將其停止。

分享名稱:mysql太大怎么搬移的簡單介紹
標(biāo)題路徑:http://chinadenli.net/article12/dsidgdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)網(wǎng)站收錄靜態(tài)網(wǎng)站外貿(mào)網(wǎng)站建設(shè)網(wǎng)站導(dǎo)航App設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計(jì)