SqlServer 備份集和備份片以及mirror的backup_set_id
官方文件
backupset類似oracle的備份集
backupmediafamily類似oracle的備份片,一個備份檔案就是一個備份片,透過family_sequence_number欄位來區分每個備份片
mirror生成多份備份時,必須加WITH FORMAT否則報錯Use WITH FORMAT to create a new mirrored backup set.
不帶Mirror的備份,一個資料庫只有一個備份檔案
BACKUP DATABASE [testdb2] TO DISK = N'L:\BAK\testdb2_full_f1.bak'
SELECT * FROM msdb.dbo.backupset where database_name='testdb2' and type='D' and backup_finish_date>dateadd(mi,-10,getdate())
backup_set_id backup_set_uuid media_set_id first_family_number first_media_number last_family_number last_media_number catalog_family_number catalog_media_number position expiration_date software_vendor_id name description user_name software_major_version software_minor_version software_build_version time_zone mtf_minor_version first_lsn last_lsn checkpoint_lsn database_backup_lsn database_creation_date backup_start_date backup_finish_date type sort_order code_page compatibility_level database_version backup_size database_name server_name machine_name flags unicode_locale unicode_compare_style collation_name is_password_protected recovery_model has_bulk_logged_data is_snapshot is_readonly is_single_user has_backup_checksums is_damaged begins_log_chain has_incomplete_metadata is_force_offline is_copy_only first_recovery_fork_guid last_recovery_fork_guid fork_point_lsn database_guid family_guid differential_base_lsn differential_base_guid compressed_backup_size key_algorithm encryptor_thumbprint encryptor_type
23 0A1A4927-E0AB-4CBE-9706-A47D28667529 23 1 1 1 1 1 1 1 NULL 4608 NULL NULL DAI\lukes.liao 13 0 5598 -32 0 39000000198900037 39000000200600001 39000000198900037 39000000167800037 2021-02-22 21:55:17.000 2021-02-28 21:47:24.000 2021-02-28 21:47:25.000 D 52 0 130 852 3290112 testdb2 WONCNFORIDB WONCNFORIDB 512 1033 196609 SQL_Latin1_General_CP1_CI_AS 0 FULL 0 0 0 0 0 0 0 0 0 0 8B03AA60-42A8-4EB9-9477-F2881D7141D8 8B03AA60-42A8-4EB9-9477-F2881D7141D8 NULL 3C8FADBF-6735-45C6-9BCB-7BE48C20C87C 1D0A09F2-E189-4CAC-8F14-C2A28CA73992 NULL NULL 3290112 NULL NULL NULL
--結果只有一行
select * from msdb.dbo.backupmediafamily where media_set_id=23
media_set_id family_sequence_number media_family_id media_count logical_device_name physical_device_name device_type physical_block_size mirror
23 1 32222373-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_f1.bak 2 512 0
--結果只有一行,一份備份,這個備份只有一個備份檔案,family_sequence_number是1,mirror欄位值是0
不帶Mirror的備份,一個資料庫備份拆分成2個備份檔案
BACKUP DATABASE [testdb2] TO DISK = N'L:\BAK\testdb2_full_two_f1.bak',DISK = N'L:\BAK\testdb2_full_two_f2.bak';
SELECT * FROM msdb.dbo.backupset where database_name='testdb2' and type='D' and backup_finish_date>dateadd(mi,-10,getdate())
backup_set_id backup_set_uuid media_set_id first_family_number first_media_number last_family_number last_media_number catalog_family_number catalog_media_number position expiration_date software_vendor_id name description user_name software_major_version software_minor_version software_build_version time_zone mtf_minor_version first_lsn last_lsn checkpoint_lsn database_backup_lsn database_creation_date backup_start_date backup_finish_date type sort_order code_page compatibility_level database_version backup_size database_name server_name machine_name flags unicode_locale unicode_compare_style collation_name is_password_protected recovery_model has_bulk_logged_data is_snapshot is_readonly is_single_user has_backup_checksums is_damaged begins_log_chain has_incomplete_metadata is_force_offline is_copy_only first_recovery_fork_guid last_recovery_fork_guid fork_point_lsn database_guid family_guid differential_base_lsn differential_base_guid compressed_backup_size key_algorithm encryptor_thumbprint encryptor_type
24 D02B55B7-2208-414E-96AF-873F751F1A93 24 1 1 2 1 1 1 1 NULL 4608 NULL NULL DAI\lukes.liao 13 0 5598 -32 0 39000000201600037 39000000203300001 39000000201600037 39000000198900037 2021-02-22 21:55:17.000 2021-02-28 21:57:56.000 2021-02-28 21:57:56.000 D 52 0 130 852 3367936 testdb2 WONCNFORIDB WONCNFORIDB 512 1033 196609 SQL_Latin1_General_CP1_CI_AS 0 FULL 0 0 0 0 0 0 0 0 0 0 8B03AA60-42A8-4EB9-9477-F2881D7141D8 8B03AA60-42A8-4EB9-9477-F2881D7141D8 NULL 3C8FADBF-6735-45C6-9BCB-7BE48C20C87C 1D0A09F2-E189-4CAC-8F14-C2A28CA73992 NULL NULL 3367936 NULL NULL NULL
--結果只有一行
select * from msdb.dbo.backupmediafamily where media_set_id=24
media_set_id family_sequence_number media_family_id media_count logical_device_name physical_device_name device_type physical_block_size mirror
24 1 3CFCB783-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_two_f1.bak 2 512 0
24 2 A3396D7D-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_two_f2.bak 2 512 0
--結果有2行,一份備份,這個備份生成兩個備份2檔案,每個備份檔案只有一行,family_sequence_number是1、2,mirror欄位值都是0
帶Mirror的備份,一個資料庫只有一個備份檔案
BACKUP DATABASE [testdb2] TO DISK = N'L:\BAK\testdb2_full_mirror_f1.bak' MIRROR TO DISK = N'L:\BAK\testdb2_full_mirror_f2.bak' WITH FORMAT;
SELECT * FROM msdb.dbo.backupset where database_name='testdb2' and type='D' and backup_finish_date>dateadd(mi,-10,getdate())
backup_set_id backup_set_uuid media_set_id first_family_number first_media_number last_family_number last_media_number catalog_family_number catalog_media_number position expiration_date software_vendor_id name description user_name software_major_version software_minor_version software_build_version time_zone mtf_minor_version first_lsn last_lsn checkpoint_lsn database_backup_lsn database_creation_date backup_start_date backup_finish_date type sort_order code_page compatibility_level database_version backup_size database_name server_name machine_name flags unicode_locale unicode_compare_style collation_name is_password_protected recovery_model has_bulk_logged_data is_snapshot is_readonly is_single_user has_backup_checksums is_damaged begins_log_chain has_incomplete_metadata is_force_offline is_copy_only first_recovery_fork_guid last_recovery_fork_guid fork_point_lsn database_guid family_guid differential_base_lsn differential_base_guid compressed_backup_size key_algorithm encryptor_thumbprint encryptor_type
25 95A43F8D-0477-491C-B680-9A361E25E126 25 1 1 1 1 1 1 1 NULL 4608 NULL NULL DAI\lukes.liao 13 0 5598 -32 0 39000000204400037 39000000206100001 39000000204400037 39000000201600037 2021-02-22 21:55:17.000 2021-02-28 22:03:46.000 2021-02-28 22:03:47.000 D 52 0 130 852 3290112 testdb2 WONCNFORIDB WONCNFORIDB 512 1033 196609 SQL_Latin1_General_CP1_CI_AS 0 FULL 0 0 0 0 0 0 0 0 0 0 8B03AA60-42A8-4EB9-9477-F2881D7141D8 8B03AA60-42A8-4EB9-9477-F2881D7141D8 NULL 3C8FADBF-6735-45C6-9BCB-7BE48C20C87C 1D0A09F2-E189-4CAC-8F14-C2A28CA73992 NULL NULL 3290112 NULL NULL NULL
--結果只有一行
select * from msdb.dbo.backupmediafamily where media_set_id=25
media_set_id family_sequence_number media_family_id media_count logical_device_name physical_device_name device_type physical_block_size mirror
25 1 66D9C8DC-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_f1.bak 2 512 0
25 1 66D9C8DC-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_f2.bak 2 512 1
--結果有2行,2份備份,mirror欄位值0的第一份備份,mirror欄位值1的是第2份備份,兩份備份的family_sequence_number都是1
帶Mirror的備份,一個資料庫備份拆分成2個備份檔案
BACKUP DATABASE [testdb2] TO DISK = N'L:\BAK\testdb2_full_mirror_one_f1.bak',DISK = N'L:\BAK\testdb2_full_mirror_one_f2.bak'
MIRROR TO DISK = N'L:\BAK\testdb2_full_mirror_two_f1.bak',DISK = N'L:\BAK\testdb2_full_mirror_two_f2.bak' WITH FORMAT;
SELECT * FROM msdb.dbo.backupset where database_name='testdb2' and type='D' and backup_finish_date>dateadd(mi,-3,getdate())
backup_set_id backup_set_uuid media_set_id first_family_number first_media_number last_family_number last_media_number catalog_family_number catalog_media_number position expiration_date software_vendor_id name description user_name software_major_version software_minor_version software_build_version time_zone mtf_minor_version first_lsn last_lsn checkpoint_lsn database_backup_lsn database_creation_date backup_start_date backup_finish_date type sort_order code_page compatibility_level database_version backup_size database_name server_name machine_name flags unicode_locale unicode_compare_style collation_name is_password_protected recovery_model has_bulk_logged_data is_snapshot is_readonly is_single_user has_backup_checksums is_damaged begins_log_chain has_incomplete_metadata is_force_offline is_copy_only first_recovery_fork_guid last_recovery_fork_guid fork_point_lsn database_guid family_guid differential_base_lsn differential_base_guid compressed_backup_size key_algorithm encryptor_thumbprint encryptor_type
26 C4857810-ADE7-4D31-B46A-ACBCB47D1928 26 1 1 2 1 1 1 1 NULL 4608 NULL NULL DAI\lukes.liao 13 0 5598 -32 0 39000000207100037 39000000208800001 39000000207100037 39000000204400037 2021-02-22 21:55:17.000 2021-02-28 22:13:12.000 2021-02-28 22:13:12.000 D 52 0 130 852 3367936 testdb2 WONCNFORIDB WONCNFORIDB 512 1033 196609 SQL_Latin1_General_CP1_CI_AS 0 FULL 0 0 0 0 0 0 0 0 0 0 8B03AA60-42A8-4EB9-9477-F2881D7141D8 8B03AA60-42A8-4EB9-9477-F2881D7141D8 NULL 3C8FADBF-6735-45C6-9BCB-7BE48C20C87C 1D0A09F2-E189-4CAC-8F14-C2A28CA73992 NULL NULL 3367936 NULL NULL NULL
--結果只有一行
select * from msdb.dbo.backupmediafamily where media_set_id=26 order by mirror
26 1 F6483E5A-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_one_f1.bak 2 512 0
26 2 0704B239-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_one_f2.bak 2 512 0
26 2 0704B239-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_two_f2.bak 2 512 1
26 1 F6483E5A-0000-0000-0000-000000000000 1 NULL L:\BAK\testdb2_full_mirror_two_f1.bak 2 512 1
--結果有4行,2份備份,mirror欄位值0的第一份備份,這裡面兩個備份檔案的family_sequence_number分別是1、2,mirror欄位值1的是第2份備份,這裡面兩個備份檔案的family_sequence_number分別是1、2
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30126024/viewspace-2760242/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 備份集和備份片之間的關係
- Backup And Recovery User's Guide-RMAN備份概念-備份集-備份集和備份片GUIIDE
- RMAN筆記之備份集和備份片筆記
- 理解備份集backup set與備份片backup piece
- SqlServer備份和恢復(二)SQLServer
- SqlServer 備份和恢復(一)SQLServer
- sqlserver的日誌備份SQLServer
- 關於SQLSERVER備份SQLServer
- SQLServer遠端備份SQLServer
- SQLServer備份指令碼SQLServer指令碼
- sqlserver遠端備份和還原SQLServer
- Backup And Recovery User's Guide-備份RMAN備份-使用RMAN備份備份集GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-備份集的數量和大小(多路化備份集)GUIIDE
- RMAN備份之備份多個備份集到帶庫(三)
- RMAN備份之備份多個備份集到帶庫(二)
- RMAN備份之備份多個備份集到帶庫(一)
- oracle的熱備份和冷備份Oracle
- MONGODB使用MONGDODUMP備份來搭建備份集MongoDB
- SQLServer 理解copyonly備份操作SQLServer
- RAC模式下的備份策略以及RMAN備份指令碼模式指令碼
- Backup And Recovery User's Guide-RMAN備份概念-備份集-備份集塊壓縮GUIIDE
- exp備份和rman備份的區別
- RMAN備份型別 - 備份集(backupset)和映象副本(Image copy)型別
- Backup And Recovery User's Guide-備份RMAN備份-備份集的多重拷貝GUIIDE
- 可以將備份集備份到另外的server上嗎Server
- 【SQLServer備份策略】透過Windows任務計劃程式清理SQLServer歷史備份SQLServerWindows
- RAC模式下的備份策略以及RMAN備份指令碼(轉)模式指令碼
- RAC模式下的備份策略以及RMAN備份指令碼(ZF)模式指令碼
- SQLSERVER 備份BCP命令說明SQLServer
- SQLServer 2008 備份SQLServer
- SQLserver備份資料庫示例SQLServer資料庫
- Ms-SqlServer自動備份SQLServer
- rman備份和增量備份指令碼指令碼
- Backup And Recovery User's Guide-RMAN備份概念-備份undo(備份集加密)GUIIDE加密
- Oracle冷備份和熱備份的處理Oracle
- Oracle 熱備份和冷備份的區別Oracle
- RMAN備份多個備份集到帶庫的小bug
- Backup And Recovery User's Guide-備份RMAN備份-備份保留期對備份的備份的影響GUIIDE