I love to research SQL Server Internal and SQL Server Architect. Today I found out the knowledge about Server Message Block, that is useful....

Blog đang chỉnh sửa
I love to research SQL Server Internal and SQL Server Architect. Today I found out the knowledge about Server Message Block, that is useful....
Here is a useful knowledge a DBA should know. If we perform backup a large database, we can split it into multiple files and store them in m...
SQLIO is a tool provided by Microsoft which can also be used to determine the I/O capacity of a given configuration. For more information: h...
Maintaining database is the responsibility of DBA and it is done periodly. But it seems that many DBA do not like to use Maintenance Plan in...
Here is the answer. The information is stored in the MSDB database. DECLARE @dbname sysname, @days int SET @dbname = NULL --substitute fo...
There is nothing to ensure that your backup could be restored unless you really restore it. Here is the tip that we can automate the task ...
Find all Temporary tables in Tempdb SELECT * FROM tempdb.INFORMATION_SCHEMA.tables ORDER BY TABLE_NAME Tham khảo: http://www.sqlviet.co...
This configuration help the database file growth faster, but it just applies to data file, not log file. Please be noted that after we cha...
I kept getting emails and phone calls that said, “The SQL Server is running slow right now, and they told me to ask Brent.” Each time, I’d...
Here is the script give us I/O statistics in each data/log file SELECT DB_NAME(fs.database_id) AS [Database Name], mf.physical_name, io_st...
SELECT DB_NAME([database_id])AS [Database Name], [file_id], name, physical_name, type_desc, state_desc, CONVERT( bigint, size/128.0) AS [To...
SELECT servicename, startup_type_desc, status_desc, last_startup_time, service_account, is_clustered, cluster_nodename FROM sys.dm_server_s...
SELECT OBJECT_NAME(s.[object_id]) AS [Table Name], i.name AS [Index Name], i.index_id,user_updates AS [Total Writes], user_seeks + user_sca...
http://blogs.msdn.com/b/blogdoezequiel/archive/2013/05/23/pagelatch-ex-waits-and-heavy-inserts.aspx
https://www.simple-talk.com/sql/database-administration/sql-server-transaction-log-fragmentation-a-primer/
SQL Server transaction log files have an internal structure called the Virtual Log File or VLF. When the number of VLFs grow out of control...
CREATE TABLE #VLF_temp (FileID varchar(3), FileSize numeric(20,0), StartOffset bigint, FSeqNo bigint, S...
Sử dụng 1 tool của Microsoft gọi là Contig để check database file bị phân mảnh, và nếu ta muốn giải phân mảnh, làm cho database offline và g...
Đoạn script để monitor tempdb, nếu là dba thì nên cài đặt để được inform mỗi ngày. Dựa vào thông tin này sau một ngày busy của production s...
Nhiều người nghĩ rằng Table Variable được lưu trên memory, thật ra nó được lưu trong Tempdb. Ta có thể chứng minh điều này bằng cách dùng ...
Tìm logical cpu SELECT cpu_countFROM sys.dm_os_sys_info http://blog.sqlauthority.com/2012/02/04/sql-server-finding-count-of-logical-cpu-...
This is a free tool, we use it for creating pressures to SQL Server, and testing Performance. As the screenshot below, I opened 200 sessio...
Trong ví dụ dưới đây tác giả chứng minh không nên shrink database. http://www.sqlskills.com/blogs/paul/why-you-should-not-shrink-your-data-...
Công cụ này giúp ta phân tích và xử lý phân mảnh cho SQL Server, cho 1 table hay toàn bộ database. http://www.idera.com/productssoluti...
coi lại về query page life execptancy query những query trong cache to tìm poort performacne
SELECT TOP 100 s.database_name , m.physical_device_name , CAST ( CAST ( s.backup_size / 1000000 AS INT ) AS VARCHAR ( 14 )) + ' ...
SELECT * FROM MSDB..RestoreHistory WITH (nolock) WHERE destination_database_name = 'YourDBName' ORDER BY restore_date DESC
http://blog.sqlxdetails.com/transaction-log-myths/ Đọc thêm: http://technet.microsoft.com/en-us/library/ms189085(v=sql.105).aspx BACKUP...
http://blog.sqlxdetails.com/procedure-with-execute-as-login/
http://blog.sqlxdetails.com/transaction-log-truncate-why-it-didnt-shrink-my-log/
We can use the following SQL Statement: DBCC LOGINFO Each record represent one VLF 2 means Active, 0 is inactive. Please notice t...
http://www.sqlskills.com/blogs/paul/creating-detaching-re-attaching-and-fixing-a-suspect-database/
We can monitor the transaction log for all databases in an SQL Server Instance based on the SQL Statement: DBCC SQLPERF (LOGSPACE) Follo...
Có time thì nghiên cứu cái này http://technet.microsoft.com/en-us/sysinternals/bb545046
SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName, i.name AS IndexName, i.index_id AS IndexID, 8 * SUM(a.used_pages) AS 'Indexsize(KB)...
The fact that writes are always sequential also means that SQL Server will only ever write to one transaction log file at a time. There is ...
Missing index tức là các index không tồn tại trong SQL Server, nhưng có những câu truy vấn nào đó cần những index này, dba phải biết cách lấ...
http://www.sqlskills.com/blogs/jonathan/tracking-problematic-pages-splits-in-sql-server-2012-extended-events-no-really-this-time/
Trang web này cung cấp một giải pháp SQL Server miễn phí giúp bảo trì database. Đây là một T-SQL script hay giúp maintenance index, sử dụn...
Hôm nay đọc được bài viết, có vẻ như SQL Server tự động thực hiện dbcc checkdb cho các system databse, và có 1 bug là nó sẽ bỏ qua master và...
http://www.sqlservercentral.com/articles/Execute+AS/71673/ Một lỗi đã gặp khi dùng Execute as http://support.microsoft.com/kb/913423
SQL Server xử lý Deadlock như thế nào? Dựa vào 2 tiêu chí: Deadlock Priority Rollback cost Cách tạo Deadlock trong SQL Server Bướ...
Đoạn script tìm những long running transaction đang mở SELECT ST.transaction_id AS TransactionID ,DB_NAME(DT.database_id) AS DatabaseName...
Khi ta tiếp quản 1 sql server có nhiều vấn đề tiềm tàng phát sinh, ta phải nhanh chóng có được thông tin của chúng. Nói là tool nhưng thực...
Nếu ta cần tune 1 câu truy vấn, ta có thể phải thử nhiều phương án khác nhau. Có 1 tool tự động log lại và so sánh thông số cho mỗi phương...
Link kiểm chứng http://technet.microsoft.com/en-us/library/ms190362.aspx
Nếu ta thấy EP có dùng merge join, và thấy có sort icon, tức là ta phải cân nhắc 2 lựa chọn - Merge join chưa phải là giải pháp tối ưu, v...
Set filter trong profiler trước khi tạo Server trace Lưu ý là ta không cần dấu % ở đây Lúc tạo server trace có tổng cộng 5 tham số, tham...
http://sqlblog.com/blogs/linchi_shea/archive/2007/08/01/trace-profiler-test.aspx Xem thêm cách tóm Nested Stored Procedure với Profiler: ...
Đây là một công cụ để đọc SQL Server Execution plan Cái hay của Sentry Plan Explorer là ta có thể xem chi phí theo IO hay CPU hay cả 2 bằ...
Execution plan - Cách đọc implicit convert từ Execution plan? - Merge join, hash match join, nested loop join Cách viết Query - Set noc...
Trong dự án, có 1 SSIS package đọc file từ Excel. 1. File thứ 1 Khi mở file Excel ra thì tôi thấy nó hiển thị dưới dạng dd/mm/yyyy, cột n...
Truncate We have created following table: CREATE TABLE dbo.T_EMPLOYEE ( EmpNo VARCHAR(20) NOT NULL PRIMARY KEY, EmpName VARCHAR(50), ...
create table #temp_test (id int) insert into #temp_test values(1) insert into #temp_test values(NULL) insert into #temp_test values(2) ...
Try.. Catch.. Can we implement Try/Catch blocks inside Use Defined Functions(UDF)? Choose your answer: Yes No Correct answer: No...
SELECT distinct ty.name FROM sys.tables as t inner join sys.columns AS c on c.object_id = t.object_id inner join sys.types AS ty ON c.u...
Có 1 tác giả chia sẻ SQL Server chạy chậm, tìm hiểu các transactions thì thấy hầu hết là wait type RESOURCE_SEMAPHORE. Chứng minh đang có Me...
http://dacosta9.wordpress.com/2009/02/26/sql-server-2008-io-tuning-filegroups/
How you decide to confi gure Max Server Memory when you build a server (there are many opinions on the matter) isn’t as important as measu...
Đoạn script sau đây sử dụng sys.dm_exec_cached_plans để hiển thị số lượng cached plans và dung lượng tính theo MB: SELECT count(*) AS ...
Cách 1: Monitoring SQL Server’s buffer pool is a great way to look out for memory pressure, and Performance Monitor provides numerous co...
http://blogs.msdn.com/b/mvpawardprogram/archive/2012/06/04/using-sys-dm-os-ring-buffers-to-diagnose-memory-issues-in-sql-server.aspx http:/...