Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new SQL Server 2022 snapshot backup / restore functionality #39

Open
arvindshmicrosoft opened this issue May 31, 2023 · 0 comments
Labels
enhancement New feature or request sql-feature

Comments

@arvindshmicrosoft
Copy link
Member

SQL Server 2022 introduced a new type of backup - snapshot. ScriptDom currently does not support this type of backup. Note that this is different from the database snapshot functionality, which has been around since SQL Server 2005. In addition, there are new statements (BACKUP GROUP and BACKUP SERVER) in SQL Server 2022 which work in conjunction with these snapshot backups. There are also new options like SUSPEND_FOR_SNAPSHOT_BACKUP for ALTER DATABASE and ALTER SERVER CONFIGURATION, which are not recognized by ScriptDom. Example of statements which should be handled by ScriptDom are below. There are more examples in the docs linked to earlier.

ALTER DATABASE testdb1
SET SUSPEND_FOR_SNAPSHOT_BACKUP = ON
(MODE = COPY_ONLY);

ALTER SERVER CONFIGURATION
SET SUSPEND_FOR_SNAPSHOT_BACKUP = ON
(GROUP = (testdb1, testdb2), MODE = COPY_ONLY);

BACKUP DATABASE testdb1
TO DISK = 'd:\temp\db.bkm'
WITH METADATA_ONLY, FORMAT;

RESTORE DATABASE testdb1
FROM DISK = 'd:\temp\db.bkm'
WITH METADATA_ONLY, FILE = 3, REPLACE, --> no DBNAME clause - restore first database in backup set
MOVE 'testdb1' TO 'd:\temp\snap\testdb1.mdf',
MOVE 'testdb1_log' TO 'd:\temp\snap\testdb1_log.ldf';
@dzsquared dzsquared added the enhancement New feature or request label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sql-feature
Projects
None yet
Development

No branches or pull requests

2 participants