Thursday, March 20, 2008
How to find domain name using batch
echo.
echo If no Domain is listed below, then you are not part of an NT Domain.
echo.
echo If so, please use your account from one of the supported NT domains,
echo.
echo.
echo.
echo Your current NT Logon is:
echo.
net config workstation | find "User"
net config workstation | find "Logon"
echo.
echo.
echo.
echo.
pause
Monday, February 11, 2008
SQL Server 2005 Default Configuration check list
http://technet.microsoft.com/en-us/library/ms189631.aspx
http://www.sql-server-performance.com/articles/audit/2005_server_configuration_pt1_p1.aspx
Saturday, January 26, 2008
Find Uptime on Windows 2003, XP
systeminfo | find "Up Time"
Wednesday, December 26, 2007
SQL 2005: Performance Counters are missing after installation
Below Query returns Zero rows.
select * from sys.dm_os_performance_counters
or
select * from sysperfinfo
Solution:
http://technet.microsoft.com/en-us/library/ms187743.aspx
Look at the setup log and search for error 3409, "Reinstall sqlctr.ini for this instance, and ensure that the instance login account has correct registry permissions" This denotes that performance counters were not enabled. The errors immediately prior to the 3409 listing should indicate the root cause for the failure of performance counter enabling.
For more information about setup log files, see How to: View SQL Server 2005 Setup Log Files
Tuesday, December 25, 2007
Error when executing sp_helpdb
Error below would occur:
Server: Msg 515, Level 16, State 2, Procedure sp_helpdb,
Line 53
Cannot insert the value NULL into column 'owner',
table 'tempdb.dbo.#spdbdesc_____________________________ ___
__________________________________________________ _________
________________000100048505'; column does not allow
nulls. INSERT fails.
Solution:
1) Run Query below, to find the databases which has incorrect owner.
SELECT name, SUSER_SNAME(sid)
FROM master.dbo.sysdatabases
WHERE SUSER_SNAME(sid) IS NULL2) Execute
sp_changedbowner 'sa'
Powered by ScribeFire.
Sunday, December 23, 2007
How to find is Operating System is 32 Bit or 64 Bit
To find out if your operating system is 64bit or 32bit, open a
command prompt and type "SET Processor" <enter>. This will show
you all the environment variables that start with PROCESSOR. For
example, if your operating system is 64bit, whether AMD or Intel eith
EM64T extensions, you'll see:
PROCESSOR_ARCHITECTURE=AMD64
On an Intel Itanium you would see:
PROCESSOR_ARCHITECTURE=IA64
Powered by ScribeFire.
Wednesday, December 12, 2007
Monday, December 10, 2007
Bring the database which is in suspect
1. We then execute
Use Master
Go
sp_configure 'allow updates', 1
reconfigure with override
Go
- So that it would allow us to make changes directly to the SYSTEM tables(this option is used in extreme circumstances).
3. The following command lets us put the database in an emergency mode
Update SYSDATABASES set status = 32768 where name = 'SampleDB'
- In Emergency Mode it would allow us to perform certain actions which would not be possible in either Normal or Suspect Modes.
4. Having put the database in Emergency Mode we can then create a new log for the database since the current one can corrupt or inaccessible.
DBCC REBUILD_LOG('SampleDB', ‘C:\Data\SampleDB_newlog.ldf’)
- After this we can check the current files of the database using sp_helpfile command after changing the database context in the Query Analyzer to the affected database
5. We then check for consistency issues on the database by executing:
DBCC CHECKDB('SampleDB')
Go
- If the above command fails it usually recommends the next available option to use. You have to clearly understand the option before you try it since it could result in data-loss
6. Turn off the option to make direct changes to the SYSTEM tables using:
sp_configure 'allow updates', 0
reconfigure with override
Go
7. Then proceeded to take a complete database backup of the database.
Tuesday, November 13, 2007
Query to find computed columns
SELECT TABLE_NAME= OBJ.NAME,COLUMN_NAME=COL.NAME,FORMULA=CMT.TEXT
FROM SYSCOLUMNS COL, SYSOBJECTS OBJ, SYSCOMMENTS CMT
WHERE COL.ID = OBJ.ID
AND OBJ.ID = CMT.ID
AND COL.COLID = CMT.NUMBER
AND ISCOMPUTED = 1
AND OBJ.TYPE = 'U'
Tuesday, November 06, 2007
SET OPTION considerations when running DBCC with indexes on computed columns
SET OPTION considerations when running DBCC with indexes on computed columns
SET OPTION considerations when running DBCC with indexes on computed columns
Error Message:
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 1934: [Microsoft][ODBC SQL Server Driver][SQL Server]DBCC failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER, ARITHABORT'.
Also refer KB: http://support.microsoft.com/kb/902388/en-us
Powered by ScribeFire.
Monday, August 20, 2007
Update stats on database with Read only
Server: Msg 3906, Level 16, State 1, Line 1
Could not run BEGIN TRANSACTION in database 'doctrack' because the database is read-only.
Updating dbo.doclink1
Sunday, August 19, 2007
SQL Server Performance Audit Checklist
Identify SQL Server Hardware Bottlenecks
Performance Audit Checklist
Counter Name Average Minimum Maximum Memory: Pages/sec Memory: Available Bytes Physical Disk: % Disk time Physical Disk: Avg. Disk Queue Length Processor: % Processor Time System: Processor Queue Length SQL Server Buffer: Buffer Cache Hit Ratio SQL Server General: User Connections
Monday, July 30, 2007
How to use Kerberos authentication in SQL Server
This could be either because of a network problem (i.e. the machine could not
connect to the domain controller for authenticating the user) or the user
account (KUT01\SQL_rest_test_3 ) running sqlservr.exe does not have
permission to query the domain controller (KU). The later could happen if
sqlservr.exe is running using an domain account
(KUT01\SQL_rest_test_3) different from the user 'KU\SQLService' above
the machine is on a different domain (KUT01) than 'KU\SQLService' and there
is no two-way trust.
inserting data into SQL Server on T081\SQLTest03,
by using a UNC path
\\Box3\Share_Data\
Use below;
How to use Kerberos authentication in SQL Server
Powered by ScribeFire.
Monday, July 23, 2007
"Unable to validate product key" during installation of SQL Server 2000 Standard Edition.
"Unable to validate product key" during installation of SQL Server 2000 Standard Edition.
Faced this problem today on Windows 2000 Advanced server with SP4.
Just followed as advised on the KB# 555496, it resolved the problem.
Powered by ScribeFire.
Friday, July 06, 2007
SQL Server - How To Tell If There Is A Trace Running
Server-side tracing is the process of having your SQL Server machine save events to a physical file on that machine without using the Profiler client tool. Server-side tracing is enabled and controlled by using SQL Server system-supplied stored procedures and functions. With these system-supplied processes, you can identify what to trace, when to start and stop tracing, what traces are running, and view trace information stored in the trace file.
Here is how you view the number of traces currently running:
SELECT count(*) FROM :: fn_trace_getinfo(default)
WHERE property = 5 and value = 1
Here is how you can find more detail about the running traces:
SELECT * FROM :: fn_trace_getinfo(default)
You can terminate a trace with the 'sp_trace_setstatus' stored procedure using the traceid:
EXEC sp_trace_setstatus 1, @status = 0
EXEC sp_trace_setstatus 1, @status = 2
setting the status to 0 stops the trace
setting the status to 2 closes the trace and deletes its definition from the server
Powered by ScribeFire.
Friday, April 20, 2007
How to reassign the DTS package owner
In most cases, it doesn't really matter who owns the package - who is
executing it is more important. However, there is an undocumented
stored procedure called msdb..sp_reassign_dtspackageowner, which you
can use.
sp_reassign_dtspackageowner
powered by performancing firefox
Thursday, April 19, 2007
SQL Server 2005 - Troubleshooting
PERFORMANCE
http://www.microsoft.com/technet/prodtechnol/sql/2005/tsprfprb.mspx Troubleshooting Performance Problems in SQL Server 2005
http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx Batch Compilation, Recompilation, and Plan Caching Issues in SQL Server 2005
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/performance_tuning_waits_queues.mspx SQL Server 2005 Waits and Queues
DEADLOCKS
http://blogs.msdn.com/sqlserverstorageengine/archive/2006/06/05/617960.aspx Troubleshooting deadlocks in SQL2005
CONNECTIVITY
http://blogs.msdn.com/sql_protocols/archive/2005/10/22/sql-server-2005-connectivity-issue-troubleshoot-part-i.aspx SQL Server 2005 Connectivity Issue Troubleshoot - Part I
http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx Troubleshoot Connectivity Issue in SQL Server 2005 - Part II
http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx Troubleshoot Connectivity Issue in SQL Server 2005 - Part III
http://blogs.msdn.com/sql_protocols/archive/2006/12/02/understanding-kerberos-and-ntlm-authentication-in-sql-server-connections.aspx Understanding Kerberos and NTLM authentication in SQL Server Connections
START UP FAILURE
http://blogs.msdn.com/sql_protocols/archive/2006/04/28/585835.aspx Error Messages of SQL Server 2005 Start Up Failure
DATA RECOVERY
http://blogs.msdn.com/sqlserverstorageengine/archive/2006/06/18/636105.aspx Emergency mode repair
http://blogs.msdn.com/sqlserverstorageengine/archive/tags/DBCC+CHECKDB+Series/default.aspx DBCC CHECKDB Series
INDEXES
http://www.microsoft.com/technet/technetmag/issues/2007/03/SQLIndex/?related=/technet/technetmag/issues/2007/03/SQLIndex New Tools to Diagnose Index Health
http://www.microsoft.com/technet/technetmag/issues/2007/04/SQLQA/default.aspx Rebuilding Indexes, Disk Queue Length, and More
FRAGMENTATION
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/dbcc_showcontig_improvements.mspx DBCC SHOWCONTIG Improvements in SQL Server 2005 and comparisons to SQL Server 2000
TRANSACTION LOG
http://support.microsoft.com/default.aspx?scid=kb;EN-US;873235 How to stop the transaction log of a SQL Server database from growing unexpectedly
http://support.microsoft.com/default.aspx?scid=kb;EN-US;317375 A transaction log grows unexpectedly or becomes full on a computer that is running SQL Server
MEMORY PRESSURE
http://support.microsoft.com/default.aspx?scid=kb;EN-US;309256 How to troubleshoot SQL Server error 8645
http://support.microsoft.com/default.aspx?scid=kb;EN-US;907877 How to use the DBCC MEMORYSTATUS command to monitor memory usage on SQL Server 2005
TEMPDB
http://www.microsoft.com/technet/prodtechnol/sql/2005/workingwithtempdb.mspx Working with tempdb in SQL Server 2005
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/tempdb_capacity_planning_index.mspx TEMPDB Capacity Planning and Concurrency Considerations for Index Create and Rebuild
SQLOS - SCHEDULING
http://www.microsoft.com/technet/prodtechnol/sql/2005/diagandcorrecterrs.mspx How To Diagnose and Correct Errors 17883, 17884, 17887, and 17888
BOOKS ONLINE LINKS
http://msdn2.microsoft.com/en-us/library/ms188314.aspx Troubleshooting the Database Engine
http://msdn2.microsoft.com/en-us/library/ms138039.aspx Troubleshooting Integration Services
http://msdn2.microsoft.com/en-us/library/ms159135.aspx Troubleshooting Reporting Services
TOOLS
http://search.live.com/macros/sql_server_user_education/booksonline Link para efectuar uma pesquisa através do live.com nos Books Online
http://msdn2.microsoft.com/en-us/library/ms162833.aspx SQLdiag Utility
http://www.microsoft.com/downloads/details.aspx?familyid=1d3a4a0d-7e0c-4730-8204-e419218c1efc&displaylang=en SQL Server 2005 Performance Dashboard Reports
Nota: Para utilizar esta nova ferramenta é necessário ter previamente instalado no servidor e no cliente o SQL Server 2005 SP2.
http://www.microsoft.com/downloads/details.aspx?familyid=da0531e4-e94c-4991-82fa-f0e3fbd05e63&displaylang=en SQL Server 2005 Best Practices Analyzer (CTP de Fevereiro 2007)
http://blogs.technet.com/beatrice/archive/2007/03/23/sql-server-2005-performance-troubleshooting.aspx SQL Server Profiler + System Performance Monitor
http://sqlblogcasts.com/files/folders/custom_reports/default.aspx Exemplo de um custom Report – TASKPAD view
http://www.microsoft.com/technet/support/ee/ee_advanced.aspx Events and Errors Message Center
http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/default.mspx SQL Server Best Practices
WEBCASTS
Troubleshooting and Performance Tuning
TechNet Webcast: A SQL Server DBA’s Guide to CLR Integration (Level 300)
TechNet Webcast: Performance Diagnosis in SQL Server 2005 (Level 300)
TechNet Webcast: SQL Server 2005 Database Tuning Advisor (Level 300)
TechNet Webcast: SQL Server 2005 Troubleshooting: Supportability Features for SQL 2005 (Level 300)
TechNet Webcast: Troubleshooting Performance Problems in Microsoft SQL Server 2005 (Level 200)
TechNet Webcast: Troubleshooting SQL Server 2005 Integration Services (Level 300)
WHITE PAPERS
Online Indexing Operation in SQL Server 2005
Physical Database Storage Design
Database Mirroring Best Practices and Performance Considerations
SQL Server I/O Basics, Chapter 2
http://www.microsoft.com/sql/techinfo/whitepapers/default.mspx White Papers General