In my case, I am creating records in SQL Server database. There is a running replication on the database.
Before returning results to client, I need to query the data in the replicated database.
For now, I am using a timer, whereby every 2 seconds I query data from replicated database to see if the data has been replicated.
Is there a way to find out when the data has been replicated before returning results to client and without using Timer?
Technologies used: ASP.NET MVC/JavaScript & backend is SQL Server.
Thanks
Yes there is a way. You can Configure Predefined Replication Alerts (SQL Server Management Studio).
SQL Server Management Studio and Microsoft SQL Server Agent provide a way to monitor events, such as replication agent events, using alerts. SQL Server Agent monitors the Windows application log for events that are associated with alerts. If such an event occurs, SQL Server Agent responds automatically, by executing a task that you have defined and/or sending e-mail or a pager message to a specified operator. SQL Server includes a set of predefined alerts for replication agents that you can configure to execute a task and/or notify an operator.
Refer to these links: Use Alerts for Replication Agent Events, View Information and Perform Tasks for a Subscription (Replication Monitor).
There is also a Microsoft SQL Server Replication Monitor, which is a graphical tool that allows you to monitor the overall health of a replication topology.
Related
I have a number of database on premises that use change tracking to enable 2-way synchronisation with remote disconnected clients; the idea being when the clients connect online they sync their changes and pull down all others.
I need to move the database to an instance on a virtualised server in Azure (note: not Azure SQLDB) but every option - backup/restore, bacpac, etc - seems to reset that version number that SQL Server uses for Change Tracking.
Does anyone know of a way of moving a SQL Server 2012 database to another instance and retaining the Version Number and existing change tracking info?
Thanks
We're in the final phase of migrating our SQL Server on VM to Azure SQL Server. What is the most time-efficient approach to getting our existing SQL Server Agent Jobs out to Azure? I've noticed that inside of SSMS, when connected to an Azure SQL Server, the Agent does not exist - we were aware of this before migrating, but I have yet to have found whether there is an Azure service that replaces the SQL Server Agent Jobs functionality.
There are a number of options.
If you need timed execution of some data momement, Azure Data Factory can be a good replacement.
There is also an Azure Scheduler, that is often mentioned as an alternative. However, I believe that would work better on API's than directly on a database.
I think the best option is Azure automation and create a runbook that connects to your database and performs some action.
An interesting blog that details these options in more detail can be foond at: https://blogs.technet.microsoft.com/uktechnet/2016/02/05/is-sql-server-agent-missing-from-azure-sql-database/
If I only have one VM in Azure I can get outtages at any time when Azure decides to reboot/reprovision my server. Therefor I have to at least two servers in an availability group to get a stable environment.
This is used by a web app (web roles) and an important aspect is that the databases are used for reading. They will get their data from sql replication from an on-premises database. The replication can be done separately to each database. Additionally using Azure Sql Database is not an option because we have not be able to implement a durable data sync solution (using Microsoft Sync Framework), Sql Database does not support sql replication, and constantly uploading the complete database would be too slow.
How should the database VMs be hosted and accessed to able to use Sql Server VMs?
One alternative is to use AlwaysOn Availability Groups. This however requires Sql Server Enterprise edition and the price is very high considering I need to have at least two servers. In this scenario I at least get one connection point behind which a sql server always should be answering. This is however beyond our reach because of the cost.
One alternative could be to use Traffic manager to round robin the connections. When the database server goes down we have to wait for TTL to expire before the webrole would refresh the ip address so that seems a big problem.
How should one host Sql Server VMs in Azure?
You can use FailoverPartner parameter in the connection string to specify the secondary replica address. You can see more in this article.
I'm trying to get AppFabric monitoring to work but I'm stuck here. Events are being inserted into the ASStagingTable but they don't propagate to the ASWcfEventsTable. They do if I manually run the ASImportEvents sp.
I use SQL server 2008 worksation edition on Windows Server 2008R2. I've verified that the AppFabric Event Collection Service is running (but I guess if it wasn't there wouldn't be any records in the staging table) and SQL Server Agent is running. When I created the database (during the AppFabric configuration) I logged in with SQL server authentication and in the connection string I use are the same credentials. Did I miss anything?
Ok, solved it! :) The problem whas that AppFabric's configuration wizzard sets the owner of the jobs in SQL Server Agent to the user that you are currently logged in as instead of the user you connect with to the database?! I changed the owner of the jobs to sa and now everything works.
Is it possible to use SQL Dependency with SQL Server Express 2005 which comes with VS 2008?
Yes. It works fine with named instances as well as default instances, on any SKU (Express, Web, Developer, Standard, Enterprise and Data Center). You can read The Mysterious Notification to understand the underlying mechanism that powers SQL Dependency.
When you open a database using the connection string option AttachDBName you are using a User Instance (aka RANU). The user instances attaches the MDF file using and by default a newly attached database will disable Service Broker in the database. Because the Query Notifications use Service Broker to deliver the notification, it implies that a database with Service Broker disabled cannot create a notification subscription, unless it takes the necessary steps to re-enable Service Broker.
This article suggest that it will work fine as long as the express edition database is a named instance:
http://www.code-magazine.com/article.aspx?quickid=0605061&page=5
HTH