Showing posts with label subscription. Show all posts
Showing posts with label subscription. Show all posts

Wednesday, March 7, 2012

Exception while updating NS instance through code

Hi,

I am trying to add subscription classes through code. While updating the instance it throws following exception.

Microsoft.SqlServer.Management.Smo.SmoException: The Notification Services operation performed is invalid. > System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. > Microsoft.SqlServer.NotificationServices.NSException: An attempt to run a Transact-SQL CREATE TABLE statement failed.

I don't know which table is being created on updating this instance. Does it sound to be a permission problem?

SubscriptionClass myClass = new SubscriptionClass(nmoApplication, "Publication0");
myClass.FileGroup = "DEFAULT";

......................................
......................................
......................................

SubscriptionField salesAmountRate = new nmo.SubscriptionField(myClass, "SalesAmountRate ");
salesAmountRate .Type = "tinyint";
salesAmountRate .TypeModifier = "not null";
myClass.SubscriptionFields.Add(salesAmountRate );

.........................................
.........................................
.........................................

myClass.SubscriptionEventRules.Add(eventRule);

myClass.SubscriptionScheduledRules.Add(scheduledRule);

nmoApplication.SubscriptionClasses.Add(myClass);

nmoInstance.Disable();

nmoInstance.Update();

nmoInstance.Enable();

Could be a permissions problem. How are you connecting to the database? What db roles are your user associated with?

Also check to see if the table (or another table named Publication0Old) already exists.

HTH...

Joe

Exception while updating NS instance through code

Hi,

I am trying to add subscription classes through code. While updating the instance it throws following exception.

Microsoft.SqlServer.Management.Smo.SmoException: The Notification Services operation performed is invalid. > System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. > Microsoft.SqlServer.NotificationServices.NSException: An attempt to run a Transact-SQL CREATE TABLE statement failed.

I don't know which table is being created on updating this instance. Does it sound to be a permission problem?

SubscriptionClass myClass = new SubscriptionClass(nmoApplication, "Publication0");
myClass.FileGroup = "DEFAULT";

......................................
......................................
......................................

SubscriptionField salesAmountRate = new nmo.SubscriptionField(myClass, "SalesAmountRate ");
salesAmountRate .Type = "tinyint";
salesAmountRate .TypeModifier = "not null";
myClass.SubscriptionFields.Add(salesAmountRate );

.........................................
.........................................
.........................................

myClass.SubscriptionEventRules.Add(eventRule);

myClass.SubscriptionScheduledRules.Add(scheduledRule);

nmoApplication.SubscriptionClasses.Add(myClass);

nmoInstance.Disable();

nmoInstance.Update();

nmoInstance.Enable();

Could be a permissions problem. How are you connecting to the database? What db roles are your user associated with?

Also check to see if the table (or another table named Publication0Old) already exists.

HTH...

Joe

Exception of type Microsoft.ReportingServices.ReportProcessing.bk

Hi,
I am receiving the following error for a new data driven subscription I have
setup.
Exception of type Microsoft.ReportingServices.ReportProcessing.bk
I have searched this newsgroup and google and can't seem to find any
description of the error. The RS logs also yield very little other than the
exception itself.
When running the subscription with a "Run Once" schedule it doesn't seem to
throw the error; if I schedule the report to run on a daily schedule it does
throw the error.
Any help is greatly appreciated. If more details are needed please let me
know.
Thanks,
Nickwhat's the delivery mechanism?
make sure the account with which RS runs for unattended execution has
permissions to access the data store being used by your subscription. The
default account for RS from the setup is the Network Service account in
Win2003 Server.
Is this RS 2000 or 2005?
--
Regards,
Thiago Silva
"Nick @. INDATA" wrote:
> Hi,
> I am receiving the following error for a new data driven subscription I have
> setup.
> Exception of type Microsoft.ReportingServices.ReportProcessing.bk
> I have searched this newsgroup and google and can't seem to find any
> description of the error. The RS logs also yield very little other than the
> exception itself.
> When running the subscription with a "Run Once" schedule it doesn't seem to
> throw the error; if I schedule the report to run on a daily schedule it does
> throw the error.
> Any help is greatly appreciated. If more details are needed please let me
> know.
> Thanks,
> Nick|||This is SQL RS 2000, I will double check the permissions for the unattended
execution account. I also have a case open with MSFT on this right now, will
share anything I find out from them here.
"HC" wrote:
> what's the delivery mechanism?
> make sure the account with which RS runs for unattended execution has
> permissions to access the data store being used by your subscription. The
> default account for RS from the setup is the Network Service account in
> Win2003 Server.
> Is this RS 2000 or 2005?
> --
> Regards,
> Thiago Silva
> "Nick @. INDATA" wrote:
> > Hi,
> >
> > I am receiving the following error for a new data driven subscription I have
> > setup.
> >
> > Exception of type Microsoft.ReportingServices.ReportProcessing.bk
> >
> > I have searched this newsgroup and google and can't seem to find any
> > description of the error. The RS logs also yield very little other than the
> > exception itself.
> >
> > When running the subscription with a "Run Once" schedule it doesn't seem to
> > throw the error; if I schedule the report to run on a daily schedule it does
> > throw the error.
> >
> > Any help is greatly appreciated. If more details are needed please let me
> > know.
> >
> > Thanks,
> >
> > Nick|||FileShare Delivery Extension
"HC" wrote:
> what's the delivery mechanism?
> make sure the account with which RS runs for unattended execution has
> permissions to access the data store being used by your subscription. The
> default account for RS from the setup is the Network Service account in
> Win2003 Server.
> Is this RS 2000 or 2005?
> --
> Regards,
> Thiago Silva
> "Nick @. INDATA" wrote:
> > Hi,
> >
> > I am receiving the following error for a new data driven subscription I have
> > setup.
> >
> > Exception of type Microsoft.ReportingServices.ReportProcessing.bk
> >
> > I have searched this newsgroup and google and can't seem to find any
> > description of the error. The RS logs also yield very little other than the
> > exception itself.
> >
> > When running the subscription with a "Run Once" schedule it doesn't seem to
> > throw the error; if I schedule the report to run on a daily schedule it does
> > throw the error.
> >
> > Any help is greatly appreciated. If more details are needed please let me
> > know.
> >
> > Thanks,
> >
> > Nick|||Hey, Nick
Did you ever get a resolution for this issue?
I am not quite sure what the error means, since I've never seen an
exception type "ReportProcessing.bk."
Can you look at your RS logs to get more information on the issue. The
RS log is located in "C:\Program Files\Microsoft SQL
Server\MSSQL.x\Reporting Services\LogFiles".
Take a look at the log file for the time when you encountered the
issue. Try recreating the problem first, so you can have a fresh
logged entry, then look it up on the log.
Also, take a peek at the event log on the server, for anything
suspicious.
If you can post the message from the log, that may help in
troubleshooting that issue.
regards,
Thiago Silva

