DBCC TRACEON / DBCC TRACEOFF/ DBCC TRACESTATUS
DBCC TRACEON - Enable trace flags.
DBCC TRACEOFF - Disable trace flags.
DBCC TRACESTATUS - Display the status of trace flags.
--> Turn flag on for only the session level
DBCC TRACEON (1222)
DBCC TRACEON (1205,1222)
GO
--> Turn flag on globally at server for all the sessions
DBCC TRACEON (1222, -1)
GO
-- >Turn flag off
DBCC TRACEOFF (1222);
GO
--> Show flag status
DBCC TRACESTATUS (1205,1222)
DBCC TRACESTATUS (-1)
Thursday, December 17, 2009
Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.
Error Description
Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.
Root Cause
SQL Account only locked out, if it is enfoced to use password policies.
Resolution
You can unlock it by exeuction below command.
ALTER LOGIN sa WITH PASSWORD = 'password' UNLOCK
OR
You can do it GUI as well by unchecked locked checkbox
Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.
Root Cause
SQL Account only locked out, if it is enfoced to use password policies.
Resolution
You can unlock it by exeuction below command.
ALTER LOGIN sa WITH PASSWORD = 'password' UNLOCK
OR
You can do it GUI as well by unchecked locked checkbox
Wednesday, December 16, 2009
Saturday, December 12, 2009
Index Rebuild vs Index Reorganize. Diffrence beweent Index Rebuild and Index Reorganize
Index Rebuild | Index Reorganize |
It is offline operation | It is online operation |
Option is available in all SQL Server 2005 edition | Option is available in SQL Server 2005 Enterprise and Developer edition only |
Index rebuilds works by re-creating the index internally again and when that has been achieved, it drops the existing index. | Index reorganize is the process of physically re-organizing the leaf nodes of the index |
Index rebuild need more log space so it is advisable to change the database recovery model Simple or Bulk-logged | Reorganize swaps one page with another and thus does not require free space for this operation like rebuild does. Infect, reorganize can free up some pages as it does the reorganize in two phases – compaction and defrag. A reorganize can remove almost all of the logical fragmentation but it cannot necessarily fix extent fragmentation in which the previous and the next extents are physically contiguous. |
During the index rebuild process, It will also re-compute index statistics | Reorganize on the other hand does not update the statistics |
Can be done on any data type column because it is offline operation. | Another point to note is that an index (clustered or non-clustered) cannot be built online if it contains LOB data (text, ntext, varchar(max), nvarchar(max), varbinary(max), image and xml data type columns). |
If you want to rebuild an index with multiple partitions in an online environment, you need to rebuild the entire index which means rebuilding all the partitions. | Regarding partitions of an index, if an index has multiple partitions, then you cannot rebuild a single partition online. You can reorganize a single index partition online |
USE AdventureWorks ; GO ALTER INDEX ALL ON Production.Product REBUILD GO | USE AdventureWorks ; GO ALTER INDEX ALL ON Production.Product REORGANIZE |
Index should be rebuild when index fragmentation is great than 40%. | Index should be reorganized when index fragmentation is between 10% to 40% |
ONLINE option will not keep index available during the rebuilding. | ONLINE option will keep index available during the rebuilding. |
How to check SQL Services status from management studio?
You can use the below commands to check the sql services status from manangement studio.
xp_servicecontrol querystate, MSSQLAgent
xp_servicecontrol querystate, MSSQLServer
xp_servicecontrol querystate, msdtc
xp_servicecontrol querystate, MSSQLAgent
xp_servicecontrol querystate, MSSQLServer
xp_servicecontrol querystate, msdtc
Subscribe to:
Posts (Atom)