SansSQL

Friday, June 7, 2013

Renaming Filegroup in SQL Server

Renaming of a filegroup is SQL server can be done using T-SQL scripts as demonstrated below.
SELECT name AS BeforeRename FROM sys.filegroups

ALTER DATABASE SansSQL 
MODIFY FILEGROUP Secondary NAME=SansSQLFG

SELECT name AS AfterRename FROM sys.filegroups

Monday, June 3, 2013

Client Side and Server Side Tracing in SQL Server

What comes to your mind first when someone says or talks about the performance tuning?
Obviously, it will be Profiler and Tracing.
Profiler is a tool which is used to trace and store the events that are happening on a particular database or on a server overall. The result of this tool can be stored either as a file or in a table.
When you open the profiler and run the trace against a database it is referred to Client side tracing, this is because the profiler being a client tool and even when the profiler is run within the server, it is also referred as Client Side Tracing.

Tuesday, May 28, 2013

T-SQL query to find "mssqlsystemresource" database ID and database files location

We all know that mssqlsystemresource is a system database that is introduced from SQL Server 2005 onwards.
Here are few links which I posted earlier which gives more information about mssqlsystemresource database.

Saturday, May 18, 2013

Monitor SQL Server and related services using T-SQL

As part of the DBA job, it is very important to monitor the SQL Server and its related service and ensure that the services are always up and running.
There are different ways to achieve this, and one among them is by using the custom SQL scripts.
Writing custom SQL scripts play a vital role in few environments where budget is a concern to implement an full fledged monitoring system.

Wednesday, May 1, 2013

LSN mismatch error in Log Shipping

LSN mismatch is a common issue which happens in Log Shipping and because of which the Log Shipping goes out of sync.
When you check the history, you will find messages like below
Msg 4305, Level 16, State 1, Line 1
The log in this backup set begins at LSN 36000000048400001, which is too recent to apply to the database. An earlier log backup that includes LSN 20000000022100001 can be restored.
Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.
According to this error message, I am trying to restore a log backup before which I need to restore another backup which is taken earlier than this.

Ads