Jump to content
  • 0

Database Clean


kiova

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  59
  • Reputation:   0
  • Joined:  09/02/12
  • Last Seen:  

Hello, I am looking for a script to clean up accounts, characters, items, etc. of the database in the wake of a date.

Thank you very much.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • -1

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

how about clean the whole ragnarok db in one command?

 

Either you drop that database

DROP DATABASE `database_name`;

or :

TRUNCATE TABLE `auction`;
TRUNCATE TABLE `cart_inventory`;
TRUNCATE TABLE `char`;
TRUNCATE TABLE `charlog`;
TRUNCATE TABLE `friends`;
TRUNCATE TABLE `elemental`;
TRUNCATE TABLE `global_reg_value`;
TRUNCATE TABLE `guild`;
TRUNCATE TABLE `guild_alliance`;
TRUNCATE TABLE `guild_castle`;
TRUNCATE TABLE `guild_expulsion`;
TRUNCATE TABLE `guild_member`;
TRUNCATE TABLE `guild_position`;
TRUNCATE TABLE `guild_skill`;
TRUNCATE TABLE `guild_storage`;
TRUNCATE TABLE `homunculus`;
TRUNCATE TABLE `hotkey`;
TRUNCATE TABLE `interlog`;
TRUNCATE TABLE `inventory`;
TRUNCATE TABLE `ipbanlist`;
TRUNCATE TABLE `mail`;
TRUNCATE TABLE `mapreg`;
TRUNCATE TABLE `memo`;
TRUNCATE TABLE `mercenary`;
TRUNCATE TABLE `mercenary_owner`;
TRUNCATE TABLE `party`;
TRUNCATE TABLE `pet`;
TRUNCATE TABLE `quest`;
TRUNCATE TABLE `ragsrvinfo`;
TRUNCATE TABLE `sc_data`;
TRUNCATE TABLE `skill`;
TRUNCATE TABLE `skill_homunculus`;
TRUNCATE TABLE `sstatus`;
TRUNCATE TABLE `storage`;
TRUNCATE TABLE `login`;
INSERT INTO `login` (`account_id`, `userid`, `user_pass`, `sex`, `email`) VALUES ('1', 's1', 'p1', 'S','[email protected]');
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

To cleanup a certain table you need to execute this command to your database :

TRUNCATE TABLE `table_name`;

 

EDITED : Misunderstood your request sorry for that 

DELETE FROM `char` WHERE `account_id` = ( SELECT `account_id` FROM `login` WHERE DATE_FORMAT(`lastlogin`, '%Y-%m-%d') < '2013-09-03' AND `account_id` != 1 );

DELETE FROM `login` WHERE DATE_FORMAT(`lastlogin`, '%Y-%m-%d') < '2013-09-03' AND `account_id` != 1;

This will delete all character and all account who are not online before 2013-09-03 ( YYYY/MM/DD ). Regarding the item i am not sure about it. In any case, do backup your database to prevent worst possible scenarios.

Edited by Patskie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   47
  • Joined:  04/01/12
  • Last Seen:  

how about clean the whole ragnarok db in one command?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  66
  • Reputation:   6
  • Joined:  11/13/12
  • Last Seen:  

Don't forget to re-create the 's' account

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Don't forget to re-create the 's' account

Thanks for the reminder. edited my last post

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   47
  • Joined:  04/01/12
  • Last Seen:  

@Patskie & ccjosh

ok tnx ty ^_^ this help alot

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...