含有replication環境的sqlserver切換到standby

zhouwf0726發表於2019-04-30
含有replication環境的sqlserver切換到standby(自己建立的standby,非sqlserver自帶的logshipping)

On db-core-r1,restore newjoyo2,service2,userinfo2 database with recover,KEEP_REPLICATION

restore master and msdb

RESTORE DATABASE dddddd2 WITH KEEP_REPLICATION, RECOVERY
RESTORE DATABASE eeeeee2 WITH KEEP_REPLICATION, RECOVERY
RESTORE DATABASE ffffff2 WITH KEEP_REPLICATION, RECOVERY

c:Program FilesMicrosoft SQL ServerMSSQLBinn>sqlservr.exe -c -m -f(if necessary)

login db by using sql query analyzer(windows authentication) on the server to restore masterdb

restore database master from disk='f:master_full_XXX' WITH RECOVERY,STATS=5,

MOVE 'master' TO 'D:Microsoft SQL ServerMSSQLDatamaster.mdf',

MOVE 'mastlog' TO 'D:Microsoft SQL ServerMSSQLDatamastlog.ldf'

restore database msdb from disk='f:msdb_full_XXX' with recovery

restart 10.104.14.143 database.

check error log on 10.104.14.134

on master db, modify correct data file location. Then, Start db to check.

select top 50 * from master..sysaltfiles

where name like '%newjoyo2%'

select * from master..sysdatabases where name='newjoyo2'

update master..sysdatabases

set filename='D:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_Data.mdf'

where name='xxxxxx'

--update master..sysaltfiles

set filename='D:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_Data.mdf'

where filename='F:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_Data.mdf'

and name='xxxxxx_Data'

--update master..sysaltfiles

set filename='E:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_data02.mdf'

where filename='G:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_data02.mdf'

and name='xxxxxx_data02'

--update master..sysaltfiles

set filename='F:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_data02.mdf'

where filename='H:Program FilesMicrosoft SQL ServerMSSQLDataxxxxxxxxxxxx_Log.LDF'

and name='xxxxxx_Log'

select top 50 * from master

stop and restart db. And to modify large memory to 16G.

on cluster, to test failover from one node to other.

add standby DB regedit to start replication manually.

open replication on db-dist according to every db setup and enabled all jobs.

diff backup database

Start all JOBs on. If have time,dbcc checkdb ('dbname')

update cluster name from updatedbtemp to updatedb

test updatedb cluster name.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242520/,如需轉載,請註明出處,否則將追究法律責任。

相關文章