Showing posts with label specifically. Show all posts
Showing posts with label specifically. Show all posts

Wednesday, March 21, 2012

Monitoring Transactional Replication (with pull subscribers) ! he

Have a look at the Replication Alerts for some of this -
specifically the Replication: agent failure alert.
To help troubleshoot errors, the replication history
tables (MSsnapshot_history, MSlogreader_history etc) are
used, either directly or through the GUI. Also, setting
the agents to log history to a text file can be extremely
useful and give a more granular type of error handling
capability (see http://support.microsoft.com/?id=312292).
To backup the log just do a normal backup. The log won't
be truncated of this work until the transaction has
finished and the log-reader has read the whole
transaction.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
also have a look at the msrepl_errors table in the distribution database.
Errors are logged here.
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:3ce301c4e287$c466a4a0$a301280a@.phx.gbl...
> Have a look at the Replication Alerts for some of this -
> specifically the Replication: agent failure alert.
> To help troubleshoot errors, the replication history
> tables (MSsnapshot_history, MSlogreader_history etc) are
> used, either directly or through the GUI. Also, setting
> the agents to log history to a text file can be extremely
> useful and give a more granular type of error handling
> capability (see http://support.microsoft.com/?id=312292).
> To backup the log just do a normal backup. The log won't
> be truncated of this work until the transaction has
> finished and the log-reader has read the whole
> transaction.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>

Wednesday, March 7, 2012

Monitor Jobs on SQL Server

Hi,

I'd like to know if I can monitor all the jobs in SQL Server 2000 or 2005 using SMO Objects. Specifically, I'd like to know if the jobs has been run, executed suceefully or not (recording to Log files). I also like to view/enumerate all the existing jobs. I'd like to know if all these are possible if I use SMO Object with Visual Basic.net.. If possible please give me sample code or web site so I can learn how to do it. Thanks for reading my post.

The method you'll want to look at is the EnumJobHistory method of the JobServer object. This method returns a DataTable, which you can bind to a DataGrid and see the results. You'll need to import Microsoft.SqlServer.Management.SMO.Agent as well as the .SMO and .Common namespaces.

Dim tblServerJobHist As DataTable

' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True

tblServerJobHist = srvMgmtServer.JobServer.EnumJobHistory

Hope that helps you get started.

|||

Thanks for reply my post. Furthermore, can i monitor the jobs that has been run successfully or not by using SMO object? for example, i like to have the SMO object to tell me if the jobs has run successfully or failed after a certain period.

Thanks.

|||You don't need SMO to notify you if a job has failed, because you can set up the job to send you notifications if that's what you need.|||Hi folks

Now I have SQL Server 2000 & Visual Studio 2003

How can i Import this NameSpace "Microsoft.SqlServer.Management.SMO.Agent as well as the .SMO and .Common namespaces." which Reference i want to add this?

If its Not possible than How can i run this program in VB.NET 2003 or VB6.0 Please Help me... Its Very Urgent for me......


|||You can't use SMO with Visual Studio 2003, it is only available using Visual Studio 2005 or later. The SMO namespaces are only available in Visual Studio 2005.

Monitor Jobs on SQL Server

Hi,

I'd like to know if I can monitor all the jobs in SQL Server 2000 or 2005 using SMO Objects. Specifically, I'd like to know if the jobs has been run, executed suceefully or not (recording to Log files). I also like to view/enumerate all the existing jobs. I'd like to know if all these are possible if I use SMO Object with Visual Basic.net.. If possible please give me sample code or web site so I can learn how to do it. Thanks for reading my post.

The method you'll want to look at is the EnumJobHistory method of the JobServer object. This method returns a DataTable, which you can bind to a DataGrid and see the results. You'll need to import Microsoft.SqlServer.Management.SMO.Agent as well as the .SMO and .Common namespaces.

Dim tblServerJobHist As DataTable

' Connect to the server
Dim srvMgmtServer As Server
srvMgmtServer = New Server("MyServer")
Dim srvConn As ServerConnection
srvConn = srvMgmtServer.ConnectionContext
srvConn.LoginSecure = True

tblServerJobHist = srvMgmtServer.JobServer.EnumJobHistory

Hope that helps you get started.

|||

Thanks for reply my post. Furthermore, can i monitor the jobs that has been run successfully or not by using SMO object? for example, i like to have the SMO object to tell me if the jobs has run successfully or failed after a certain period.

Thanks.

|||You don't need SMO to notify you if a job has failed, because you can set up the job to send you notifications if that's what you need.|||Hi folks

Now I have SQL Server 2000 & Visual Studio 2003

How can i Import this NameSpace "Microsoft.SqlServer.Management.SMO.Agent as well as the .SMO and .Common namespaces." which Reference i want to add this?

If its Not possible than How can i run this program in VB.NET 2003 or VB6.0 Please Help me... Its Very Urgent for me......


|||You can't use SMO with Visual Studio 2003, it is only available using Visual Studio 2005 or later. The SMO namespaces are only available in Visual Studio 2005.

Saturday, February 25, 2012

Money, SQL Server and C#

Argggg...

Please help.

I need to store money in SQL Server.
I am using C# and a stored procedure to insert.

How do you accomplish this? Specifically what datatype should the money variable be in C# during the insert? It's initial value is a string as it is entered from a text field.

I have been trying for over an hour now to simply insert money into SQL Server using C# and have it stored as a money type!

Thanks

Try using decimal. hth

|||

I did get it working using decimal.. thanks!

Decimal rate = Convert.ToDecimal(txtRate.Text);

Stored procedure looks like this.

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER PROCEDURE sp_UpdateHorsepowerRate

@.HorsePower int,
@.Rate money,
@.UserId uniqueidentifier,
@.EmployerId int

AS

INSERT INTO EmployerHorsePower (HorsePower, Rate, UserId, EmployerId) VALUES (@.HorsePower, @.Rate, @.UserId, @.EmployerId)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Rob

|||

I would recommend that you not begin your stored procedures with "sp" (refer to:http://www.sql-server-performance.com/rd_optimizing_sp_recompiles.asp).

Also, when setting up the SqlParameter be sure that you consider the precision and scale. For themoney datatype, it would be precision=19, scale = 4.