Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Wednesday, March 28, 2012

Replication Error

Hi all,

I have encountered an error during replication. The following is my code;


Try

m_SQlEngine = New SqlServerCe.SqlCeEngine("Data Source =\Project_JobLogger.sdf")

m_SQlEngine.CreateDatabase()

Dim SqlCeConnection As New SqlServerCe.SqlCeConnection("Data Source =\Project_JobLogger.sdf")

m_SQLConnection.Open()

Dim Repl As SqlServerCe.SqlCeReplication

Repl = New SqlServerCe.SqlCeReplication

Repl.InternetUrl = http://Ganges/PJLogger/sqlcesa30.dll

Repl.Publisher = "Ganges"

Repl.PublisherDatabase = "Project_JobLogger"

Repl.Publication = "PJLPublisher"

Repl.Subscriber = System.Net.Dns.GetHostName

Repl.SubscriberConnectionString = m_SQLConnection.ConnectionString

Repl.HostName = System.Net.Dns.GetHostName

Repl.ExchangeType = ExchangeType.BiDirectional

Repl.Synchronize()

Catch ex As Exception

MessageBox.Show(ex.ToString())

m_SQLConnection.Close()

m_SQLConnection.Dispose()

End Try


The error just displays - System.Data.SqlServerCe.SqlCeException;SqlCeException

Can anyone state what is the problem please?

Thanks

Matt

Matt,

There is a lot more information hiding inside the SqlCeException that is being thrown that you'll need to troubleshoot this situation. Here is some code to unwrap the exception and get specifics.

Public Sub DisplaySQLCEErrors(ByVal ex As SqlCeException)

Dim errorCollection As SqlCeErrorCollection = ex.Errors
Dim bld As New StringBuilder()
Dim inner As Exception = ex.InnerException
Dim err As SqlCeError

For Each err In errorCollection

bld.Append(ControlChars.Lf + " Error Code: " + err.HResult.ToString())
bld.Append(ControlChars.Lf + " Message : " + err.Message)
bld.Append(ControlChars.Lf + " Minor Err.: " + err.NativeError.ToString())
bld.Append(ControlChars.Lf + " Source : " + err.Source)

Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If (numPar <> 0) Then
bld.Append(ControlChars.Lf + " Num. Par. : " + numPar.ToString())
End If
Next numPar
Dim errPar As String
For Each errPar In err.ErrorParameters
If (errPar <> String.Empty) Then
bld.Append(ControlChars.Lf + " Err. Par. : " + errPar)
End If
Next errPar

MessageBox.Show(bld.ToString(), "SQL Mobile Error")

Next err

End Sub

-Darren

|||

Thanks a lot Darren, I found your piece of code very useful. It managed to specify the exact error

Thanks Again ,

Matt

Monday, March 26, 2012

Replication does detect Mirrored Source Fail Over

I'm trying setup a proof of concept for a client but I’m having issues with mirroring and replication.

With the help of http://technet.microsoft.com/en-us/library/ms151799.aspx I’ve done the following..

The setup is as follows, I have several instances of SQL Server

A+B are mirrored with each other, with A being the principle and B the mirror

C is the distributor

E is subscribes to A, with parameters for PublicationFailoverPartner set to B

The mirroring between A+B works fine, I can manually fail each and the databases keep in step.

Without testing the mirroring failover, the replication between A+C+E also works.

However when I test the mirror to failover between A+B no transactions are replicated though to E. The publication moves from A to B in the Server Management Studio.

The logs state that the log reader agent can not gain access to A, however nothing is recorded regarding any attempts to contact B. In the replication monitor the error message

"The concurrent snapshot for publication ABCXYZ is not available because it has not been fully generated of the Log Reader Agent is not running to activate it. If generation of the concurrent snapshot was interrupted, the Spapshot Agent for the publica..." (cut off).

"the process could not execute 'sp_replcmds' on 'A'

I have checked that the SQL Server Agents are running on all agents,

I have checked that that server B is set at the PublisherFailoverPartner on server C agent configuration, I'm now at a lost as to what is wrong,

Any help or suggestions are greatly appreciated.

Pls do not duplicate

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1958649&SiteID=1

|||

Sorry about this Deepak, I had duplicated this as I though I had lost my original post, it was just in anothor forum,

appologies for being a Topic Hog

Friday, March 23, 2012

Replication between two servers without db_owner

Hello there
I have destination database which i'm not db_owner on it but guest
The user i'm using to access between two servers is:
1. Source is connected by linked server to destination
2. on the destination none of the servers roles are active for the user i'm
trying to access
3. the user has only access to one of my databases whith permittion of:
db_public, db_ddladmin
, db_datareader, db_datawriter
What else i need to use replication between two sides?
You'll need rights to create tables. There are two system tables which are
necessary and you should be able to precreate these using an account in the
ddl_admin role.
This is a push subscription right? What version of SQL Server is running on
the publisher and subscriber?
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
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:uu6vAScGGHA.3864@.tk2msftngp13.phx.gbl...
> Hello there
> I have destination database which i'm not db_owner on it but guest
> The user i'm using to access between two servers is:
> 1. Source is connected by linked server to destination
> 2. on the destination none of the servers roles are active for the user
> i'm trying to access
> 3. the user has only access to one of my databases whith permittion of:
> db_public, db_ddladmin
> , db_datareader, db_datawriter
> What else i need to use replication between two sides?
>
|||Thankes Hilary.
Now the replication succedded on the other side. In fact it gave me db_owner
to do that.
The problem now is that it create new tables what replicated with the
username owner that i used to access the subscriber, instead of entering the
data to my existing databses with dbo owners.
How can i cause the subscriber to transfare data to the original tables with
dbo owners?
' 03-5611606
' 050-7709399
: roy@.atidsm.co.il
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:e$6nsyfGGHA.1180@.TK2MSFTNGP09.phx.gbl...
> You'll need rights to create tables. There are two system tables which are
> necessary and you should be able to precreate these using an account in
> the ddl_admin role.
> This is a push subscription right? What version of SQL Server is running
> on the publisher and subscriber?
> --
> 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
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:uu6vAScGGHA.3864@.tk2msftngp13.phx.gbl...
>
|||Right click on your publication and select properties, click on the articles
tab, and select the browse button to the right of each table, in the general
tab, specify destination table owner name to be dbo.
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
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23xLlJkCHGHA.1032@.TK2MSFTNGP11.phx.gbl...
> Thankes Hilary.
> Now the replication succedded on the other side. In fact it gave me
> db_owner to do that.
> The problem now is that it create new tables what replicated with the
> username owner that i used to access the subscriber, instead of entering
> the data to my existing databses with dbo owners.
> How can i cause the subscriber to transfare data to the original tables
> with dbo owners?
> --
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:e$6nsyfGGHA.1180@.TK2MSFTNGP09.phx.gbl...
>
|||Thankes A lot hilary
' 03-5611606
' 050-7709399
: roy@.atidsm.co.il
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:u6j6N8EHGHA.2300@.TK2MSFTNGP15.phx.gbl...
> Right click on your publication and select properties, click on the
> articles tab, and select the browse button to the right of each table, in
> the general tab, specify destination table owner name to be dbo.
> --
> 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
> "Roy Goldhammer" <roy@.hotmail.com> wrote in message
> news:%23xLlJkCHGHA.1032@.TK2MSFTNGP11.phx.gbl...
>