vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Recreate table (https://vborg.vbsupport.ru/showthread.php?t=324965)

chikuru 04-23-2017 05:49 PM

Recreate table
 
Code:

Database error in vBulletin 4.2.2:

Invalid SQL:

        INSERT INTO taggregate_temp_1492976820
                SELECT threadid, COUNT(*) AS views
                FROM threadviews
                GROUP BY threadid;

MySQL Error  : Can't find file: 'threadviews' (errno: 2)

Whats the query to recreate that table in vbulletin 4.2?
Thanks!

Paul M 04-23-2017 06:57 PM

You can get it from the mysql-schema.php file, in the install folder.

chikuru 04-24-2017 01:28 AM

Thanks!

The missing threadviews table caused the database to create lots of taggregate_temp_xxxx tables.
Is there sql query to delete them all at once? Because I cant manually delete them because phpmyadmin hangs when I tried to load the database. Thanks!

Andreas 04-24-2017 03:48 PM

Unfortuatenly, there is no way to delete all those tables with one query.

You could do some trickery with information_schema though:
http://stackoverflow.com/questions/1...es-with-prefix

Alternatively you could run a simple script:
PHP Code:

require('./global.php');

$tables $db->query_read("SHOW TABLES LIKE 'taggregate\_temp\__%'");
while (
$table $db->fetch_row($tables))
{
    
$db->query_write("DROP TABLE `$table[0]`");


No guarantees whatsoever, eg. you should be prepared to have a backup ready if anything goes wrong :)

chikuru 04-25-2017 10:21 AM

Thanks Andreas! Problem solved :)
More than 100,000 temp tables have been removed :D


All times are GMT. The time now is 11:24 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01248 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete