Skip to content

SQL Server Error 3041 with BACKUP SERVER statement #1431

@kpenza

Description

@kpenza

Environment

  • Python: 3.12
  • pyodbc: 5.2.0
  • OS: RHEL 9.6
  • DB: MS SQL Server 2022
  • Driver: Microsoft ODBC Driver 18 for SQL Server (18.5.1.1)

Background

We are currently working with SQL Server on Linux snapshot backups. The highlevel steps entail:

  1. Take SQL Server snapshot
    1. Open DB connection.
    2. Execute "ALTER SERVER CONFIGURATION SET SUSPEND_FOR_SNAPSHOT_BACKUP = ON;"
    3. Take Linux LVM snapshot
    4. Execute "BACKUP SERVER TO DISK = '/var/opt/mssql/backup/metadata/backup_1.bkm' WITH METADATA_ONLY, FORMAT;
    5. Close DB connection
  2. Mount LVM snapshots
  3. Backup them up
  4. Unmount LVM snapshots
  5. Delete LVM snapshots

Issue

The statement in Step 1, iv fails with multiple "Error: 3041, Severity: 16, State: 1.". We made test with Java, SQL SSMS, Powershell using ODBC connections and all worked fine.
When we used isql with the -v flag we noted that statement in Step 1, iv returns an "SQL_SUCCESS_WITH_INFO" for each datafile in the SQL instance. Looks like only the first "SQL_SUCCESS_WITH_INFO" is handled by pyodbc Note I can provide the isql output if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions