Posts

Showing posts from June, 2021

SSRS REPORTS SUBSCRIPTION SCHEDULES AND NAMES OF THE REPORTS

 The below query will gives you the SSRS subscription scheduled information from SQL Server end. DECLARE @ jobName VARCHAR ( 100 ) SET @ jobName = '52B9C43E-748E-40B9-8FC9-A95369E2ED73' SELECT jobs.date_created,JOBS.[NAME],jobschedule.next_run_date, NextRunTime = stuff(stuff( right ( '00000' + cast (jobschedule.next_run_time as varchar ), 6 ), 3 , 0 , ':' ), 6 , 0 , ':' ) ,schedules.[enabled] AS ScheduleEnable from msdb.dbo.sysjobs jobs INNER JOIN msdb.dbo.sysjobschedules jobschedule ON jobs.JOB_ID = jobschedule.JOB_ID inner join msdb.dbo.sysschedules schedules ON schedules.schedule_id = jobschedule.schedule_id WHERE jobs.[name] =@ jobName The below query will tell you about which sql server agent job is running which report and its schedules SELECT distinct sj.[name] AS [Job Name], rs.SubscriptionID, c .[Name] AS [Report Name], c .[Path] FROM msdb..sysjobs AS sj INNER JOIN ReportServer..ReportSchedule AS rs ON sj.[name] = CA...

Backup to URL in Azure

 The scenario is describing about how to take the backup from the SQL Server in Azure Virtual machine and store the backup file of particular database in Azure Container.  SELECT * FROM sys.credentials DROP CREDENTIAL [https: // 123 storages. blob .core.windows.net / 123 container] GO USE master GO CREATE CREDENTIAL [https: // 123 storages. blob .core.windows.net / 123 container] --this link you find in the continaer properties WITH IDENTITY = 'Shared Access Signature' --This shouble alwas shared access signature.Dont change the value /*the below value came from Shared access signature of continer.*/ /*Use Container Shared access signature instead of Storage access signature.*/ ,SECRET = 'sv=2020-02-10&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2021-06-19T18:52:52Z&st=2021-06-19T10:52:52Z&spr=https&sig=Tgt6H8qXTKVroVkEqmHUk2ruP8HFnk%2FsN%2BeHMP18tVQ%3D' ; -- Access key GO BACKUP DATABASE TEST2 TO URL = N 'https://123storages....

The transaction log for database is full due to 'OLDEST_PAGE'

When I see the 'OLDEST_PAGE' in log_reuse_wait_desc column and not allowing to me to shrink the log file of database I followed the below steps 1) When you see 'OLDEST_PAGE' run CHECKPOINT on that particular database 2) Take the Transaction log backup of that particular database 3) Try to shrink the log file of database These steps worked for me when I encountered this issue in my environment.

Copy-DbaLogin,Always On Login Sync Issues

The mentioned command will replicate the SID's of SQL Server login accounts in Always On Availability replicas and automate the process. We have no need to update the logins when the failover occurs. The below command will drop and recreate a the login in secondary replica and the process would be very fast. And particularly it resolve SID mismatch issues between replicas. cls Copy-DbaLogin -Source SourceServerHere -Destination DestinationServerHere -Login Login1,Login2 -force -Verbose The below SQL query will works in normal environment where we are moving logins from one server to another server or source to destination. Need to run this query in master database of source server. And It creates stored procedure called sp_help_revlogin. After creating this procedure in Source server run this and you can see the results. Copy the same results and paste in Destination server and all the logins will get create. https://learn.microsoft.com/en-us/troubleshoot/sql/security/transfer...