블로그 이미지
bedbmsguru

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
  • total
  • today
  • yesterday
2010. 11. 3. 11:34 SQL SERVER

/*****

주 서버 로그 전달 데이터베이스, 백업 폴더 및 공유, 백업 보유 기간, 백업 작업, 최종 백업 시간 및 파일 정보

******/
SELECT primary_database, backup_directory, backup_share, backup_retention_period AS backup_retention_minutes,
       j.name AS backup_job_name, monitor_server, last_backup_file, last_backup_date
FROM     msdb.dbo.log_shipping_primary_databases pd
JOIN msdb.dbo.sysjobs j ON j.job_id = pd.backup_job_id
order by last_backup_date
GO


/*****

주 서버 로그 전달 데이터베이스에 대한 보조 서버 및 데이터베이스 정보

******/
/*****

주 데이터베이스 모니터링 이력 정보

******/
SELECT pd.primary_database,
        CASE agent_type WHEN 0 THEN 'Backup' WHEN 1 THEN 'Copy' WHEN 2 THEN 'Restore' END AS agent_type,
        database_name,
    CASE session_status WHEN 0 THEN 'Starting' WHEN 1 THEN 'Running' WHEN 2 THEN 'Success'
    WHEN 3 THEN 'Error' WHEN 4 THEN 'Warning' END AS session_status,
log_time, message
FROM     msdb.dbo.log_shipping_monitor_history_detail hd
JOIN msdb.dbo.log_shipping_primary_databases pd ON pd.primary_id = hd.agent_id
WHERE   log_time >= CAST(CONVERT(CHAR(10), getdate(), 120) AS DATETIME)
ORDER BY pd.primary_database, log_time
GO

/*****

주 데이터베이스 상세 오류 정보

******/

SELECT pd.primary_database,
 CASE agent_type WHEN 0 THEN 'Backup' WHEN 1 THEN 'Copy' WHEN 2 THEN 'Restore' END AS agent_type,
 database_name, log_time, message
    FROM     msdb.dbo.log_shipping_monitor_error_detail ed
    JOIN msdb.dbo.log_shipping_primary_databases pd ON pd.primary_id = ed.agent_id
    WHERE   log_time >= CAST(CONVERT(CHAR(10), getdate(), 120) AS DATETIME)
    ORDER BY pd.primary_database, log_time

 
/*****

보조 서버에 대한 로그 전달 데이터베이스, 백업 원본 및 대상 폴더, 백업 파일 보유 기간, 백업 파일 복사 및 복원 작업, 최종 복원 시간 정보

******/
SELECT s.primary_server, s.primary_database, last_restored_date , backup_source_directory, backup_destination_directory,
                           file_retention_period AS file_retention_minutes,
                           j1.name AS copy_job_name, j2.name AS restore_job_name, monitor_server
FROM     msdb.dbo.log_shipping_secondary s
                           JOIN msdb.dbo.sysjobs j1 ON j1.job_id = s.copy_job_id
                           JOIN msdb.dbo.sysjobs j2 ON j2.job_id = s.restore_job_id
                           JOIN msdb.dbo.log_shipping_monitor_secondary ms ON ms.secondary_id = s.secondary_id
            
order by last_restored_date
GO 
posted by bedbmsguru