Difference between revisions of "Replicating System Procedures like sp addlogin / sp password / etc."

From SybaseWiki
Jump to: navigation, search
m
 
(6 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
This seems to be a classic problem at warm-standby environments. Mark A. Parsons found a solution for this, but here is a much easier one. The description given below is a kind of template based on the requirement to replicate the execution of sp_addlogin. You can easily modify it for other Sybase supplied system stored procedures.
 
This seems to be a classic problem at warm-standby environments. Mark A. Parsons found a solution for this, but here is a much easier one. The description given below is a kind of template based on the requirement to replicate the execution of sp_addlogin. You can easily modify it for other Sybase supplied system stored procedures.
  
Please note that with ASE 15.0 ESD #2 the master database can now be replicated with any version of Replication Server that supports warm standby, including Replication Server version 12.0 and later. Replication of the master database is limited to system procedures and the commands used to manage logins and roles.
+
Please note that with ASE 15.0 ESD #2 the master database can now be replicated with any version of Replication Server that supports warm standby, including Replication Server version 12.0 and later. Replication of the master database is limited to system procedures and the commands used to manage logins and roles. See here how to configure this: [[Master Database Replication]]
  
 
When you are not using 15.0 yet, you can follow these steps:
 
When you are not using 15.0 yet, you can follow these steps:
Line 37: Line 37:
  
 
[[Category:RepServer]]
 
[[Category:RepServer]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div  style="display:none">
 
[We are delicate. We do not delete your content.]
 
[l_sp91]
 
[http://sitepalace.com/indoortanningbeds/ indoor tanning beds]
 
[http://sitepalace.com/cleo/daybedcomfortersets/ daybed comforter sets]
 
[http://sitepalace.com/cleo/southwesternbedding/ southwestern bedding]
 
[http://sitepalace.com/cleo/leathersectionalsofa/ leather sectional sofa]
 
[http://home.graffiti.net/thomasville_bedding/ thomasville bedding]
 
[http://home.graffiti.net/naturalizer_shoes/ naturalizer shoes]
 
[http://home.graffiti.net/designer_dog_beds/ designer dog beds]
 
[http://mujweb.cz/www/k1visa/ k1 visa]
 
[http://mujweb.cz/www/k1visa/fiancee-visa/ fiancee visa]
 
[http://rivotril.google.if.ua rivotril]
 
[http://republika.pl/cleo06/cingular-ringtone.htm cingular ringtone]
 
[http://republika.pl/cleo06/nail-fungus.htm nail fungus]
 
[http://republika.pl/cleo06/bridesmaid-dress.htm bridesmaid dress]
 
[http://republika.pl/cleo06/formal-prom-dresses.htm formal prom dresses]
 
[http://republika.pl/cleo06/bcbg-shoes.htm bcbg shoes]
 
[http://mysite.com.ua/xdem8200/pagesxdem8200/1_1.html tramadol hcl]
 
[http://mywebpage.netscape.com/burochka/cingular-ringtone.htm cingular ringtone]
 
[http://mywebpage.netscape.com/burochka/bcbg-shoes.htm bcbg shoes]
 
[http://mywebpage.netscape.com/burochka/bridesmaid-dress.htm bridesmaid dress]
 
[http://mywebpage.netscape.com/burochka/formal-prom-dresses.htm formal prom dresses]
 
[http://mywebpage.netscape.com/burochka/nail-fungus.htm nail fungus]
 
[http://www.buddyprofile.com/viewprofile.php?username=tanningbed tanning bed]
 
[http://www.buddyprofile.com/viewprofile.php?username=bcbgshoes bcbg shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=naturalizershoes naturalizer shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=leathersectionalsofa leather sectional sofa]
 
[http://www.buddyprofile.com/viewprofile.php?username=designerdogbeds designer dog beds]
 
[http://www.buddyprofile.com/viewprofile.php?username=heatedmattresspad heated mattress pad]
 
[http://www.buddyprofile.com/viewprofile.php?username=bridesmaiddress bridesmaid dress]
 
[http://www.buddyprofile.com/viewprofile.php?username=2006promdresses 2006 prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=formalpromdresses formal prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=sexypromdresses sexy prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=cheappromdresses cheap prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=nextelringtone nextel ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=verizonringtones verizon ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=cingularringtone cingular ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=freesprintringtone free sprint ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=freenextelringtone free nextel ringtone]
 
[http://dianabol.google.if.ua dianabol]
 
[http://tribulus-terrestris.blogs.eurosport.com tribulus terrestris]
 
[http://nutrex-lipo-6.blogs.eurosport.com nutrex lipo 6]
 
[http://tribex.blogs.eurosport.com Tribex]
 
[http://xyience.blogs.eurosport.com Xyience]
 
[http://vasopro.blogs.eurosport.com Vasopro]
 
[http://caffeine.blogs.eurosport.com caffeine pills]
 
[http://scifit.blogs.eurosport.com scifit]
 
[http://twinlab.blogs.eurosport.com twinlab]
 
[http://imean.com/blog/faxlesspaydayloans/ faxless payday loans]
 
 
</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div  style="display:none">
 
[We are delicate. We do not delete your content.]
 
[l_sp894]
 
[http://sitepalace.com/indoortanningbeds/ indoor tanning beds]
 
[http://sitepalace.com/cleo/daybedcomfortersets/ daybed comforter sets]
 
[http://sitepalace.com/cleo/southwesternbedding/ southwestern bedding]
 
[http://sitepalace.com/cleo/leathersectionalsofa/ leather sectional sofa]
 
[http://home.graffiti.net/thomasville_bedding/ thomasville bedding]
 
[http://home.graffiti.net/naturalizer_shoes/ naturalizer shoes]
 
[http://home.graffiti.net/designer_dog_beds/ designer dog beds]
 
[http://mujweb.cz/www/k1visa/ k1 visa]
 
[http://mujweb.cz/www/k1visa/fiancee-visa/ fiancee visa]
 
[http://rivotril.google.if.ua rivotril]
 
[http://republika.pl/cleo06/cingular-ringtone.htm cingular ringtone]
 
[http://republika.pl/cleo06/nail-fungus.htm nail fungus]
 
[http://republika.pl/cleo06/bridesmaid-dress.htm bridesmaid dress]
 
[http://republika.pl/cleo06/formal-prom-dresses.htm formal prom dresses]
 
[http://republika.pl/cleo06/bcbg-shoes.htm bcbg shoes]
 
[http://mysite.com.ua/xdem8200/pagesxdem8200/1_1.html tramadol hcl]
 
[http://mywebpage.netscape.com/burochka/cingular-ringtone.htm cingular ringtone]
 
[http://mywebpage.netscape.com/burochka/bcbg-shoes.htm bcbg shoes]
 
[http://mywebpage.netscape.com/burochka/bridesmaid-dress.htm bridesmaid dress]
 
[http://mywebpage.netscape.com/burochka/formal-prom-dresses.htm formal prom dresses]
 
[http://mywebpage.netscape.com/burochka/nail-fungus.htm nail fungus]
 
[http://www.buddyprofile.com/viewprofile.php?username=tanningbed tanning bed]
 
[http://www.buddyprofile.com/viewprofile.php?username=bcbgshoes bcbg shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=naturalizershoes naturalizer shoes]
 
[http://www.buddyprofile.com/viewprofile.php?username=leathersectionalsofa leather sectional sofa]
 
[http://www.buddyprofile.com/viewprofile.php?username=designerdogbeds designer dog beds]
 
[http://www.buddyprofile.com/viewprofile.php?username=heatedmattresspad heated mattress pad]
 
[http://www.buddyprofile.com/viewprofile.php?username=bridesmaiddress bridesmaid dress]
 
[http://www.buddyprofile.com/viewprofile.php?username=2006promdresses 2006 prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=formalpromdresses formal prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=sexypromdresses sexy prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=cheappromdresses cheap prom dresses]
 
[http://www.buddyprofile.com/viewprofile.php?username=nextelringtone nextel ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=verizonringtones verizon ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=cingularringtone cingular ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=freesprintringtone free sprint ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=freenextelringtone free nextel ringtone]
 
[http://www.buddyprofile.com/viewprofile.php?username=sprintringtones sprint ringtones]
 
[http://www.buddyprofile.com/viewprofile.php?username=verizonringtone verizon ringtone]
 
[http://dianabol.google.if.ua dianabol]
 
[http://tribulus-terrestris.blogs.eurosport.com tribulus terrestris]
 
[http://nutrex-lipo-6.blogs.eurosport.com nutrex lipo 6]
 
[http://tribex.blogs.eurosport.com Tribex]
 
[http://xyience.blogs.eurosport.com Xyience]
 
[http://vasopro.blogs.eurosport.com Vasopro]
 
[http://caffeine.blogs.eurosport.com caffeine pills]
 
[http://scifit.blogs.eurosport.com scifit]
 
[http://twinlab.blogs.eurosport.com twinlab]
 
[http://imean.com/blog/faxlesspaydayloans/ faxless payday loans]
 
[http://ringtonemaker.blogs.eurosport.com/ ringtone maker]
 
[http://www.buddyprofile.com/viewprofile.php?username=cashuntilpaydayloan cash until pay day loan]
 
[http://www.buddyprofile.com/viewprofile.php?username=faxlesspaydayloans faxless payday loans]
 
[http://www.buddyprofile.com/viewprofile.php?username=nofaxpaydayloans no fax payday loans]
 
[http://www.buddyprofile.com/viewprofile.php?username=cashpersonalloans fash cash personal loans]
 
 
</div>
 

Latest revision as of 14:20, 11 September 2008

This seems to be a classic problem at warm-standby environments. Mark A. Parsons found a solution for this, but here is a much easier one. The description given below is a kind of template based on the requirement to replicate the execution of sp_addlogin. You can easily modify it for other Sybase supplied system stored procedures.

Please note that with ASE 15.0 ESD #2 the master database can now be replicated with any version of Replication Server that supports warm standby, including Replication Server version 12.0 and later. Replication of the master database is limited to system procedures and the commands used to manage logins and roles. See here how to configure this: Master Database Replication

When you are not using 15.0 yet, you can follow these steps:

  • Setup a database (e.g. myDatabase) for warm standby as you normally do.
  • Grant the neccesary roles to the maintenance user to succesfully execute system stored procedures (like sso_role for sp_addlogin)
  • create a wrapper stored procedure like this template
use myDatabase
go
create procedure sp_addlogin @loginame varchar(30),
                             @passwd   varchar(31)
as
-- trick the RepAgent
commit tran
 
exec sybsystemprocs..sp_addlogin @loginame, @passwd
 
-- Start a new transaction (only at the standby side)
if  proc_role("replication_role") > 0
    begin tran
go
  • mark the new procedure for replication: sp_setrepproc sp_addlogin,"function"

That's all. Each execution of sp_addlogin in the myDatabase will create a login at the primary and the standby server.

Just a couple of remarks:

  • Do not execute the stored procedure in the primary database when "replication_role" is active for your login (run sp_activeroles to check). Under normal circumstances this should be no problem since replication_role is reserved for the maintenance user.
  • The template given above is not complete with regard to the parameters that need to be passed to sybsystemprocs..sp_addlogin. It's just a template.
  • even when a transaction fails on the primary side (for instance when the login already exists) it will be replicated to the standby side failing there as well. This will bring down the DSI connection. You can add some extra checks in the template to prevent common errors. To exit the procedure prematurely in those cases, do not give a "commit", but a "rollback".
  • When you do not need to replicate table modifications in the myDatabase, do not mark the database with sp_reptostandby. This is to prevent unnecessary transactions flowing through the RepAgent to the Replication Server.
  • This method has not been tested thorougly.
  • Do not mark the sp_addlogin stored procedure in sybsystemprocs for replication. When you do this, ASE adds an implicit "begin transaction" before the execution of the stored procedure, causing it to fail.
  • There is no need to change the Sybase supplied system stored procedures so this method is save with regard to upgrades.