TAILIEUCHUNG - SQL Server MVP Deep Dives- P11

SQL Server MVP Deep Dives- P11: Each year Microsoft invites all the MVPs from every technology and country to Redmond for an MVP Summit—all top secret—“don’t tweet what you see!” During the MVP Summit, each product team holds a series of presentations where they explain their technologies, share their vision, and listen to some honest feedback. | 356 Chapter 27 Automating SQL Server Management using SMO code can then be executed every time your backup strategy calls for a full database backup of all databases on the target server. If you remove the full database backup logic from the code sample the code can be run every time transaction log backups are to be run for all databases on the server improving your recovery interval to minimize the potential data loss in the event of a system failure. In the following script shown in listing 2 we ll connect to our target server and then get the default backup directory from the Settings collection. We ll next grab the database collection and iterate through that to do the backups. For each database we ll get the current date and time and put it into a string to use in the backup filename. We ll do the full backup for the database then we ll check to see if the database recovery model is Simple. If not we ll perform a transaction log backup on the database as well. Figure 2 The SMO Backup object Listing 2 Backing up user databases Performs a Full backup followed by a transaction log backup on all user databases param string srvname MyServer MyInstance Load SMO assembly and if we re running SQL 2008 DLLs load the SMOExtended and SQLWMIManagement libraries v LoadWithPartialName p p1 p 1 .Split p2 pi 1 .Split . if p2 0 -ne 9 LoadWithPartialName . SMOExtended out-null LoadWithPartialName . SQLWMIManagement out-null s new-object srvname bkdir dbs foreach db in dbs if -eq False -and -eq False Please purchase PDF Split-Merge on to remove this watermark. Restore 357 dbname dt get-date -format yyyyMMddHHmmss bk new-object

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.