sql server pretends to do a log shipping to himself - sql-server

I have a sql server 2017 config:
2 nodes on a lan synced in an AG: zsbe-eve-db-01/02,
1 node in a remote site: zsbe-rui-db-01 (standby/readonly),
one database named "Primary" (it is stupid, I know, I didn't create it).
Master node zsbe-eve-db-02 is using log shipping (every minute) to send deltas to zsbe-rui-db-01.
Log shipping works: adding 1 row in db in zsbe-eve-db-02, and after 1 minute the row can be selected on zsbe-rui-db-01.
Problem:
In SQL server log of zsbe-eve-db-02, we get these 2 errors every minute:
The log shipping secondary database ZSBE-EVE-DB-02.Primary has restore threshold of 60 minutes and is out of sync. No restore was performed for 12279 minutes. Restored latency is 0 minutes. Check agent log and log shipping monitor information.
Error: 14421, Severity: 16, State: 1.
Seems that zsbe-eve-db-02 thinks it holds secondary database (although it is master).
ZSBE-EVE-DB-02 is primary and read write:
In log shipping config screen of zsbe-eve-db-02 only 1 rui node appears:
Can someone explain me where sqlserver configured a kind of log shipping from a node to himself?
Transaction log shipping report is weird:
No information appears on zsbe-rui-db-01.
We dropped the log whole shipping config, all related jobs and alerts, on all servers, and these messages are still there. The log shipping report shows only the line in red (alert) and we don't know how to clear it:
Any hint?

Related

Sql logshipping restore delay

I have a production database which logships to a reporting db but the restore seems to be happening only once in 24 hours . The job is set to run every 15 mins but it seems that nothing gets restored and the message says "backup file skipped as the restore delay has not reached.". I tried to find the restore delay with the query
Select secondary_database,
restore_delay
from msdb.dbo.log_shipping_secondary_databases
but I can get anything related to that database.
1) Which server do I need to change the restore delay option
2) How to change the restore delay to 0.
Thanks
You're on the right track. However, the query you mentioned only returns values when connected to the Secondary server in the Log Shipping configuration. If you determine the restore delay needs to change, that must be done on the Primary server (Right-click database -> Properties -> Transaction Log Shipping -> Click on the ... button to the right of the database listed -> Restore Transaction Log tab)

Replication: Cannot execute 'sp_replcmds' on <ServerName>, all simple solutions already explored

We ran out of space on our Production Server and during this time we started getting: "Cannot execute 'sp_replcmds' on " on Replication. The Distributor is the Publisher as well.
After fixing the space issue - this is the only error I'm getting on my Replication
We have five databases set-up for Replication. The four small databases work with no error messages except that the Last Synchronization Status says the following: "The process could not connect to Distributor "
The one large database gets the error in the subject and also that it cannot connect to the Distributor . The Error Code is: MSSQL_REPL22037
I checked the DBOwner and it is set up correctly. I stopped and started the Log Reader Agents too many times to count. I restarted the MSSQLServer Agent Processes on the Subscriber Server as well.
I solved this one myself. After all the other suggestions
It was definitely the BatchSize and the QueryTimeOut properties.
In order to change this:
Launch Replication Monitor.
Expand to the Publication in question.
Go to Agents Tab.
Right Click on Log Reader Agent > Agent Profile.
Create a New Agent Profile with the new parameters you need.
Set the New Profile to 'Use for this Agent'
Restart the Log Reader Agent and just wait.
Rinse/Repeat until you get the right amount.
I set the Timeout to 2400 and the BatchSize to 100 from 1800 and 500 respectively.

SQL server replication error: "The initial snapshot for publication 'XYZ' is not yet available"

I am using sql server 2012, and i've set up a snapshot replication between two servers. The snapshot agent completed successfully, however the replication agent seems keep running forever and cannot stop.
The action message from replication monitor is like:
Initializing
Applied Script 'ScriptX.pre'
...
Bulk copied data into table 'tabA'
...
Delivered snapshot from the 'replicaDataSubFolder' sub-folder in x milliseconds
The initial snapshot for publication 'XYZ' is not yet available.
And then the action message stuck at the last sentence and cannot stop.
Any thoughts?
The message The initial snapshot for publication 'XYZ' is not yet available was most likely a transient message which popped because the Snapshot Agent had not finished generating the snapshot yet.
After the snapshot was generated, the Distribution Agent began applying the snapshot, which is why you then saw the messages Delivered snapshot from the 'replicaDataSubFolder' sub-folder in x milliseconds ..... Bulk copied data into table 'tabA'.
This is normal and by design.
Verify the snapshot was successfully applied at the subscriber. You can do this by examining the data at the subscriber.
This link solved my problem.
Causes:
You have created or reinitialized a transactional subscription that was created with the Yes, initialize the schema and data option, and you started the Distribution Agent before you started the Snapshot Agent or before the Snapshot Agent had completed. You will only see this error if there is only one article associated with the Distribution Agent. If there are multiple articles associated with the the Distribution Agent, you may see the error 21075, "The initial snapshot for publication '%s' is not yet available."
Solution:
If the associated Snapshot Agent has not been started since the subscription was created or if it has not been started since the last time you choose to reinitialize the subscription, you will need to start the Snapshot Agent and let it complete before starting the Distribution Agent.
If the Snapshot Agent does not complete, check the Snapshot Agent history for errors and address them. If necessary, you can add a log to the Snapshot Agent to see if more details can be returned for any errors.

