Tuesday, March 27, 2012
changing column type
changed from char(30) to varchar(40). What would be the best way and least
dangerous to edit this column and get it to replicate the changes succesfully.
thanks for any advice
Sammy
Sammy,
please check out these articles:
http://www.replicationanswers.com/AddColumn.asp
and
http://www.replicationanswers.com/AlterSchema2005.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
changing column size on publisher side table
If I want to change the column size of a table under replication on the
publisher side, can I do this manually? And then manually change the column
size of the corresponding table on the Subscriber side? Or does this require
the use of Replication SP's? If so, what Replication SPs would I need to use
to change a column size?
Thanks,
Rich
Rich - this largely depends on what version of SQL Server you are using:
http://www.replicationanswers.com/AlterSchema2005.asp
http://www.replicationanswers.com/AddColumn.asp
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Thanks for the reply. I am using Sql Server 2000 Standard Edition, and the
table is under Merge Replication. I wasn't clear on if I could manually
change the size. It looks like I need to use the sp_repladdcolumn and
sp_repldropcolumn to accomplish this. I have, in fact, used these SPs to
add a new column. But I am just checking if I need to use them to change the
size of the column. Yes, No, my choice?
Thanks,
Rich
"Paul Ibison" wrote:
> Rich - this largely depends on what version of SQL Server you are using:
> http://www.replicationanswers.com/AlterSchema2005.asp
> http://www.replicationanswers.com/AddColumn.asp
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
>
>
Changing column length of a replicated table
Can I increase the length of a varchar column of table involved in transactional replication without dropping and recreating publication/subscription?
Any help/short-cuts/undocumented features greatly appreciated.
Regards
Opal
Are you using SQL Server 2005? If so, you can turn on @.replicate_ddl option (set it to 1) for a publication then use regular "ALTER TABLE ... ALTER COLUMN ..." DDL syntax to increase the length of the column, the DDL change will be automatically replicated to subscriber by replication. (@.replication_ddl options is automatically turned on if you use management studio to create the publication)
Hope that helps,
Zhiqiang Feng
|||Thank you Zhiqiang for your reply, but sorry we're using 2000.
Opal
|||Sorry there is no easy workaround in SQL Server 2000. The only alternative is that you can use sp_repldropcolumn then sp_repladdcolumn to drop and re-create the column, but that way you will lose all the data for that column.
Thanks,
Zhiqiang Feng
Sunday, March 25, 2012
Changing Article Properties without a new Snapshot
In our replication environment, the subscriber is initially set up with an snapshot of the publisher database. However, after that, the subscriber and publisher are different and we can never re-initialize from a snapshot again (we purge data on the publisher to reduce the database size but do not purge the same data on the subscriber; we do this by stubbing out the stored procedures on the subscriber that purge data on the publisher).
If an article is added or dropped from the publication, using snapshot and synchronize, just these changes are propagated to the publisher (without an entire new snapshot).
However, if an Article Property is changed (change SCALL to MCALL under Statement Delivery options for the UPDATE statement), the interface REQUIRES an entire new snapshot. Is there any way I can avoid the new Snapshot? It overwrites the subscriber database and this cannot happen!
Linda
Adding/dropping article(s) from an existing publication requires generates a new snapshot in general. This is to make sure the data convergence.
Do you mind sharing the business purpose - 'avoiding the new Snapshot' and 'can not overwrite the subscriber database'?
Thanks.
This posting is provided AS IS with no warranties, and confers no rights.
|||Hi Linda,
Yes, changing CALL format will require a new snapshot.
But there is another way which might do what do you need (although requires more steps and a little intrusive). You can drop the subscription and publication. It will delete the replication, but not the data at subscriber. Then you can create the publication and subscription again. But when you create the subscription, you can choose to initialize subscription without snapshot. BOL has instruction (http://msdn2.microsoft.com/en-us/library/ms151705.aspx) on how to do it. Just follow the instructions under "Initializing a subscription with an alternative method".
Thanks,
Peng
|||Thanks again, Peng. I have used this method in the past (breaking replication and restoring without a snapshot). I will test it for this scenario and let you know the results.
Linda
|||Peng,
This works for changing article properties. Thanks!
Under what conditions will SQL2005 Replication generate an entire new snapshot?
Our configuration will not allow the subscription database to be re-initialized with a snapshot. The snapshot from the publisher will only be used for the initial subscription.
I need to identify all cases when a new snapshot will be created and use the alternative method of breaking replication, make the changes and then re-add the subscription without a snapshot.
Examples:
Adding or dropping a table: the snapshot agent just applies changes from the 1 item I changed without breaking replication.
Dropping a view: I dropped a view and the snapshot agent recreated the entire snaphot. Why?
How can I tell if my changes to replication are going to cause a new snapshot to be generated?
Linda
Tuesday, March 20, 2012
Changing a column type with replication
called meeting_date to a datetime value. My plan is to
create a table that stores a int value
and a datetime value. Copy the primary key (an identity
column) and converted the value to a datetime on the
insert. Disable or alter all objects, especially triggers,
that use the column meeting_date. Then drop the
meeting_date column and add the column as a datetime
value. Wait for replication to make the change. Update
the new datetime column meeting_date with the converted
datetime value joining on the identity column.
Reestablish all objects and update all applications that
use that the meeting_date column.
Will this work with replication ? Is there a better
way ? etc
We are using merge replication and the column has 200,000
values of a 3,900,000 row table.
It is fairly easy to convert meeting_date value itself to
datetime. I am a developer not a DBA so I do not know all
the nuances of replication.
You realize that replication prevents schema changes to tables that are
being replicated. You must drop the publication before you make your
change. Once your change is made, you must re-create the publication and
generate a new snapshot. You stated that this table contains 3.9 million
rows. Are there any other large tables in this publication? What is the
line speed between the publisher and the subscriber(s)? The point that I'm
trying to make here is that the resynchronization could take a very long
time.
How big is the database? Would it be practical to burn it to a CD or DVD
and physically transport it to the subscriber(s)? That might turn out to be
faster than trying to push out a new snapshot.
Also, you might want to investigate using sp_repladdcolumn and
sp_repldropcolumn.
Mike
"Phil396" <anonymous@.discussions.microsoft.com> wrote in message
news:502e01c52328$6d842d10$a601280a@.phx.gbl...
> I need to change a column that is a six character varchar
> called meeting_date to a datetime value. My plan is to
> create a table that stores a int value
> and a datetime value. Copy the primary key (an identity
> column) and converted the value to a datetime on the
> insert. Disable or alter all objects, especially triggers,
> that use the column meeting_date. Then drop the
> meeting_date column and add the column as a datetime
> value. Wait for replication to make the change. Update
> the new datetime column meeting_date with the converted
> datetime value joining on the identity column.
> Reestablish all objects and update all applications that
> use that the meeting_date column.
>
> Will this work with replication ? Is there a better
> way ? etc
> We are using merge replication and the column has 200,000
> values of a 3,900,000 row table.
> It is fairly easy to convert meeting_date value itself to
> datetime. I am a developer not a DBA so I do not know all
> the nuances of replication.
Changing a column type with replication
called meeting_date to a datetime value. My plan is to
create a table that stores a int value
and a datetime value. Copy the primary key (an identity
column) and converted the value to a datetime on the
insert. Disable or alter all objects, especially triggers,
that use the column meeting_date. Then drop the
meeting_date column and add the column as a datetime
value. Wait for replication to make the change. Update
the new datetime column meeting_date with the converted
datetime value joining on the identity column.
Reestablish all objects and update all applications that
use that the meeting_date column.
Will this work with replication ? Is there a better
way ? etc
We are using merge replication and the column has 200,000
values of a 3,900,000 row table.
It is fairly easy to convert meeting_date value itself to
datetime. I am a developer not a DBA so I do not know all
the nuances of replication.You realize that replication prevents schema changes to tables that are
being replicated. You must drop the publication before you make your
change. Once your change is made, you must re-create the publication and
generate a new snapshot. You stated that this table contains 3.9 million
rows. Are there any other large tables in this publication? What is the
line speed between the publisher and the subscriber(s)? The point that I'm
trying to make here is that the resynchronization could take a very long
time.
How big is the database? Would it be practical to burn it to a CD or DVD
and physically transport it to the subscriber(s)? That might turn out to be
faster than trying to push out a new snapshot.
Also, you might want to investigate using sp_repladdcolumn and
sp_repldropcolumn.
Mike
"Phil396" <anonymous@.discussions.microsoft.com> wrote in message
news:502e01c52328$6d842d10$a601280a@.phx.gbl...
> I need to change a column that is a six character varchar
> called meeting_date to a datetime value. My plan is to
> create a table that stores a int value
> and a datetime value. Copy the primary key (an identity
> column) and converted the value to a datetime on the
> insert. Disable or alter all objects, especially triggers,
> that use the column meeting_date. Then drop the
> meeting_date column and add the column as a datetime
> value. Wait for replication to make the change. Update
> the new datetime column meeting_date with the converted
> datetime value joining on the identity column.
> Reestablish all objects and update all applications that
> use that the meeting_date column.
>
> Will this work with replication ? Is there a better
> way ? etc
> We are using merge replication and the column has 200,000
> values of a 3,900,000 row table.
> It is fairly easy to convert meeting_date value itself to
> datetime. I am a developer not a DBA so I do not know all
> the nuances of replication.
Changes to data not replicated
Hi there,
If you have changed the data in such a way as to stop the triggers from firing then these changes wouldn't be replicated.
This is normally associated with a bulk insert of data using something like a bulk insert but it doesn't sound like you are doing that.
To check if the triggers are firing you could check for the existence of the rowguids in MSMerge_Contents for the rows that you have changed.
|||Merge replication uses triggers to track changes. First thing to check is if your updates are causing the triggers to fire and the transactions are commiting after updates. Is there any way for you to profile the updates made by your app? Do you know what DMLs your app uses to make the changes? If you can confirm that the triggers are firing then the next thing to check is if replication is picking up the changes. Are there any errors returned by replication? You can look at the replication log file for detailed errors. Replication log file is sqlmergx.log and its default location is %program files%\microsoft sql server\90\com.
thx
Sudarshan
|||JR-J
Thanks for your resopnse.
I checked the MSmerge_Contents table after making changes to one of my application's tables. There was a row added when I made the changes from within Management Studio, but not when I made a similar change from within my application. So it looks as though my application doesn't cause the triggers to fire. The changes appear in the application's table in both cases.
I'm just using simple INSERT, UPDATE and DELETE statements in stored procedures in my application. No bulk inserts.
|||Sudarshan,
Thanks for your resopnse.
I checked the MSmerge_Contents table after making changes to one of my application's data tables. There was a row added when I made the changes from within Management Studio, but not when I made a similar change from within my application. So it looks as though my application doesn't cause the triggers to fire. The changes appear in the application's table in both cases.
I'm just using simple INSERT, UPDATE and DELETE statements in stored procedures in my application. No bulk inserts.
I checked the log file you mentioned and it did not show any errors during merge. The merge picks up the data that is entered through Management Studio, but does not pick up the data I enter through my application.
Everything in the replication process except for this one problem, seems to be working as expected. We created the publication in Management Studio. I then create the subscription on the client using RMO, and also run the synchronization using RMO. This is my last hurdle in getting my application to work.
Are there any special security considerations you must consider for the triggers to work. I just seems to me that the INSERT statement from my stored procedures should cause the trigger to fire, just as entering data into the table in SQL Management Studio. I'm new to using triggers, so I may not be that good at understanding what they are doing behind the scenes.
|||I am still having the same problem with not being able to sync the data entered through my application. I even created a new publication on a new SQL 2005 Server to ensure that the problem was not with the publication/server/permissions. I reproducibly get the same error mentioned in my original post. As this is the only step left in my development and deployment of this application, I am really stuck until I can solve this problem. Does anyone from Microsoft have and suggestions as to how to troubleshoot this issue. I'll bet that the soultion will be a simple comfiguration setting, or something like that, however, I don't have enough experience to know where to look. We also have several other applications that we hope to use replication on, if we can get this problem solved.
Thanks for any help.
|||Ok so it's pretty clear that the triggers aren't firing for some reason.
Would it be possible for you to use profiler against your database whilst running the app and any of the logs event viewer/sql logs/ merge agent logs?
It might also be worth while ensuring that the triggers are infact in place. If you script out your tables you should see some triggers that look like this attached to the tables that are participating in replication msmerge_ins_<GUID>, msmerge_upd_<GUID>, msmerge_del_<GUID>.
Cheers, James
|||I tried installing profiler on the computer which runs SQL Express 2005, but the install would not allow me to because Express is installed. The triggers are on all of the tables, and they work, as the data I enter directly into the table through Management Studio Express is correctly merged. Its just that for some reason, the triggers either don't fire, or don't operate correctly when I add data to the same tables from my application. The application is a VB.NET application and uses stored procedures which INSERT, UPDATE and DELETE data in the SQL 2005 Express database. All of the stored procedures are working as expected. I'll see if I can attach profiler to my SQL Express database from another server.|||yes sorry I forgot you had run the inserts etc manually.
if you have the normal client tools elsewhere hopefully you'll be able to connect across using profiler. I assume there are no error messages in the logs for your issues.
Cheers, James
|||James,
I was unable to get profiler to connect to my subscriber database.
|||Just a thought.
Do the row GUIDs need to be named RowGUID in each table. My row GUIDs are named according to the subject of the table, but then marked as a row GUID in the column's properties. This must not make a difference, as the triggers seem to work as expected in Management Studio.
Does anyone know if the Table Adapter's in Visual Studio require any special setup to allow the triggers to fire from within the application. I use DataSets/Table Adapters to design my Queries and Data Access Layer.
|||No they don't need to be named rowguid in order for everything to work.
What problems are you experiencing connecting profiler to your subscriber?
Sorry I don't know anything about Table adaptors so I'll have to leave that to someone else.
|||I found the problem.
In Visual Studio you must create a connection string to connect to the databases in your application. One of the advanced features of the connection is a parameter called Replication. It has values of True and False. It was set to True, which seemed logical, since I wanted to do replication of the database. However, True means that the application is recognized as a replication agent. Replication triggers do not fire for replication agents. I set the value to false, and now everything works as expected.
Thanks for your help.
sqlMonday, March 19, 2012
changes across all dbs
1. We can do it manually :(
2. We can use merge replication (needs investigation)
3. We can write our own scripts.
search all instances for a metadata database
if db exists check to see if the change exists (ie. new constraint, new column,cell value)
if it doesn't exist ALTER TABLE
send a mail back to DBA for each change made and where
What do you think is the best way?
-Kevinyou can use 3rd party software from www.red-gate.com
Sunday, March 11, 2012
Changed (or inserted) data not transferring
failures last week and had to restore an old database from before the
failure. Now we have some tables that are replicating correctly but
others aren't (using merge replication). We've made changes to the
data, seen the data get added or updated in msmerge_contents but when
the merge agent runs it shows no data needed to be merged.
For one table I tried sp_addtabletocontents also just to see and it
still had the same issue. We do have some row filtering on some tables
but on others we don't.
I can't say 100% yet, but for the most part it seems to be that data
from the remote server wont' replicate down to us but in some cases it
will replicate our changes up to them.
Any ideas or tips on what else to look at would be greatly appreciated.
Thanks.
Update the problem tables setting a columns' value to itself. See if this
fixes the problem.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Don" <google@.thecoles.org> wrote in message
news:1124223959.170691.79230@.o13g2000cwo.googlegro ups.com...
> We've had replication running for a while. We had some hardware
> failures last week and had to restore an old database from before the
> failure. Now we have some tables that are replicating correctly but
> others aren't (using merge replication). We've made changes to the
> data, seen the data get added or updated in msmerge_contents but when
> the merge agent runs it shows no data needed to be merged.
> For one table I tried sp_addtabletocontents also just to see and it
> still had the same issue. We do have some row filtering on some tables
> but on others we don't.
> I can't say 100% yet, but for the most part it seems to be that data
> from the remote server wont' replicate down to us but in some cases it
> will replicate our changes up to them.
> Any ideas or tips on what else to look at would be greatly appreciated.
> Thanks.
>
|||Actually we tried that earlier to no avail (that's how we did get a
couple of the tables to update but the others still didn't). We're
trying out one program so we can find the data to manually transfer and
will probably end up removing replication and starting over again. But
we're still game to any ideas for now or in the future.
Thanks.
Hilary Cotter wrote:
> Update the problem tables setting a columns' value to itself. See if this
> fixes the problem.
> --
Thursday, March 8, 2012
Change to new subscriber without snapshot?
WAN to a server that has been unstable and will be running out of disk
space soon.
I have a new subscriber set up, and can restore a backup from the old
subscriber, so the data will be the same.
Due to politics (!), I do not have access to the publisher. Can they
script out the replication, and point it to the new server without a
new snapshot coming from the publisher? The group that controls the
publisher estimates it would take 48 hours to push a snapshot across
the WAN.
Thanks in advance.
You can do a nosync initialization. Have a look at this article for more
info:
http://www.replicationanswers.com/No...alizations.asp
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||yes, its called a no-sync subscription. You will have to make sure that the
data is in sync, otherwise your distribution agent may fail frequently. The
group that controls the publisher will have to fix this each time.
You will also have to have them auto generated the replication stored
procedures for you by using sp_enumcustomresolvers 'PublicationName'
Run this in your publication database.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Mr. DOS" <mike@.mrdos.com> wrote in message
news:1116228663.708155.103080@.f14g2000cwb.googlegr oups.com...
> We have a nightly replication of changes to a database going across the
> WAN to a server that has been unstable and will be running out of disk
> space soon.
> I have a new subscriber set up, and can restore a backup from the old
> subscriber, so the data will be the same.
> Due to politics (!), I do not have access to the publisher. Can they
> script out the replication, and point it to the new server without a
> new snapshot coming from the publisher? The group that controls the
> publisher estimates it would take 48 hours to push a snapshot across
> the WAN.
> Thanks in advance.
>
Friday, February 24, 2012
Change SQL Server registration?
following message
"SQL Server replication does not support nicknames, such as "." or
"(local)" as server names.
Delete the SQL Server registration for this server and register it
using the actual server name"
Well, I am not sure how to do that, I can't seem to find any info on
it. Can anyone help out?
Thanks.Gala Grant (gala@.sonic.net) writes:
> I am trying to set up my machine for replication and have recieved the
> following message
> "SQL Server replication does not support nicknames, such as "." or
> "(local)" as server names.
> Delete the SQL Server registration for this server and register it
> using the actual server name"
> Well, I am not sure how to do that, I can't seem to find any info on
> it. Can anyone help out?
In Enterprise Manager, right-click the server and choose Delete SQL
Server Registration. (Delete button may also work.) Then right-click the
group and then choose New SQL Server Registration. This time enter the
actual server name.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
change sql ce merge replication servers
sql databases are all on the same server. We want to move the sql databases
to a new server without any data loss. Does anyone have any good ideas on
how to accomplish this or links to resources about this kind of thing?
Thanks, Scott
I think you will need to create the new publications and then push the new
program doing the pull to the SQL CE devices with the updated publisher
information.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Scott S." <ScottS@.discussions.microsoft.com> wrote in message
news:7100354D-4314-46D2-A937-9D5D1964A0DD@.microsoft.com...
>I have about 115 sql ce databases syncing to about 100 sql databases. The
> sql databases are all on the same server. We want to move the sql
> databases
> to a new server without any data loss. Does anyone have any good ideas on
> how to accomplish this or links to resources about this kind of thing?
> Thanks, Scott
|||Here's what I got working: Stop clients from syncing, create a backup of the
databases to be switched, restore the backup to the new server and create the
publications, the last step is to reinitialize the subscriptions with upload
set to true.
Sunday, February 19, 2012
Change SA password. Any effect to replication?
Dear all,
I have some questions regard subject above. I want to know the impact of replication process after SA pasword been changed.
Example: server1 (hq), server2 (district) & server3 (district).
If server1, SA password been changed, is it server2 & server3 need to change too?
may i know where is it the replication SA password stored? is it replication script refer ID (SA) from Security -> Logins?
I hope someone can help me.. thanks.
changing the Sa password would not harm the replication process
ideally...
replication is using the account used by the sqlserver agent services.
to know what account is your agent services running.
click start>run>type "services.msc">look for sqlserver agent
Click on Log On> this is the account used by replication.
usually this is a domain account..
if your system is configure in this manner, then changing the "Sa" password
will not matter at all.
If it configured some other way around then you have to watch out for the account
being used in the replication
Thursday, February 16, 2012
Change replicationAgent that starts SQLSERVERAGENT
We are using Push subscription in our transactional replication setup in SQL
2K and I noticed that the SQLSERVERAGENT service is started by a local
account called replicationAgent. Is it a problem for me to change it to a
different local account? If it is ok to change it, do I need to change it
also in the subscriber computer and is it necessary that both account name
and password need to be the same?
Wingman
It is ok to change it to an account in the local administrator group, or an
account which has write permission to the default snapshot share.
Make sure that the job owner is sa otherwise it probably will not start.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Wingman" <Wingman@.discussions.microsoft.com> wrote in message
news:67E05E17-2202-477C-BB62-75695B821516@.microsoft.com...
> Hi,
> We are using Push subscription in our transactional replication setup in
> SQL
> 2K and I noticed that the SQLSERVERAGENT service is started by a local
> account called replicationAgent. Is it a problem for me to change it to
> a
> different local account? If it is ok to change it, do I need to change it
> also in the subscriber computer and is it necessary that both account name
> and password need to be the same?
> Wingman
|||Thanks as always.
Wing
"Wingman" wrote:
> Hi,
> We are using Push subscription in our transactional replication setup in SQL
> 2K and I noticed that the SQLSERVERAGENT service is started by a local
> account called replicationAgent. Is it a problem for me to change it to a
> different local account? If it is ok to change it, do I need to change it
> also in the subscriber computer and is it necessary that both account name
> and password need to be the same?
> Wingman
Change publisher server
For disaster recovery procedure i need to establish new replication within 15 minutes on another server with same subscribers.
Can i just confogure another DB as publisher and connect exist subscribers to new publisher ??
ThanX.Yes and no.
Before we begin, a cluster might be a better solution for this case. Either active-active or active-passive will allow you to avoid the down time and the hassle of the move. There is a trade off in terms of the complexity of the cluster, but that still seems like a better choice to me for your situation.
I'd suggest that you check KB #822400 (http://support.microsoft.com/default.aspx?scid=kb;en-us;822400) for more details on Disaster Recovery for SQL Server.
-PatP|||First of all thank you for answering.
Now i have cluster in my environment (Active / Passive ) .I am talking about real disaster - cluster have gone , so i need to move the publisher during minimal time to another location.
Thanx
Change publisher of replication
For disaster recovery procedure i need to establish new replication within 15 minutes on another server with same subscribers.
Can i just confogure another DB as publisher and connect exist subscribers to new publisher ?
ThanX.
This isn't quite so simple. How are you synchronizing with the standby publisher? Are you intending to use 'sync with backup' which ensures the publisher backup is never behind the distributor backup. Will you be restoring earlier copies of the subscriber
to ensure they are not ahead of the distributor? have a look in BOL at "Strategies for Backing Up and Restoring Transactional Replication".
HTH,
Paul Ibison