![]() |
|
|
#1 |
|
Архивный участник
Join Date: Feb 2005
Posts: 307
|
I know it's unfinished, but I just realized that this post never left it's original posting location at RageZone...
First off, Check your database recovery models. Full and Bulk-logging eat drive read/write and space like nothing else. Move to a Simple recovery model. [Database] -> Properties -> Options ![]() Second, Strip all unnessacary databases from the current SQL server besides the system and L2 databases (Aseren, I believe, mentioned this in a post of his own.) It helps a bit. If possible, use a seperate 10k+ RPM drive to house the database MDF and LDF files (if you really want to go overkill seperate the LDF and MDF files onto seperate drives, but it's really not nessacary) Every time you reboot your L2 server, I know it's tedious but it really helps. Do the following. While all other server applications are down, open CacheD's config file and tell it to clear all items on startup, then load it. Wait until it completes, shut it down, then change the clear setting to 0 in the ini. Proceed to then run the folllowing code in the Query Analyzer: Code:
Backup log lin2world with truncate_only Go Use lin2world DBCC Shrinkfile (lin2world_log, 1) Go Backup log lin2db with truncate_only Go Use lin2db DBCC Shrinkfile (lin2db_log, 1) Go Use targets a specific database. The "DBCC Shrinkfile (lin2world_log, 1)" line is a DBCC call that serves to clear log files. Lin2world inside the brackets should be the physical file name of the log file without the extension. The 1 tells it to shrink it to 1 MB, which is the min filesize for a log. Doing this you don't have the unnessacary risks involved with detaching the database and manually deleting the logs (let alone the fact that you save a ton of time). Run a defrag on your drives. It helps, a lot. Once a month or so I would also recommend manually shrinking the Lin2World database . [Database] -> All Tasks -> Shrink Database. This will cause a probably increase in pending write the first time you boot the thing, but don't worry about it. So far from what I've tested it helps. Another thing you could do that solves Dead-Lock and Super-Lag problems for some people would be to change the max time CacheD will wait on an SQL query to finish. You can find this in the configuration file as SQLExecLimit. I personally have mine at 12000. I'll append a bit more to this later, got home and figured I'd write something useful for once. Small Edit: I figured I'd stick these online for anyone that finds them useful. Some are really basic but they simplify those tedious tasks that take forever to do in the Enterprise Manager. Basic SQL Directory Another Small Edit: Limit the size of your transaction logs. Newer Edit: Another thing you can do to keep performance at peak is to reindex or defragment your database. Defragment Database: (Online Job) Code:
DECLARE Tables CURSOR FOR
SELECT DISTINCT
OBJECT_NAME([id]),
[name]
FROM dbo.sysindexes
WHERE OBJECTPROPERTY([id], 'IsUserTable') = 1
OPEN Tables
DECLARE @database varchar(128)
DECLARE @table varchar(128)
DECLARE @index varchar(128)
SET @database = DB_NAME()
FETCH NEXT FROM Tables INTO @table, @index
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'Reindexing table ' +
ISNULL(@table, '<NULL>') +
' on index ' + ISNULL(@index, '<NULL')
IF @table IS NOT NULL AND @index IS NOT NULL
BEGIN
DBCC INDEXDEFRAG(@database, @table, @index)
END
FETCH NEXT FROM Tables INTO @table, @index
END
CLOSE Tables
DEALLOCATE Tables
Code:
DECLARE Tables CURSOR FOR
SELECT DISTINCT
QUOTENAME(TABLE_CATALOG) + '.' +
QUOTENAME(TABLE_SCHEMA) + '.' +
QUOTENAME(TABLE_NAME) +
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
OPEN Tables
DECLARE @table varchar(128)
FETCH NEXT FROM Tables INTO @table
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'Reindexing table ' + ISNULL(@table, '<NULL>')
IF @table IS NOT NULL
BEGIN
DBCC DBREINDEX( @table)
END
FETCH NEXT FROM Tables INTO @table
END
CLOSE Tables
DEALLOCATE Tables
MSDN - DBCC INDEXDEFRAG MSDN - DBCC DBREINDEX Aaron Weiker's Blog MSDN - INDEX Creation |
|
|
|
|