Trying to clear transactions

Why is it doing this? I am trying to reduced the database size by clearing transactions.
This is samba 5.3.0 DB:153 SQ
I went to database tools, Database tasks, Clear Database Transactions - Execute task.

Its because its taking a long time and it thinks there isnt a connection. Just press cancel and wait.

You do realize that by doing that you delete all sales history… no way to get it back? Generally you shouldnt delete sales data. Why do you want to reduce size? Are you hitting a limit in HD size?

Want to reduced size for offsite database replication in the cloud every night. It backs up and send the DB at end of work period.
Just figured it would help.
The sales report that is printed and stored is our way to go back, we keep those records for years. Plus there is the database backup it creates when you do the clear transactions anyway.

How big of a db are we talking?

Did you install metrik at one point but no longer use it?

Also, it could be that the connection timeout limit is being hit as the clear script is running too long. If you really need to do this, create a backup and then run the clear script in SSMS.

I believe I do have Metrik installed and used it for only one year and stopped using it.
Database is 170 MB, not all that huge.

If the metrik triggers are still there and not being cleared, that can balloon the db size.

Run this query in SSMS against your db:

SELECT COUNT(*) FROM dbo.ReportTemp;

If the result is greater than 0 execute this script to remove the triggers and data: (2.7 KB)

I guess I know just enough to be dangerous.
Msg 50000, Level 11, State 5, Line 622
Cannot drop the table ‘dbo.ReportTemp’, because it does not exist or you do not have permission.

Did you get a result when you ran the select query?

It gave a similar error when I ran it, so I just went ahead and tried to run the script you sent as well.

Ahh, okay then. Well, that means metrik was never installed on that db and isn’t causing the size.

In SSMS, right click on your database and select Reports-> Standard Reports-> Disk Usage by Table then sort by Data (KB) from largest to smallest. If dbo.Orders is the top table then there’s nothing abnormal going on in your db.

If there’s an issue when closing the work period and waiting for the upload to finish, you could have an external application executed on close work period that performs your backup and then uploads it to the cloud.

I will try that in a little bit. I do think it was installed because we used it for a year and was able to see reports on the cellphone.

Ok I just checked it and it was just as you said. The table name dbo.Orders was at the top, so I guess all is good.

1 Like

Issue with this is that even when you press cancel… It keeps popping back up.

It might be worth putting a timeout timer when doing this… This would allow whatever is running in the background to run and complete before timeout happens…

Maybe even adding a section where you could increase the timeout threshold yourself. (Somewhere under like database settings/Program settings)

Sometimes this also happens when you change DB to a different one.

Yes it was added as a feature to notify you when the database is lost connection after so long. But it never was matured enough.