Professional Documents
Culture Documents
Reindexing and Update Stats
Reindexing and Update Stats
================
select
select
from sys.indexes i
join sys.objects o
on f.objectid = o.object_id
ORDER BY i.object_id,i.index_id
drop table #allindexes
For update stats: Once we execute below script will get all tables update stats
script and then need to execute one by one.
===================
SOP
** To check current restoring mode run below query-- if value of restore mode is 1
then it is in standby mode, If 0 it is in restoring mode.
SELECT
secondary_database,
restore_mode,
disconnect_users,
last_restored_file
FROM msdb.dbo.log_shipping_secondary_databases
EXEC sp_change_log_shipping_secondary_database
@secondary_database = 'Collection',
@restore_mode = 1,
@disconnect_users = 1
6. Run the query to make live DB in standby mode. (Need to change DB name & Backup
Path) -- Path- SQLDBA\AWS\Scripts\Switch over script
8.Check run copy and restore job on secondary db. Disable copy and restore job
------------------------------
7. Generate tail backup on primary ( Check trn file - It should be greater) >> if
it is not greater, then the query again
8.