Register for your free account! | Forgot your password?

You last visited: Today at 04:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide] Keep your database size small :)

Discussion on [Guide] Keep your database size small :) within the SRO PServer Guides & Releases forum part of the SRO Private Server category.

Reply
 
Old   #1
 
witchymoo's Avatar
 
elite*gold: 40
Join Date: Jul 2013
Posts: 166
Received Thanks: 200
Post [Guide] Keep your database size small :)

Oh well sometimes we wonder if our SRO database really "that" big, I mean over 500MB or maybe 1GB and so...

Turns out they aren't. Some ppl released database with size more than 500MB, uhm well, the db size is actually quite small, the internal SQL log files that are big.

Here imma show you how to reduce the size of your database files. Well, smaller the size, more efficient in process, and of course, more faster. This is prolly useless to you, but what heck i'll share it anyway :P

Here comes the boring part:

1) set the database properties (1 time only), (IMPORTANT: you must have 'sa'/administrator access to your SQL server, and you must login with 'sa' account)

Code:
USE [master]
GO
ALTER DATABASE [SRO_VT_ACCOUNT] SET RECOVERY SIMPLE WITH NO_WAIT
ALTER DATABASE [SRO_VT_SHARD] SET RECOVERY SIMPLE WITH NO_WAIT
ALTER DATABASE [SRO_VT_LOG] SET RECOVERY SIMPLE WITH NO_WAIT
GO
ALTER DATABASE [SRO_VT_ACCOUNT] SET AUTO_CLOSE ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_SHARD] SET AUTO_CLOSE ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_LOG] SET AUTO_CLOSE ON WITH NO_WAIT
GO
ALTER DATABASE [SRO_VT_ACCOUNT] SET AUTO_SHRINK ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_SHARD] SET AUTO_SHRINK ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_LOG] SET AUTO_SHRINK ON WITH NO_WAIT
GO
ALTER DATABASE [SRO_VT_ACCOUNT] SET AUTO_UPDATE_STATISTICS_ASYNC ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_SHARD] SET AUTO_UPDATE_STATISTICS_ASYNC ON WITH NO_WAIT
ALTER DATABASE [SRO_VT_LOG] SET AUTO_UPDATE_STATISTICS_ASYNC ON WITH NO_WAIT
GO
2) Shrink your SRO database (you can do this anytime you want):
Code:
USE [master]
GO
DBCC SHRINKDATABASE ('SRO_VT_ACCOUNT') WITH NO_INFOMSGS;
DBCC SHRINKDATABASE ('SRO_VT_SHARD') WITH NO_INFOMSGS;
DBCC SHRINKDATABASE ('SRO_VT_LOG') WITH NO_INFOMSGS;
GO
DBCC UPDATEUSAGE ('SRO_VT_ACCOUNT') WITH NO_INFOMSGS;
DBCC UPDATEUSAGE ('SRO_VT_SHARD') WITH NO_INFOMSGS;
DBCC UPDATEUSAGE ('SRO_VT_LOG') WITH NO_INFOMSGS;
GO
IMPORTANT, the shrink part, DOES NOT read your actual database name. It reads "Logical Name" of your database files, how to check? right click on your database, hit properties, hit Files, you will see something like this:


3) Now this is the result of database backup without SQL internal log and everything shrunk:


With that file size, you rar it, you'll get less than 10% total size :P, 100MB to 4MB , pretty efficient, maybe?

have fun
witchymoo is offline  
Thanks
3 Users
Old 06/05/2015, 23:45   #2
 
Mr.gotsha's Avatar
 
elite*gold: 0
Join Date: Feb 2013
Posts: 84
Received Thanks: 15
are you sure that this not make any damage or errors for game or server files?
anyway well done.
Mr.gotsha is offline  
Old 06/05/2015, 23:53   #3
 
blapanda's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 1,860
Received Thanks: 757
Or just creating a new *.bak(s) of the database(s) - same result.
Anyways *thumbs up*
blapanda is offline  
Old 06/06/2015, 00:05   #4
 
witchymoo's Avatar
 
elite*gold: 40
Join Date: Jul 2013
Posts: 166
Received Thanks: 200
Quote:
Originally Posted by Mr.gotsha View Post
are you sure that this not make any damage or errors for game or server files?
anyway well done.
nope, it has nothing to do with database records, this goes for MS-SQL in general

Quote:
Originally Posted by blapanda View Post
Or just creating a new *.bak(s) of the database(s) - same result.
Anyways *thumbs up*
Well if you create new bak without shrinking, the bak file will have huge amount of file size because SQL always do backup along with the LDF file
witchymoo is offline  
Thanks
1 User
Old 06/06/2015, 01:19   #5
 
where_love2003's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 190
Received Thanks: 27
Nice @Witchy Keep up
where_love2003 is offline  
Old 06/06/2015, 06:54   #6
 
@$$'s Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 722
Received Thanks: 84
WINRAR FTW :-)
@$$ is offline  
Old 06/06/2015, 08:32   #7


 
​Exo's Avatar
 
elite*gold: 28
Join Date: Aug 2014
Posts: 4,096
Received Thanks: 2,649
You know that you never set AUTO_SHRINK to ON and that shrinking a database is always the worst option right? Do you realize how the database fragmentation is going to be affected? And how it's going to affect the performance when you try to deal with these tables again? For a database like this, just no, shrinking isn't the best solution. Maybe shrinking the log files but not the data files dude. And you can shrink it anytime you want. WOW. It shouldn't be done, not even once and you say you can do it anytime.

If you can't rebuild your indexes then just don't use this. Google it, there're some smarter ways to do it.
​Exo is offline  
Old 06/06/2015, 11:32   #8
 
blapanda's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 1,860
Received Thanks: 757
Quote:
Originally Posted by witchymoo View Post
Well if you create new bak without shrinking, the bak file will have huge amount of file size because SQL always do backup along with the LDF file
Hm. I didn't face that kind of issue.
As e.g. dumping windows, about a fresh new install, creating a whole new backup would result always in a 2~4MB log/account and round about 75~150MB shard (depending on the content included within).

Anyways, should become handy for people who are up modifying their databases, but hope that people will actually use the shrink methode on MSSQL carefully, its kind of dangerous losing or even corrupting their databases.
blapanda is offline  
Old 06/06/2015, 15:21   #9
 
witchymoo's Avatar
 
elite*gold: 40
Join Date: Jul 2013
Posts: 166
Received Thanks: 200
been doing this for years with my production databases and not just SRO, along with other scheduled maintenance processes, and they're all over 30Gigs of db size, never failed me even once.

But, like i said, this probably useless to you experts If you have better solution, by all means, please, share
witchymoo is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Small help to change database from D11 to D10
11/03/2014 - SRO Private Server - 2 Replies
Hello epvp i wanna to change my database D11 to D10 but i don't know how to change it just i want small help :) database - clean - Have new avatars thx any way
i want sql 2012 with a small size
05/11/2013 - Rappelz Private Server - 1 Replies
i want sql 2012 with a small size plz :)
[SEA]Small database change
05/23/2010 - SRO PServer Guides & Releases - 13 Replies
Changed all items in NPC To seal of sun, and return scrolls to globals DL Link: Database.rar Buy items, Teleport and they are converted to whatever you bought i will upload a media pk2 so this isnt neccesary later, with these items in the npcs



All times are GMT +2. The time now is 04:27.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.