Post by lukehackett85 » Sat Aug 15, 2020 11:16 pm

Hello all,

I am currently trying to have my website moved between servers at my hosting company. But am having a problem because my opencart database is huge.

I have looked at it seems 11gb of data is in the _session table

I was wondering if there is any safe way to empty this table, as I assume its just logs of old logins/user sessions on the site?

Any help would be appreciated. If its safe to just literally drop the data out of the table in Phpmyadmin I will do that, I also wonder if theres any way of stopping this from occurring in the future? thanks for your time.

Best regards

Luke

New member

Posts

Joined
Sun Apr 24, 2016 5:09 am

Post by khnaz35 » Sat Aug 15, 2020 11:38 pm

lukehackett85 wrote:
Sat Aug 15, 2020 11:16 pm
Hello all,

I am currently trying to have my website moved between servers at my hosting company. But am having a problem because my opencart database is huge.

I have looked at it seems 11gb of data is in the _session table

I was wondering if there is any safe way to empty this table, as I assume its just logs of old logins/user sessions on the site?

Any help would be appreciated. If its safe to just literally drop the data out of the table in Phpmyadmin I will do that, I also wonder if theres any way of stopping this from occurring in the future? thanks for your time.

Best regards

Luke
For myself i will backup the database and then give it shot to see if it works well or start throwing some error.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by lukehackett85 » Sat Aug 15, 2020 11:54 pm

Thanks for reply. I've got quite a problem backing up the DB. It times out because its so big. Have tried a few times in phpmyadmin
I think thats maybe also why my web hosts cant migrate it to the new server :-/

New member

Posts

Joined
Sun Apr 24, 2016 5:09 am

Post by khnaz35 » Sun Aug 16, 2020 12:23 am

lukehackett85 wrote:
Sat Aug 15, 2020 11:54 pm
Thanks for reply. I've got quite a problem backing up the DB. It times out because its so big. Have tried a few times in phpmyadmin
I think thats maybe also why my web hosts cant migrate it to the new server :-/
Try to repair and compress your database first.
If for some reason you cant do it ask your host to make a backup of your db.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by letxobnav » Sun Aug 16, 2020 12:46 am

you can delete all records in the session table.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by lukehackett85 » Sun Aug 16, 2020 1:22 am

Thanks for reply. Just for confirmation if I navigate to my OC database in PHPMYADMIN and hit structure. I then look at the line that says 'session' and hit Drop then it will empty that table of all its session data? (as opposed to fully delete the table from existing)

New member

Posts

Joined
Sun Apr 24, 2016 5:09 am

Post by letxobnav » Sun Aug 16, 2020 1:33 am

No, you do not drop the session table as that will delete the table, you delete the records only.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by lukehackett85 » Sun Aug 16, 2020 3:07 am

OK, when I click into session table and hit structure in phpmyadmin I do not see a command to drop all records? should it be somewhere else? Thanks for your hgelp so far

New member

Posts

Joined
Sun Apr 24, 2016 5:09 am

Post by sw!tch » Sun Aug 16, 2020 3:45 am

lukehackett85 wrote:
Sun Aug 16, 2020 3:07 am
OK, when I click into session table and hit structure in phpmyadmin I do not see a command to drop all records? should it be somewhere else? Thanks for your hgelp so far
You want to wipe the session table entirely? I won't post the query here, but you can just google mysql TRUNCATE so you clearly understand the usage.

If you don't have a backup then accept the risk, especially on 11GB of data, further if you have poor hosting things can go wrong..

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by letxobnav » Sun Aug 16, 2020 7:01 am

There is no issue with deleting all session records from the session table.

Normally session records are stored in files and php automatically deletes those after x minutes of session inactivity via the standard php garbage collection.
Default OC decided to store those in the database instead but failed to make their custom garbage collection function properly.
Hence the huge accumulation of records.

So you can delete those records with no impact (on a life site users would lose their session and as such their cart content and need to login again etc).

@OP Since you are not aware what drop means in sql lingo, better stay away from the structure tab in phpmyadmin until you read up on what what does. Stay in the "browse" tab and have a look at: https://www.youtube.com/watch?v=mf9XlVfJmxg

you have 3 option:
1) delete the individual records
2) run query "DELETE FROM tablename;" (for tablename you use the session table name)
3) drop the table but then you have to create the table again.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by ADD Creative » Sun Aug 16, 2020 7:35 pm

lukehackett85 wrote:
Sun Aug 16, 2020 3:07 am
OK, when I click into session table and hit structure in phpmyadmin I do not see a command to drop all records? should it be somewhere else? Thanks for your hgelp so far
In phpMyAdmin it's call Empty (Truncate) Table.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by letxobnav » Sun Aug 16, 2020 8:12 pm

I do not use phpmyadmin so I do not know what it is called but I do know that "truncate" does not mean empty or delete.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by by mona » Sun Aug 16, 2020 8:42 pm

May I suggest you do this the long way ...

MAKE SURE - 100% - WITHOUT ANY DOUBT WHATSOEVER - you are in fact in the correct screen and table
If in any doubt, ask for a developer to do this for you. No one here takes ANY responsibility. The risk is all yours.

Select = Number of rows 100
DO NOT Show All - If we are understanding correctly this will crash ..
Selected = check all
and with selected = Delete

Do this over and over on each page

However I am amazed your service provider can not help you get a back up of your database.
How you have gotten this far without ever backing up your database is incredibly dangerous.
I would again go back to your service provider and ask for them to do a back up - especially in light of reading your questions and I say that in the nicest possible way.

Attachments

Screen-Shot-2020-08-15-at-21.38.29.jpg

Screen-Shot-2020-08-15-at-21.38.29.jpg (47.83 KiB) Viewed 3277 times


DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ADD Creative » Sun Aug 16, 2020 9:10 pm

letxobnav wrote:
Sun Aug 16, 2020 8:12 pm
I do not use phpmyadmin so I do not know what it is called but I do know that "truncate" does not mean empty or delete.
https://dev.mysql.com/doc/refman/5.7/en ... table.html

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by straightlight » Sun Aug 16, 2020 9:58 pm

ADD Creative wrote:
Sun Aug 16, 2020 9:10 pm
letxobnav wrote:
Sun Aug 16, 2020 8:12 pm
I do not use phpmyadmin so I do not know what it is called but I do know that "truncate" does not mean empty or delete.
https://dev.mysql.com/doc/refman/5.7/en ... table.html
TRUNCATE TABLE empties a table completely.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by by mona » Sun Aug 16, 2020 10:02 pm

grgr wrote:
Sun Aug 16, 2020 10:00 pm
Found this also....
https://www.opencart.com/index.php?rout ... n_id=38580
:good:

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by straightlight » Sun Aug 16, 2020 10:31 pm

The GC validation has also been fixed on the master branch recently.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by letxobnav » Sun Aug 16, 2020 10:35 pm

TRUNCATE TABLE empties a table completely.
@straightlight Why not spend your time useful by fixing this bug.

https://dictionary.cambridge.org/dictio ... h/truncate

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by doktorek » Mon Aug 17, 2020 12:24 am

There is a session debloader plugin out there. I used it . Free download I believe.
https://www.opencart.com/index.php?rout ... cmod.space

New member

Posts

Joined
Thu Apr 28, 2016 8:40 pm
Who is online

Users browsing this forum: Bing [Bot] and 261 guests