How to restart capture job (for Change Data Capture), if I don't have this procedure - sys.sp_cdc_stop_job on the server?
(using Microsoft SQL Azure (RTM) - 12.0.2000.8 Sep 18 2021 19:01:34 Copyright (C) 2019 Microsoft Corporation )
Need to restart it to reflect my changes in configuration by sp_cdc_change_job.
In Azure SQL Database the capture and cleanup SQL Server Agent jobs are replaced by a change data capture scheduler that periodically invokes stored procedures to capture and cleanup of the change tables. This scheduler runs stored procedures automatically.
You can check this document to understand how the Capture job initiates the running of stored procedures.
Related
I am getting below error while enabling stats on Azure Sql DatawareHouse. Using below command
alter database [DatabaseName] set auto_create_statistics ON
Msg 104434, Level 16, State 1, Line 26 This option is not supported in
PDW.
I checked database version :
Microsoft Azure SQL Data Warehouse - 10.0.1091.15 Apr 4 2018 05:52:44
I tried to enable stats on another instance of Azure SQL DWH and it worked fine there. The only difference I could find is database version:
Microsoft Azure SQL Data Warehouse - 10.0.1091.36 Apr 30 2018 19:33:29
If this could be the reason then how to upgrade version for Azure SQL Data Warehouse?
For security reasons, upgrades to SQL Data Warehouse do not occur at the same time everywhere. Greater user control is something that the team is working on as a customer scenario. In the mean time, you can attempt a pause then resume operation and see if your instance is available for an upgrade.
Scenario:
2 servers - SQL2008 and SQL2016
Job 1 : Backup - Scheduled SQL Agent Job running for 2 Databases on SQL2008 with the destination on SQL2016 server
Job 2 : Restore - Scheduled SQL Agent Job running for 2 Databases on SQL2016 from the that location.
So thinking of making these 2 individual into a single job for Backup and Restore.
Please help/guide me to combining these 2 Jobs.
Do I Use Powershell or SQL for getting this correct?
When communicating between two servers, the best way I know is to create a Linked Server going both-ways, and on each server. The only gotcha is to make sure the SQL syntax used to select or insert data from a server, is compliant with that server, or the linked server.
From SQLShack...
"Linked servers allow submitting a T-SQL statement on a SQL Server instance, which returns data from other SQL Server instances. A linked server allows joining data from several SQL Server instances using a single T-SQL statement when data exists on multiple databases on different SQL instances. By using a linked server to retrieve data from several SQL instances, the only thing that should be done is to connect to one SQL instance.
There are two ways of configuring linked server in SSMS. One way is by using sp_addlinkedserver system stored procedure and another is by using SQL Server Management Studio (SSMS) GUI interface."
Without writing out the SQL code for both backups and restores, I suggest you read up on Linked Servers, and apply them into your code. I recommend you test the code first manually, outside of a job, and then apply it to a scheduled job or Maintenance Plan.
But as a hint :), try the syntax when linking your table from a linked server object:
[LINKED SERVER].[DATABASE].[Schema].[TableName]
I have a strange behaviour with Sql server 2008 R2 SP2.
First I restore a backup of database.
Then I launch this command
DBCC OPENTRAN
And I get this response:
Transaction information for database 'Pitming'.
Oldest active transaction:
SPID (server process ID): 34s
UID (user ID) : -1
Name : offline index build
LSN : (4082671:527:134)
Start time : Jul 17 2014 8:59:38:107AM
SID : 0x0
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
then it's impossible to delete the database I always get an error saying the database is in use.
It's also impossible to truncate the log
This behaviour is not present in SQL 2005
Any Idea ?
I can't comment until my reputation is higher so forgive me if this "answer" is off the mark. If you are restoring to SQL2008 R2 a backup that was created with an earlier version of SQL Server the problem may be with full-text indexes. If this is the case try setting your server's Full Text Upgrade Option to 1 (Reset) before the restore. Then rebuild the full-text indexes after the database is upgraded to 2008 R2.
http://msdn.microsoft.com/en-us/library/ms186858(v=sql.105).aspx
"After you restore a SQL Server 2005 or SQL Server 2000 database to SQL Server 2008 R2, the database becomes available immediately and is then automatically upgraded. If the database has full-text indexes, the upgrade process either imports, resets, or rebuilds them, depending on the setting of the upgrade_option server property."
I used the below command to create a database snapshot in SQL Server 2008 R2:
CREATE DATABASE "dbss" ON (
NAME = "os-file-name",
FILENAME = 'path')
AS SNAPSHOT OF "dbName";
GO
I got this error:
Database Snapshot is not supported on Standard Edition (64-bit).
Does anyone knows how can I create a database snapshot in SQL Server 2008 R2?
Database Snapshot is a feature of the Enterprise Edition and the 2008 Developer Edition.
Besides that there is only little use of Snapshots for a "common user". Most things can be done with a backup too.
Main purpose for snapshots are expensive queries on rapidly changing data.
If you got a huge database and need to execute a query for a report that takes some time there is the danger that data may change while the query / procedure fetches data for the report. In this case you need snapshots. There you can query all your data without having problems with changing data.
How do I schedule a stored procedure in Sql Server 2005 that it runs once at the start of every month (and on database startup)?
You will need to create a job using the SQL Server Agent.
In SQL Server Management Studio, go expand the SQL Server Agent node under the DB server, right click the Jobs folder and select New Job...
(If the SQL Server Agent node does not appear, you may be missing the required permissions)
That will take you through a wizard to schedule a sproc to run on whatever schedule you want.
In terms of how to get a sproc to run on db startup, see this article.