Posts

Khôi phục SQL Server từ Transaction Log

Image
Khôi phục SQL Server từ Transaction Log Dương Nguyễn Quản trị mạng -  Backup là một phần công việc cần thực hiện trong quá trình nâng cấp và vận hành máy chủ SQL. Và phần công việc còn lại là tiến trình restore được thực hiện mỗi khi máy chủ SQL có lỗi phát sinh. Một trong những tình huống này có thể liên quan tới quá trình restore từ file Transaction Log (Bản ghi giao tác) Backups. Transaction Log (có tên gọi khác là Database Log hay Binary Log) là một lược sử hành động được hệ thống quản lý cơ sở dữ liệu thực thi để đảm bảo thuộc tính ACID (atomicity, consistency, isolation, durability) khi hệ thống bị lỗi. Có một rắc rối với Transaction Log Backups đó là yêu cầu restore từ nhiều file hơn là chỉ từ một file full backup. Để khôi phục thành công cơ sở dữ liệu, bạn phải sử dụng mọi file Transaction Log Backups đã được tạo và chúng phải được khôi phục theo trật tự khi tạo. Nếu một file Transaction Log Backup nào đó bị lỗi, bạn sẽ không thể thực hiện khôi phục bất kì file Transaction ...

Creating a date dimension or calendar table in SQL Server

Image
  Creating a date dimension or calendar table in SQL Server By:  Aaron Bertrand    |   Updated: 2020-04-06   |    Comments (83)    |   Related:  1  |  2  |  3  |  4  |  5  |  More  >  Dates Problem A calendar table can be immensely useful, particularly for reporting purposes, and for determining things like business days between two dates. I often see people struggling with manually populating a calendar or date dimension table; usually there are lots of loops and iterative code constructs being used. In this tip I will show you how to build and use a calendar table using a set-based solution that is powerful and easily customizable. Solution I build calendar tables all the time, for a variety of business applications, and have come up with a few ways to handle certain details. Sharing them here will hopefully prevent you from re-invent...