Friday, March 30, 2012
profiler
thought it would stop once I closed the profiler. WRONG!!!
How can I stop this?
You can use the following TSQL statement to identify the TraceID of any
Traces that are currently running:
SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
You can then stop any running traces by setting the status of the TraceID to
stopped (0).
ie.
EXEC sp_trace_setstatus @.traceid = 1,
@.status = 0
HTH
- Peter Ward
WARDY IT Solutions
"Andre Gibson" wrote:
> I stsrted a trace on one of my bds and it is creating mulitple 5 mb files. I
> thought it would stop once I closed the profiler. WRONG!!!
> How can I stop this?
|||thanks so much Peter,
I will try that
"P. Ward" wrote:
[vbcol=seagreen]
> You can use the following TSQL statement to identify the TraceID of any
> Traces that are currently running:
> SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
> You can then stop any running traces by setting the status of the TraceID to
> stopped (0).
> ie.
> EXEC sp_trace_setstatus @.traceid = 1,
> @.status = 0
> HTH
>
> - Peter Ward
> WARDY IT Solutions
>
> "Andre Gibson" wrote:
Wednesday, March 28, 2012
profiler
thought it would stop once I closed the profiler. WRONG!!!
How can I stop this?You can use the following TSQL statement to identify the TraceID of any
Traces that are currently running:
SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
You can then stop any running traces by setting the status of the TraceID to
stopped (0).
ie.
EXEC sp_trace_setstatus @.traceid = 1,
@.status = 0
HTH
- Peter Ward
WARDY IT Solutions
"Andre Gibson" wrote:
> I stsrted a trace on one of my bds and it is creating mulitple 5 mb files. I
> thought it would stop once I closed the profiler. WRONG!!!
> How can I stop this?|||thanks so much Peter,
I will try that
"P. Ward" wrote:
> You can use the following TSQL statement to identify the TraceID of any
> Traces that are currently running:
> SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
> You can then stop any running traces by setting the status of the TraceID to
> stopped (0).
> ie.
> EXEC sp_trace_setstatus @.traceid = 1,
> @.status = 0
> HTH
>
> - Peter Ward
> WARDY IT Solutions
>
> "Andre Gibson" wrote:
> > I stsrted a trace on one of my bds and it is creating mulitple 5 mb files. I
> > thought it would stop once I closed the profiler. WRONG!!!
> >
> > How can I stop this?
profiler
thought it would stop once I closed the profiler. WRONG!!!
How can I stop this?You can use the following TSQL statement to identify the TraceID of any
Traces that are currently running:
SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
You can then stop any running traces by setting the status of the TraceID to
stopped (0).
ie.
EXEC sp_trace_setstatus @.traceid = 1,
@.status = 0
HTH
- Peter Ward
WARDY IT Solutions
"Andre Gibson" wrote:
> I stsrted a trace on one of my bds and it is creating mulitple 5 mb files.
I
> thought it would stop once I closed the profiler. WRONG!!!
> How can I stop this?|||thanks so much Peter,
I will try that
"P. Ward" wrote:
[vbcol=seagreen]
> You can use the following TSQL statement to identify the TraceID of any
> Traces that are currently running:
> SELECT DISTINCT traceid FROM :: fn_trace_getinfo(default)
> You can then stop any running traces by setting the status of the TraceID
to
> stopped (0).
> ie.
> EXEC sp_trace_setstatus @.traceid = 1,
> @.status = 0
> HTH
>
> - Peter Ward
> WARDY IT Solutions
>
> "Andre Gibson" wrote:
>
profiler
I
thought it would stop once I closed the profiler. WRONG!!!
How can I stop this?Is there some service I can restart that will end this without me having to
restart the server.
"Andre Gibson" wrote:
> I stsrted a trace on one of my db's and it is creating mulitple 5 mb files
. I
> thought it would stop once I closed the profiler. WRONG!!!
> How can I stop this?
>|||Did you select the "server side trace" checkbox? If so, you have a server si
de trace running, which
is disconnected from the Profiler GUI. It will stop if you restart the SQL S
erver. Or you can stop
it explicitly. First find out the ID of the trace using fn_trace_getinfo. Th
en stop and close the
trace using sp_trace_setstatus. You need to first stop (0) and then close (2
).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Andre Gibson" <AndreGibson@.discussions.microsoft.com> wrote in message
news:19BEFA5A-5395-4611-BE1C-B9D81315A781@.microsoft.com...
>I stsrted a trace on one of my db's and it is creating mulitple 5 mb files.
I
> thought it would stop once I closed the profiler. WRONG!!!
> How can I stop this?
>|||thanks Tibor
"Tibor Karaszi" wrote:
> Did you select the "server side trace" checkbox? If so, you have a server
side trace running, which
> is disconnected from the Profiler GUI. It will stop if you restart the SQL
Server. Or you can stop
> it explicitly. First find out the ID of the trace using fn_trace_getinfo.
Then stop and close the
> trace using sp_trace_setstatus. You need to first stop (0) and then close
(2).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Andre Gibson" <AndreGibson@.discussions.microsoft.com> wrote in message
> news:19BEFA5A-5395-4611-BE1C-B9D81315A781@.microsoft.com...
>
Profile value + Sql Value, a login problem
I'm creating a Profile to store login and password. That part is working... I can call the values (and display them) using this code <%= Profile.login %> and <%=Profile.password %
Now I want to create a Grid View that will connect to the SQL db, see if the login and password value stored in the Profile match that of ones in the SQL db.
So if the profile is login: bob password: dog, the grid view will output all application ID numbers associated with the bob and dog. Here is the SQL code...trying to use the <%=Profile.login %> as a filter on the login and password doesn't seem to work...
Can anyone tell me what I'm doing wrong? How can I reference a value in the Profile within an SQL statement?
SELECT ApplicationStatus.Description, Customer.CustomerName, Application.ApplicationDate
FROM Application INNER JOIN
ApplicationStatus ON Application.ApplicationStatusID = ApplicationStatus.ApplicationStatusID INNER JOIN
Customer ON Application.ApplicationID = Customer.ApplicationID INNER JOIN
[User] ON Application.DealerId = [User].UserId
WHERE ([User].LoginId = '<%= Profile.login %>') AND ([User].LoginPwd = '<%= Profile.password %>') AND (ApplicationStatus.Description = 'Pending')
Try getting the value into a variable and use the variable in the SQL.
SELECT ApplicationStatus.Description, Customer.CustomerName, Application.ApplicationDate
FROM Application INNER JOIN
ApplicationStatus ON Application.ApplicationStatusID = ApplicationStatus.ApplicationStatusID INNER JOIN
Customer ON Application.ApplicationID = Customer.ApplicationID INNER JOIN
[User] ON Application.DealerId = [User].UserId
WHERE ([User].LoginId = @.login) AND ([User].LoginPwd = @.pwd) AND (ApplicationStatus.Description = 'Pending')
Then add the parameters to the command object and set their values appropriately.
|||I agree with ndinakar.Monday, March 26, 2012
Product for Creating Data Dictionary
field names. Is there a product that will create a Word document in table
format from the actual database that can be used to add documentation about
the meaning of each field?
Will
Will
SQL Server 2000 has an option called column description
create table dbo.customer (
customer_id integer not null identity (1, 1)
, trade_name varchar (0255) not null
)
go
alter table dbo.customer add
constraint pk_customer primary key nonclustered (customer_id)
go
/* column description meta info */
execute sp_addextendedproperty N'boolean_property_01', '1', N'user', N'dbo',
N'table', N'customer', N'column', N'trade_name'
execute sp_addextendedproperty N'column_description', 'Customer trading
name', N'user', N'dbo', N'table', N'customer', N'column', N'trade_name'
go
select * from :: fn_listextendedproperty (NULL, 'user', 'dbo', 'table',
'customer', 'column', default)
go
drop table dbo.customer
go
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:OOrsHkGUFHA.3636@.TK2MSFTNGP14.phx.gbl...
> We have a large SQL Server database that has poorly documented tables and
> field names. Is there a product that will create a Word document in
table
> format from the actual database that can be used to add documentation
about
> the meaning of each field?
> --
> Will
>
>
Product for Creating Data Dictionary
field names. Is there a product that will create a Word document in table
format from the actual database that can be used to add documentation about
the meaning of each field?
--
WillWill
SQL Server 2000 has an option called column description
create table dbo.customer (
customer_id integer not null identity (1, 1)
, trade_name varchar (0255) not null
)
go
alter table dbo.customer add
constraint pk_customer primary key nonclustered (customer_id)
go
/* column description meta info */
execute sp_addextendedproperty N'boolean_property_01', '1', N'user', N'dbo',
N'table', N'customer', N'column', N'trade_name'
execute sp_addextendedproperty N'column_description', 'Customer trading
name', N'user', N'dbo', N'table', N'customer', N'column', N'trade_name'
go
select * from :: fn_listextendedproperty (NULL, 'user', 'dbo', 'table',
'customer', 'column', default)
go
drop table dbo.customer
go
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:OOrsHkGUFHA.3636@.TK2MSFTNGP14.phx.gbl...
> We have a large SQL Server database that has poorly documented tables and
> field names. Is there a product that will create a Word document in
table
> format from the actual database that can be used to add documentation
about
> the meaning of each field?
> --
> Will
>
>
Saturday, February 25, 2012
Process cannot connect to distributor error !!!
So far it can subscribe and unsubscribe just fine but when it comes to the syncing process it gets a little weird, here's why.
- If I run the SQL GUI Sync tool, it sinks fine. So that setup is working.
- When I run the C# App it blows up witht the error: "Process cannot connect to Distributor"
- Here's the weird part: When I set a breakpoint on my custom method SyncData (this method sets up the connection info and properties and then calls Syncronize( ) ) and step through the code when it gets to Syncronize( ) it runs perfectly fine, no execeptions.
I thought that maybe the Syncronize( ) method was being called too fast before the connection properties got to fully setup and connect, so I added a Thread.Sleep( ) method for 10 secs after each connection call and just before calling Syncronize( ). It still didn't work. My class is a static class by design, however, I changed it into an ordinary class and then placed the connection info in the constructor hoping it would do it's connection when the object gets initialized, that didn't work either.
If someone could please help me out with this I would greatly appreciate it.
Here's my code:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Replication;
using Microsoft.SqlServer.Replication.BusinessLogicSupport;
using Microsoft.SqlServer.Management.Common;
using System.Windows.Forms;
using System.Threading;
namespace Emds.Briefcase.BriefcaseSubscriber.BLL
{
public class SyncDataClass
{
#region Members
private static string m_statusMessage = string.Empty;
private static byte m_percentComplete;
public delegate void StatusTextChangeHandler(int percent, string status);
public static event StatusTextChangeHandler OnStatusChange;
#endregion Members
#region Methods
public static string SyncData()
{
//Delay();
// Define the server, publication, and database names.
string publicationName = "Chart";
string publisherName = @."JSMITH\SQL2005";
string subscriberName = @."JDOE\SQL2005";
string subscriptionDbName = "DataSubscriber";
string publicationDbName = "DataPublisher";
string message = string.Empty;
// Create a connection to the Subscriber.
ServerConnection conn = new ServerConnection(subscriberName);
MergePullSubscription subscription;
try
{
// Connect to the Subscriber.
conn.Connect();
// Delay();
// Define the pull subscription.
subscription = new MergePullSubscription();
subscription.ConnectionContext = conn;
//Delay();
subscription.DistributorSecurity.WindowsAuthentication = false;
subscription.DistributorSecurity.SqlStandardLogin = "sa";
subscription.DistributorSecurity.SqlStandardPassword = "russell";
// Delay();
subscription.PublisherName = publisherName;
subscription.PublicationDBName = publicationDbName;
subscription.PublicationName = publicationName;
subscription.PublisherSecurity.SecurityMode = ReplicationSecurityMode.SqlStandard;
subscription.PublisherSecurity.SqlStandardLogin = "sa";
subscription.PublisherSecurity.SqlStandardPassword = "russell";
// Delay();
subscription.DatabaseName = subscriptionDbName;
subscription.SubscriberSecurity.WindowsAuthentication = false;
subscription.SubscriberSecurity.SqlStandardLogin = "sa";
subscription.SubscriberSecurity.SqlStandardPassword = "russell";
// Delay();
// If the pull subscription exists, then start the synchronization.
if (subscription.LoadProperties())
{
// Check that we have enough metadata to start the agent.
if (subscription.PublisherSecurity != null || subscription.DistributorSecurity != null)
{
// Synchronously start the Merge Agent for the subscription.
subscription.SynchronizationAgent.Status += new AgentCore.StatusEventHandler(SynchronizationAgent_Status);
// Delay();
subscription.SynchronizationAgent.Synchronize();
message = "Data Syncronization is a success!";
}
else
{
throw new ApplicationException("There is insufficent metadata to " +
"synchronize the subscription. Recreate the subscription with " +
"the agent job or supply the required agent properties at run time.");
}
}
else
{
// Do something here if the pull subscription does not exist.
throw new ApplicationException(String.Format(
"A subscription to '{0}' does not exist on {1}",
publicationName, subscriberName));
}
}
catch (Exception ex)
{
// Implement appropriate error handling here.
throw new ApplicationException("The subscription could not be " +
"synchronized. Verify that the subscription has " +
"been defined correctly.", ex);
}
finally
{
conn.Disconnect();
}
return message;
}
static void SynchronizationAgent_Status(object sender, StatusEventArgs e)
{
m_percentComplete = e.PercentCompleted;
m_statusMessage = e.Message;
//Fire custom event
if (OnStatusChange != null)
{
OnStatusChange(m_percentComplete, m_statusMessage);
}
}
#endregion Methods
}
}Moved to SQL Server Replication forum.|||
You may want to try setting the distributor security on the Agent object directly before calling subscription.SynchronizationAgent.Synchronize() like so:
subscription.SynchronizationAgent.DistributorSecurityMode = SecurityMode.Standard
subscription.SynchronizationAgent.DistributorLogin = "sa"
subscription.SynchronizationAgent.DistributorPassword = "russell"
Hope that helps,
-Raymond
|||Raymond,Thanks for your response. If you look at my code listing I think you will see that I am already doing that, unless I missunderstood what you were suggesting.
Thanks again,
Chris|||
There is actually a subtle difference: I believe your code is setting the security info on the subscription object, whereas my code is setting it on the SynchronizationAgent object.
-Raymond
|||Ok, I will give it a shot. Thank you again!!|||That was it!!! Thank you very, very much!!!!!Take care!!!