ยินดีต้อนรับ กรุณา สมัครสมาชิก หรือเข้าสู่ระบบ

Home » webboard » PHP
เข้าชม : 2074

ปัญหา นำเข้า ฐานข้อมูล sql ขนาดใหญ่ ไม่ได้

โพสต์เมื่อ: วันศุกร์ 27 เมษายน 2555  15:50 น.

ปัญหานี้ ผมเคยเจอและได้เจอตัวนี้ครับ

หากใครพบปัญหาในการ import ข้อมูลขนาดใหญ่ผ่าน phpmyadmin แล้วละก็ ผมมีทางแก้ให้นั่นก็คือ การใช้โปรแกรมช่วยชื่อ bigdump โดยตัวโปรแกรมเขียนด้วยภาษา PHP การทำงานของมันคือทำการ import file sql เข้าไปยังฐานข้อมูล MySql ได้อย่างไม่ต้องกังวลถึงขนาดไฟล์ sql

รายละเอียดโปรแกรม

ชื่อโปรแกรม: BigDump

ผู้เขียน: Alexey Ozerov (alexey at ozerov dot de)

ลิขสิทธ์: GNU License

สิ่งที่ต้องการ

  1. Bigdump script bigdump.php from the download ได้จาก link ข้างบน
  2. Dump ข้อมูลจาก database ที่สร้างโดย phpMyAdmin. สามารถใช้ GZip compressed เช่น dump.gz. GZip support เฉพาะ PHP 4.3.0 ขึ้นไป
    Note: หากใช้ gzip อาจใช้เวลาในการประมวลผลนานเนื้องจากต้อง extract file ก่อนตอนปประมวลผล
  3. Access account สำหรับ mySQL database
  4. Access account สำหรับ web server ที่มี PHP 4.1.0 หรือสูงกว่านั้นติดตั้งอยู่และสามารถติดต่อกับ mySQL database
  5. โปรแกรม text editor จำพวก Notepad เพื่อแก้ configuration file
  6. โปรแกรม FTP client สำหรับ upload files ไปยัง web server
  7. ความรู้เบื่องต้นเกี่ยวกับ PHP, mySQL databases, phpMyAdmin, FTP และ HTTP

เริ่มกันเลยครับผม

 

Download Script มาก่อนครับ Download | เวปต้นฉบับ

  1. แตกไฟล์ zip ออกมาจะได้ไฟล์ bigdump.php นะครับ
  2. จัดการ config ด้วย text editer ที่ถนัดตามนี้ครับ// Database configuration
    $db_server = ‘localhost’; // ตั้งค่า DB ตาม Server ของคุณ
    $db_name = ‘’;
    $db_username = ‘’;
    $db_password = ‘’; // Other Settings$filename = ‘’; // ชื่อ file sql ที่ต้องการจะ dump
  3. เสร็จแล้วก็ upload ขึ้น server ไปพร้อมกับไฟล์ SQL ได้เลยครับ แล้วก็เรียก http://www.yourdomain.com/bigdump.php กด Start Import เท่านี้ก็เรียบร้อยครับ

เครดิตจาก http://www.mescript.com/mysql/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B9%81%E0%B8%81%E0%B9%89%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%99%E0%B8%B3%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%B2%E0%B8%90/



bigdump
[ ความเห็นที่ 1]
RE : ปัญหา นำเข้า ฐานข้อมูล sql ขนาดใหญ่ ไม่ได้
โพสต์เมื่อ: วันศุกร์ 27 เมษายน 2555  15:52 น.


ใช้ BigDump v0.34b  แล้ว error ประมาณนี้

Stopped at the line 1617.

At this place the current query includes more than 300 dump lines. That can happen if your dump file was created by some tool which doesn't place a semicolon followed by a linebreak at the end of each query, or if your dump contains extended inserts or very long procedure definitions. Please read the BigDump usage notes for more infos. Ask for our support services in order to handle dump files containing extended inserts.

Stopped on error


วิธีแก้ไข (ของผมได้ผล)

ประมาณบรรทัดที่ 50 ที่บอกว่า
$linespersession  = 300;

ให้แก้ตัวเลขไปเยอะๆเลย  เช่น
$linespersession  = 30000000000000000000;

กับอีกที่นึง (ประมาณบรรทัดที่ 79) ที่บอกว่า
define ('MAX_QUERY_LINES',300);

ให้แก้ตัวเลขไปเยอะๆเหมือนกัน เช่น
define ('MAX_QUERY_LINES',30000000000000000000);



 


bigdump


คุณต้องสมัครสมาชิก ถึงจะโพสกระทู้ได้

ปิดรับสมัครสมาชิกแล้ว


คำยอดฮิต :- 0