Friday, 19 January 2018

File Movement in DR setup



on standby

declare @databaseName varchar(300)
set @databaseName = 'net_contentV3' -- Secondary Database Name
-- 0 = Restore log with NORECOVERY.
-- 1 = Restore log with STANDBY.
select secondary_database,
case restore_mode
when 0 then 'No Recovery'
when 1 then 'Stand by' end AS 'restore_mode'
from msdb.dbo.log_shipping_secondary_databases
where secondary_database = @databaseName


 declare @databaseName varchar(300)
set @databaseName = 'Xnet_content_1_V3' -- Secondary Database Name
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(@databaseName);

go to primary

select the the database and right click --then transaction log --change to no recovery.

then open job monitor and disable the copy job and start the copyjob in production.


come to dr .. start the copy and restore job

ALTER DATABASE Xnet_content
MODIFY FILE ( NAME = wss_prod_contentdata3, FILENAME = 'L:\SQL01\MSSQL11.SQLX\MSSQL\DATA\wss_prod_content_1_V3_4.ndf' );


bring the db down.

copy the file physically and delete the old one.

bring up the db.


go to primary and enable the log shipping --change to standby.


start the copy

start the restore

check it is sync

No comments:

Post a Comment

Featured post

duplicate db from standy to other server

 Duplicate Testuat   $ export ORACLE_SID=Testuat3 $ sqlplus '/as sysdba' Testuat3 SQL> alter system set cluster_database=FALSE sc...