You can materialize a replicate database from a primary database where user activity cannot be stopped.
It is assumed that activity cannot be stopped at the primary database while the database dump is in progress. This scenario uses the primary database to populate the replicate database and can be used to populate multiple replicate databases with the same primary database dump.
use PRS2_RSSD go rs_helpuser go User Name Permission(s) Name ------------ ------------------------------ PRS2_id_user no grants sa sa PRS2_ra connect source PRS2_rsi connect source PRS2_RSSD_prim source, primary subscr User name Destination DS.DB ------------ ------------------------------------- PRS2_RSSD_maint sunak1505x.PRS2_RSSD pri_maint sunak1505x.pri pri_maint sunak1505x.rep (return status = 0)
In this example, “pri_maint” is the maintenance user for both the connection to the primary database, sunak1505x.pri. and replicate database, sunak1505x.rep.
isql -Usa -P -Ssunak1505x sp_stop_rep_agent pri go The Replication Agent thread for database 'pri' is being stopped. (return status = 0)
isql -Usa -Psa_pass –SPRS2 admin who go Spid Name State Info ---- ---- ---------------- ------------------- 68 DSI EXEC Suspended 105(1) sunak1505x.rep 67 DSI Suspended 105 sunak1505x.rep 66 SQM Awaiting Message 105:0 sunak1505x.rep
resume connection to sunak1505x.rep skip to resync marker go Connection to 'sunak1505x.rep' is resumed.
admin who go Spid Name State Info ---- ---- ---------------- ------------------- 120 DSI EXEC Awaiting Command 105(1) sunak1505x.rep 119 DSI SkipUntil Resync 105 sunak1505x.rep 66 SQM Awaiting Message 105:0 sunak1505x.rep
sp_start_rep_agent pri,'resync' go Replication Agent thread is started for database 'pri'.
admin who go Spid Name State Info ---- ---- ---------------- ------------------- 120 DSI EXEC Awaiting Command 105(1) sunak1505x.rep 119 DSI SkipUntil Dump 105 sunak1505x.rep 66 SQM Awaiting Message 105:0 sunak1505x.rep
DSI for sunak1505x.rep received and processed Resync Database Marker. Waiting for Dump Marker.
dump database pri to 'pri.dmp' go
admin who go Spid Name State Info ---- ---- ---------------- ------------------- 68 DSI EXEC Suspended 105(1) sunak1505x.rep 67 DSI Suspended 105 sunak1505x.rep 66 SQM Awaiting Message 105:0 sunak1505x.rep
DSI for ‘sunak1505x.rep’ received and processed Dump Marker. DSI is now suspended. Resume after database has been reloaded. The DSI thread for database ‘sunak1505x.rep’ is shutdown.
load database rep from '/c11014900/sybase1520x/ASE- 15_0/bin/pri.dmp' go
online database rep go
use rep go sp_adduser pri_maint go New user added. (return status = 0) grant execute on rs_get_lastcommit to pri_maint go grant all on rs_lastcommit to pri_maint go
sp_addlogin <maintenance user>, <maintenance userpassword>, <database> go sp_role "grant", replication_role, <maintenance user> go
alter connection to <dataserver>.<database> set password to <new_password> go
use rep go truncate table rs_lastcommit go
dbcc settrunc (ltm,ignore) go secondary trunc page secondary trunc state dbrepstat -------------------- --------------------- ----- 2668 0 172 generation id database id database name ltl version ------------- ------------ ------------- ------- 0 8 rep 720
resume connection to sunak1505x.rep go Connection to 'sunak1505x.rep' is resumed