Shared Schedules & Always On Availability - sql-server

We are running a report server on a SQL 2019 Always on AG in MS Azure.
When you go to see the Shared Schedules in Reporting Services and SQL Server is on the secondary replica, RS cannot see these shared schedules, you receive the error:
An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.
When you switch back to the other replica it works fine.
I've tried creating them again when on the secondary replica but it doesn't allow you to commit the creation of the schedule.
Is there something that needs to be done so both Replicas can see the Shared Schedules?

Related

Replicate Stored Procedures between MS Databases

I want a solution that match the below scenario:
We have 2 databases with 1 being the main DB and the other being the secondary DB. I want a process (executable, powershell, anything...) that can update the changes that I make in Stored Procedures in the main DB. the main DB is the database that we will make the changes then I want a process that update (simple delete and create) the older SP in the secondary DB.
How I can make this possible in the most simply way? If you will say software to work with please take in account that I only want freeware.
It seemed like you are defining something called Mirroring if I didn't assume wrong.
Database mirroring maintains two copies of a single database that must reside on different server instances of SQL Server Database Engine. Typically, these server instances reside on computers in different locations. Starting database mirroring on a database, initiates a relationship, known as a database mirroring session, between these server instances.
One server instance serves the database to clients (the principal server). The other instance acts as a hot or warm standby server (the mirror server), depending on the configuration and state of the mirroring session. When a database mirroring session is synchronized, database mirroring provides a hot standby server that supports rapid failover without a loss of data from committed transactions. When the session is not synchronized, the mirror server is typically available as a warm standby server (with possible data loss).
https://learn.microsoft.com/en-us/sql/database-engine/database-mirroring/database-mirroring-sql-server?view=sql-server-2017
Hope it helps

Why does centrally hosted web app have processes backed up in sql activity monitor?

Our application opens sql connections, uses them to access stored sql procedures, closes and disposes them the second control returns to the next statement in our vb code, and yet we are seeing the sql procedure calls back up in the sql activity monitor. This is causing the application to lock up when it is used heavily.
Some of the stored procedures may have insert or write operations that are accessing tables on the centralized instance of sql server on the host machine. These tables may well be shared among all the workstation endpoint users.
Any ideas why we're having these lockups happen? Could there be a record lock on the sql server tables that causes a process to orphan and hangs the software or the user session? How can this be avoided, tested for and managed to avoid lockups?

Pause SQL server replication temporarily

We have a transactional replication setup using 3 SQL Servers, 1st as publisher, 2nd as distributor, and 3rd as subscriber.
We have an activity to change the location of the replicated DB (subscriber) using de-attach and attach method. During this activity, I will need to stop the SQL server and hence all replicated transactions will fail.
What's the proper way to pause the replication during this activity, so when I attach the DB again and start the SQL service, replication will resume normally.
Thanks
Please see the following link for details of how to accomplish this:
Start and Stop a Replication Agent
The above article doesn't appear to give information on stopping the distribution agent, this can be achieved by using the stored procs detailed in the link below:
Start/Stop SQL Server Replication Agent using TSQL

SQL Server 2008R2 Transactional Replication - Move SubscriberDB - Push Subscription

SQL Server 2008R2 Transactional Replication - Move SubscriberDB - Push Subscription
I have a requirement to move a subscriber database to a new server outside of a system outage i.e. I cannot stop new transaction from loading into the publisher database.
So far I have attempted to stop the distribution agent and let all un-replicated commands replicate to the subscriber database at Server1. Then backup and restore the subscriber database to Server2. I have then created a new subscription from Server2 to the existing publication.
This works but only transactions created from that point forward are replicated to the Server2 subscriber database. I also require all the old transactions built up at the distributor database destined to only go to Server1.
Is there a replication command available to update the destination of existing transactions at the distributer to the new subscriber.subscriber_DB?
There is 1 publication with multiple articles. The publication is currently only subscribed to by one database at Server1.
You're working too hard. Create a subscription on the new server as though you didn't have an existing subscription at all. There are many ways to do this; pick your favorite. I see in your response to another answer that snapshots are a no-go. I have had a lot of success using the "initialize from backup" option (here, "backup" refers to a backup of the publisher). Once the subscriber is in sync after initialization, you're done. You're now clear to "migrate" to the new server.
Due to the distribution agent being specific to each subscribing server, you can't really have a new subscriber take over where an existing subscriber left off. The only way this would work is if you backup/restore to Server2, temporarily stopped transactions on the publisher, backup/restore log to Server2, create subscriptions with "replication support only", and then re-enable transactions.
Can you not just add subscriptions to the same publication for the new subscriber and kick off the snapshot agent? That will independently sync Server2 while Server1 continues to stay in sync. You should then be able to switch to Server2 seamlessly and remove the subscriptions to Server1.
One note of warning though. I would check the sync_method in syspublications table (or run sp_helppublications) of your publication database to make sure snapshots won't lock the tables in your publisher (by default with SQL Server 2005+, this shouldn't be an issue). Otherwise, what I just suggested will cause blocking on the publisher until the snapshot finishes.
Also, this is a good reference to understanding how to do snapshots one at a time if you setup replication through the GUI using default settings. This will be useful for distributing the snapshots over a larger period of time to reduce publisher server load if you have a lot of data to replicate (gigabytes rather than megabytes).
http://www.replicationanswers.com/TransactionalOptimisation.asp

SQL Server checkpoints

can anyone explain when SQL Server issues a checkpoint?
from: http://msdn.microsoft.com/en-us/library/ms188748.asp
Events That Cause Checkpoints
Before a database backup, the Database Engine automatically performs a checkpoint so that all changes to the database pages are contained in the backup. In addition, checkpoints occur automatically when either of the following conditions occur:
The active portion of the log exceeds
the size that the server could
recover in the amount of time
specified in the recovery interval
server configuration option.
The log becomes 70 percent full, and
the database is in log-truncate mode.
A database is in log truncate mode
when both these conditions are TRUE:
the database is using the Simple
recovery model, and, after execution
of the last BACKUP DATABASE statement
that referenced the database, one of
the following events occurs:
A minimally logged operation is
performed in the database, such as a
minimally logged bulk copy operation
or a minimally logged WRITETEXT
statement is executed. An ALTER
DATABASE statement is executed that
adds or deletes a file in the
database.
Also, stopping a server issues a checkpoint in each database on the server. The following methods of stopping SQL Server perform checkpoints for each database:
Using SQL Server Configuration Manager.
Using SQL Server Management Studio.
Using the SHUTDOWN statement.

Resources