Exception in EnumMergeDynamicSnapshotJobs

Hi,

I'm manually creating dynamic snapshots for a push merge subscription, however I often get an exception thrown when I call EnumMergeDynamicSnapshotJobs. The exception says:

Unable to cast object of type 'System.Byte' to type 'System.String'.

The stack trace is:

at System.Data.SqlClient.SqlBuffer.get_String()

at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)

at Microsoft.SqlServer.Replication.ReplicationObject.SafeGetString(SqlDataReader lclReader, Int32 nColumn, Int32 nLength)

at Microsoft.SqlServer.Replication.MergePublication.EnumMergeDynamicSnapshotJobs()

at ART.AlphaRMS.DatabaseManagementLibrary.SMOCommands.CreateDynamicSnapshot(MergePublication publication, MergeSubscription subscription, String dynamicSnapshotLocation) in ...

Has anyone seen this exception here before?

Thanks for your help

Graham

Can you post how you are creating the dynamic snapshots.

Using the UI to create a partition and the job and then enumerating the job using EnumMergeDynamicSnapshotJobs() does not show me any problems. Please post your code snippet.

|||

Hi Mahesh, I create the snapshot in code (RMO). I do not see this error every time though, it is one of those intermitant problems!

public string CreateDynamicSnapshot(MergePublication publication, MergeSubscription subscription, string dynamicSnapshotLocation)

{

string snapshotLocation = string.Empty;

try

{

// Pre-generate the dynamic snapshot as it may be that we

// want to ship it off to a remote server.

if (!string.IsNullOrEmpty(dynamicSnapshotLocation))

{

string publicationName = publication.Name;

string publicationDbName = publication.DatabaseName;

string publisherName = publication.SqlServerName;

string distributorName = publication.SqlServerName;

// Set a weekly schedule for the filtered data snapshot.

ReplicationAgentSchedule schedule = new ReplicationAgentSchedule();

schedule.FrequencyType = ScheduleFrequencyType.Weekly;

schedule.FrequencyRecurrenceFactor = 1;

schedule.FrequencyInterval = Convert.ToInt32(0x001);

// Set the value of Hostname that defines the data partition.

MergePartition partition = new MergePartition();

partition.DynamicFilterHostName = subscription.HostName;

MergeDynamicSnapshotJob snapshotAgentJob = new MergeDynamicSnapshotJob();

snapshotAgentJob.DynamicFilterHostName = subscription.HostName;

// Before creating the new job, make sure any old instances are deleted.

foreach (MergeDynamicSnapshotJob agentJob in publication.EnumMergeDynamicSnapshotJobs())

{

if (string.Compare(agentJob.DynamicFilterHostName, snapshotAgentJob.DynamicFilterHostName, true) == 0)

{

logger.Debug("Found existing dynamic snapshot job, deleting it.");

publication.RemoveMergeDynamicSnapshotJob(agentJob.Name);

}

}

logger.Debug("Creating new dynamic snapshot job for partition " + partition.DynamicFilterHostName);

// Create the partition for the publication with the defined schedule.

publication.AddMergePartition(partition);

publication.AddMergeDynamicSnapshotJob(snapshotAgentJob, schedule);

snapshotLocation = StartDynamicSnapshotJob(publication, subscription, snapshotLocation);

}

}

catch (Exception ex)

{

logger.Error("Failed to create the new dynamic snapshot.", ex);

throw;

}

return snapshotLocation;

}