Getting Alert that Backup Log Failed but it didn't

I'm migrating databases from SQL Server 2008 R2 to a new server running SQL Server 2012. I set up an alert for any severity >= 16. I have a maintenance plan that includes a log backup of all user databases every 5 minutes. After restoring about 10 databases to the new server, I started getting an alert every 30 minutes that says:
DESCRIPTION: BACKUP failed to complete the command BACKUP LOG MyDatabaseName. Check the backup application log for detailed messages.
COMMENT: (None)
JOB RUN: (None)
I searched the logs and there is nothing about a failed backup, and all the backups are fine. I get the alert every 30 minutes, so it's not happening on all of the log backups because they run every 5 minutes. And it's only for one or sometimes two databases out of the 10 that have been restored onto the new server.
I would greatly appreciate anyone that can point me in the right direction to start troubleshooting this.
The maintenance plan runs via a SQL Server Agent job. Check the history of the job. Any failures might show there.
Error level 16 is not considered critical and can be fixed by the user.
Just setup the following to monitor all alerts > level 11.
1 - Database mail
http://craftydba.com/?p=1025
2 - Operator
http://craftydba.com/?p=1085
3 - Alerts
http://craftydba.com/?p=1099
Next time you get a alert, you should get an email with details.
If you want to be real fancy, you can have the alert call a job. Log the alert in the APPLICATION log and then send the email.

Why Do I See the "In Recovery" Msg, and How Can I Prevent it?

The project I'm working on creates a local copy of the SQL Server database for each SVN branch you work on. We're running SQL Server 2008 Express with Advanced Services on our local machine to host it.
When we create a new branch, the build script will create a new database with the ID of that branch, creates the schema objects, and copies over a selection of data from the production shadow server.
After the database is created, it, or other databases on the local machine, will often go into "In Recovery" mode for several minutes. After several refreshes it comes up and is happy, but will occasionally go back into "In Recovery" mode.
The database is created in simple recovery mode. The file names aren't specified, so it uses default paths for files.
The size of the database after loading data is ~400 megs. It is running in SQL Server 2005 compatibility mode.
The command that creates the database is:
sqlcmd -S $(DBServer) -Q "IF NOT EXISTS (SELECT [name] FROM sysdatabases WHERE [name] = '$(DBName)') BEGIN CREATE DATABASE [$(DBName)]; print 'Created $(DBName)'; END"
...where $(DBName) and $(DBServer) are MSBuild parameters.
I got a nice clean log file this morning. When I turned on my computer it starts all five databases. However, two of them show transactions being rolled forward and backwards. The it just keeps trying to start up all five of the databases.
2010-06-10 08:24:59.74 spid52 Starting up database 'ASPState'.
2010-06-10 08:24:59.82 spid52 Starting up database 'CommunityLibrary'.
2010-06-10 08:25:03.97 spid52 Starting up database 'DLG-R8441'.
2010-06-10 08:25:05.07 spid52 2 transactions rolled forward in database 'DLG-R8441' (6). This is an informational message only. No user action is required.
2010-06-10 08:25:05.14 spid52 0 transactions rolled back in database 'DLG-R8441' (6). This is an informational message only. No user action is required.
2010-06-10 08:25:05.14 spid52 Recovery is writing a checkpoint in database 'DLG-R8441' (6). This is an informational message only. No user action is required.
2010-06-10 08:25:11.23 spid52 Starting up database 'DLG-R8979'.
2010-06-10 08:25:12.31 spid36s Starting up database 'DLG-R8441'.
2010-06-10 08:25:13.17 spid52 2 transactions rolled forward in database 'DLG-R8979' (9). This is an informational message only. No user action is required.
2010-06-10 08:25:13.22 spid52 0 transactions rolled back in database 'DLG-R8979' (9). This is an informational message only. No user action is required.
2010-06-10 08:25:13.22 spid52 Recovery is writing a checkpoint in database 'DLG-R8979' (9). This is an informational message only. No user action is required.
2010-06-10 08:25:18.43 spid52 Starting up database 'Rls QA'.
2010-06-10 08:25:19.13 spid46s Starting up database 'DLG-R8979'.
2010-06-10 08:25:23.29 spid36s Starting up database 'DLG-R8441'.
2010-06-10 08:25:27.91 spid52 Starting up database 'ASPState'.
2010-06-10 08:25:29.80 spid41s Starting up database 'DLG-R8979'.
2010-06-10 08:25:31.22 spid52 Starting up database 'Rls QA'.
In this case it kept trying to start the databases continuously until I shut down SQL Server at 08:48:19.72, 23 minutes later. Meanwhile, I actually am able to use the databases much of the time.
The last interesting line in the log file is this...
2010-06-10 08:35:01.52 spid34s Recovery completed for database DLG-R8441 (database ID 6) in 1 second(s) (analysis 603 ms, redo 0 ms, undo 219 ms.) This is an informational message only. No user action is required.
The problem appears to have been the "Auto Close" option. After I turned that off, the problem went away. The default value for that is on when you create a database in script, but off if you create the database through management studio.
The Auto Close feature releases all the resources for a database after the last user disconnects. Since this is a development machine, there's usually only one user, so it releases all the resources after each request. Also it appears as though Management Studio occasionally connects to every database on the server, resulting in each database starting up several times a minute.
Cheers

Resources