Jump to content

[Share] DataBase Cleanup SQL Script


Recommended Posts

ok, this will clean all account which are inactive for specified days. [glow=red,2,300]ALL CREDITS GOES TO NE@FLAX FROM 2JFREE.COM[/glow]

 

 

-- more than ... days
SET @dt = 60;

DELETE FROM accounts WHERE DATEDIFF( CURRENT_DATE( ) , FROM_UNIXTIME( `lastactive` /1000 ) ) > @dt;

DELETE FROM accounts WHERE login NOT IN (SELECT account_name FROM characters);
DELETE FROM account_data WHERE account_name NOT IN (SELECT login FROM accounts);
DELETE FROM characters WHERE account_name NOT IN (SELECT login FROM accounts);
DELETE FROM character_friends WHERE char_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_hennas WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_macroses WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_quests WHERE char_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_recipebook WHERE char_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_shortcuts WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_skills WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM character_skills_save WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM clan_data WHERE leader_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM clan_privs WHERE clan_id NOT IN (SELECT clan_id FROM clan_data);
DELETE FROM clan_skills WHERE clan_id NOT IN (SELECT clan_id FROM clan_data);
DELETE FROM pets WHERE item_obj_id NOT IN (SELECT object_id FROM items WHERE owner_id IN (SELECT obj_Id FROM characters));
DELETE FROM items WHERE owner_id NOT IN (SELECT obj_Id FROM characters) AND owner_id NOT IN (SELECT clan_id FROM clan_data);
DELETE FROM seven_signs WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters);
DELETE FROM augmentations WHERE item_id NOT IN (SELECT item_id FROM items);
UPDATE characters SET clanid=0,title="",clan_privs=0 where clanid NOT IN (SELECT clan_id FROM clan_data);
UPDATE clanhall SET ownerID=0,paidUntil=0 where ownerID NOT IN (SELECT clan_id FROM clan_data);

  • Thanks 1
Link to comment
Share on other sites

ok, this will clean all account which are inactive for specified days.

 

i read it over and over and over and i still cant see the specified days =/ call me a fool but i can see it xD

 

Is this line?

DELETE FROM accounts WHERE DATEDIFF( CURRENT_DATE( ) , FROM_UNIXTIME( `lastactive` /1000 ) ) > @dt;

Or

SET @dt = 60;

 

So after 60 days that account get deleted?

 

and then then , what is the rest?

 

Good work any way xD that could save much time from idiots creating usless accounts

Link to comment
Share on other sites

Dude plz say where your posts are working!This is not working on L2JFree for anyone who tried it.

 

I run it and it stucks at 2nd line.

 

EDIT:

I deleted these lines

-- more than ... days

and now the script is running.Thanks!

Link to comment
Share on other sites

One question,this will clean your database the time you'll run it,it's not automated?For example if i run the script and a player is inactive for 59 days (;D) the next day he won't get auto deleted?I'll have to run the script again in order to get deleted?

 

And something else..In my database i have 40k accounts.Theoretically the script will run for ages to delete all the inactive and untill it's finished server will lag?

 

Thanks in advance

Link to comment
Share on other sites

1st) you have to run the batch file its not automated. otherwise you have to make a SQL script to auto execute the batch file

 

2nd) i am not really sure, but i think this will not lag the server. (At least not that much)

Link to comment
Share on other sites

I left it about 10 minutes and i had 2 java errors (the server was running) and it wasn't going any further than the 2nd line.

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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.



  • Posts

    • MaxCheaters.com Official X/Twitter page:  https://x.com/maxcheaterscom   MaxCheaters.com Official Telegram group: https://t.me/maxcheaterscom
    • Enter Lin2Age C4 – A New Nostalgic Era of Lineage 2! Get ready for an epic journey filled with intense battles, powerful clans, and unforgettable adventures! Lin2Age is a custom Lineage 2 server, designed to give you the ultimate classic gameplay experience, enriched with exciting modern enhancements. Whether you're a seasoned warrior or a newcomer, there’s something for everyone! Why Lin2Age Stands Out Balanced Gameplay for All Enjoy the perfect blend of PvP, PvE, and crafting systems! Lin2Age merges the best elements of Scions of Destiny MasterWork and Interlude, creating a seamless experience tailored to all playstyles! Legendary Gear & AIO Buffer Unlock exclusive Legendary Armor, powerful jewels, and utilize an All-In-One Buffer to empower your character. Gear up, dominate your enemies, and experience true power! Unique Custom Features From exclusive quests to thrilling raid bosses, Lin2Age is packed with endless content that keeps the adventure exciting and new! A Supportive, Active Community Become part of a lively, friendly community built on teamwork and camaraderie. Whether you’re leading your own clan or joining one, you'll always find support here! Frequent Updates & Events Never get bored! With regular updates, custom content, and events offering epic rewards, Lin2Age is constantly evolving. Your feedback plays a key role in shaping the server’s future! Smooth, Lag-Free Experience Play without interruptions! Our top-tier hosting ensures a stable, lag-free gaming experience so you can focus on your journey. Key Features You’ll Love (επεξεργασμένο)         [3:43 ΜΜ] Rates: EXP x45, SP x45, ADENA x300—carefully balanced to enhance gameplay! Custom Classes & Skills: Unique class balance and modified skills for dynamic PvP combat! Epic Raid Bosses: Face custom raid bosses and earn legendary loot! Clan Wars & Sieges: Test your might in exciting clan wars and castle sieges! Active GMs & Support: Our dedicated Game Masters are always here to assist, ensuring fairness and smooth play. Join the Lin2Age Beta Test - Brave Adventurers Wanted! Ready to return to the world of Lineage 2, reimagined for a new era? Join our exclusive beta test and help shape the future of Lin2Age! Start your epic journey today. Welcome to Lin2Age C4! Join Our Discord Community Connect with fellow players, get live updates, and participate in all the latest events! Discord: https://discord.gg/qKJnQ7Kp5X  
    • https://lin2web.com/en https://t.me/lin2web
    • 75 SS niked or A grade - Clean mail Adena Items For all questions write to discord, real buyers discount or bonus Discord - enmenm6928  
  • Topics

×
×
  • Create New...