msdbãã¼ã¿ãã¼ã¹ãã¡ã³ããã³ã¹
SQL Server Enterprise Manager ã§ãã¼ã¿ãã¼ã¹ã®å¾©å
ããããã¨ããæãããã¼ã¿ãã¼ã¹ã®å¾©å
ããã¤ã¢ãã°ã®è¡¨ç¤ºãé
ãã¨æãããã¨ã¯ç¡ãã ãããï¼
SQL Server 2000 ã§ã¯ãããã¯ã¢ãããããã³ã«ããã¼ã¿ãã¼ã¹ã¨ããã¯ã¢ããå
ãè¨é²ããã
ããã§ãã¡ã³ããã³ã¹ï¼ä¸è¦ãªå±¥æ´ãåé¤ï¼ãããã¨ã«ããã表示ãéããªãã
msdbã«ã¤ã³ããã¯ã¹ä»ä¸
ããã¯ã¢ããå±¥æ´ã®åé¤ï¼sp_delete_backuphistoryï¼ãå®è¡ããåã«ã¤ã³ããã¯ã¹ãä»ä¸ãããã¨ããå§ãããã
以ä¸(https://weblogs.sqlteam.com/geoffh/2008/01/21/msdb-performance-tuning/)ããå¼ç¨
/************************************************************************ * * * Title: msdb index creation * * Author: Geoff N. Hiten * * Purpose: Index msdb database * * Date: 12/12/2005 * * Modifications: * * * * 01-01-2001 * * Sample Entry * * * * * ************************************************************************/ use msdb go --backupset Create index IX_backupset_backup_set_id on backupset(backup_set_id) go Create index IX_backupset_backup_set_uuid on backupset(backup_set_uuid) go Create index IX_backupset_media_set_id on backupset(media_set_id) go Create index IX_backupset_backup_finish_date on backupset(backup_finish_date) go Create index IX_backupset_backup_start_date on backupset(backup_start_date) go --backupmediaset Create index IX_backupmediaset_media_set_id on backupmediaset(media_set_id) go --backupfile Create index IX_backupfile_backup_set_id on backupfile(backup_set_id) go --backupmediafamily Create index IX_backupmediafamily_media_set_id on backupmediafamily(media_set_id) go --restorehistory Create index IX_restorehistory_restore_history_id on restorehistory(restore_history_id) go Create index IX_restorehistory_backup_set_id on restorehistory(backup_set_id) go --restorefile Create index IX_restorefile_restore_history_id on restorefile(restore_history_id) go --restorefilegroup Create index IX_restorefilegroup_restore_history_id on restorefilegroup(restore_history_id) go /************************************************************************ * End Script * ************************************************************************/
sp_delete_backuphistory
ããã¯ã¢ããå±¥æ´ãåé¤ããã«ã¯æ¬¡ã®ããã«è¡ããï¼ä¾ã¯ã2008/01/01ããå¤ãããã¯ã¢ããå±¥æ´ãåé¤ãã¾ãï¼
USE msdb EXEC sp_delete_backuphistory '2008/01/01'
以ä¸msdnããã®å¼ç¨(Microsoft API and Reference Catalog)
sp_delete_backuphistory
oldest_date 以åã®ããã¯ã¢ãã ã»ããã«é¢ããããã¯ã¢ããã¨å¾©å ã®å±¥æ´ãã¼ãã«ã®ã¨ã³ããªãåé¤ãã¾ããããã¯ã¢ããã復å ãè¡ããããã¨ã«ããã¯ã¢ããã¨å¾©å ã®å±¥æ´ãã¼ãã«ã«è¡ã追å ãããã®ã§ãsp_delete_backuphistory 㯠msdb ãã¼ã¿ãã¼ã¹ã®å±¥æ´ãã¼ãã«ã®ãµã¤ãºãæ¸ããã®ã«ä½¿ç¨ã§ãã¾ããæ§æ
sp_delete_backuphistory [ @oldest_date = ] 'oldest_date'
ã¸ã§ãã¨ãã¦ç»é²
ãmsdbã«ã¤ã³ããã¯ã¹ä»ä¸ãã®å¼ç¨å ãµã¤ããè¦ãããæ¹ã¯ãæ°ã¥ãã ããããã¸ã§ãã¨ãã¦ç»é²ãããã¨ãå¯è½ã
å®æçã«å±¥æ´åé¤ãå®è¡ããã¸ã§ãã追å ããæ¹æ³
- SQL Enterprise Manager ã§å¯¾è±¡ãµã¼ãã®ã管çãâãSQL Server ã¨ã¼ã¸ã§ã³ããâãã¸ã§ãããé¸æã
- ãã¸ã§ãããå³ã¯ãªãã¯ããæ°è¦ã¸ã§ã(J)...ããã¯ãªãã¯ãï¼ã¡ãã¥ã¼ãã¼ã®ãæä½ãâãæ°è¦ã¸ã§ã(J)...ãã§ãå¯ï¼
- ãå ¨è¬ãã¿ãã®ãååãã«ã¯ãé©å½ãªã¸ã§ãåï¼"å±¥æ´ã®ã¯ãªã¼ã³ã¢ãã"çï¼ãå ¥åã
- ãã¹ããããã¿ããã¯ãªãã¯ããæ°è¦(W)...ããã¯ãªãã¯ã
- ãå ¨è¬ãã¿ãã®ãã¹ãããåãã«ã¯ãé©å½ãªã¹ãããåï¼"ã¹ããã 1"çï¼ãå ¥åã
- ãå ¨è¬ãã¿ãã®ã種é¡ãã¯ããã®ã¾ã¾ãï¼"Transact-SQL ã¹ã¯ãªãã(TSQL)"ï¼
- ãå ¨è¬ãã¿ãã®ããã¼ã¿ãã¼ã¹ãã¯ã"msdb"ãé¸æã
- ãå ¨è¬ãã¿ãã®ãã³ãã³ããã«ãä¸è¨ã½ã¼ã¹ãè²¼ãä»ãã念ã®ããã解æããã¿ã³ãã¯ãªãã¯ã確èªã
- ã詳細ãã¿ãã®ãæåæã®åä½ãã¯ã"æåãã¬ãã¼ããã¸ã§ããçµäºãã"ãé¸æã
- ãOKããã¿ã³ãã¯ãªãã¯
- ãã¹ã±ã¸ã¥ã¼ã«ãã¿ããã¯ãªãã¯ãããæ°è¦ã¹ã±ã¸ã¥ã¼ã«(W)...ããã¯ãªãã¯ã
- ãååãã«ã¯ãé©å½ãªã¹ã±ã¸ã¥ã¼ã«åï¼"ã¹ã±ã¸ã¥ã¼ã« 1"çï¼ãå ¥åã
- ãã¹ã±ã¸ã¥ã¼ã«ã®ç¨®é¡ãã¯ããå®æçããé¸æãããå¤æ´(A)...ããã¯ãªãã¯ã
- å®è¡ééçãè¨å®ããOKããã¿ã³ãã¯ãªãã¯ã
- ãOKããã¿ã³ãã¯ãªãã¯ã
- ãOKããã¿ã³ãã¯ãªãã¯ã
declare @oldest_date smalldatetime; set @oldest_date = dateadd(dd, -7,getdate()) EXEC sp_delete_backuphistory @oldest_date;
ä¸è¨ã®ä¾ã¯ã@oldest_date ã "-7"ãã¤ã¾ããï¼é±éããåã®å±¥æ´ãåé¤ããã
ãã¼ã¿ãã¼ã¹ã®å§ç¸®
ã¸ã§ããæ£å¸¸ã«ç¨¼åãã¦ãããã¨ã確èªã§ãããããã¼ã¿ãã¼ã¹ãå§ç¸®ããã£ã¹ã¯å®¹éãç¯ç´ãããã