Skip to main content
Solved

Command line SQL backups for single database


Melissa Adams
Commvault Certified Expert
Forum|alt.badge.img+8

Hey all -

 

I am working with a customer and we have the command line backup for a SQL instance working just fine using an xml file.  What we can’t figure out is how do we do just 1 database on the instance?  We see the api call in command center but it doesn’t translate to the xml.  Anyone have the magic command?  We tried adding <databaseName>xxxx</databaseName> right under instance in the xml.

 

Attached a sample of the xml.

Best answer by Gseibak

Hi Melissa,

try adding this section in the XML -  you will need to replace the variables below with your config.

-<sqlDatabaseAssociation>

<databaseId>5</databaseId>

<databaseName>CommServ</databaseName>
-<associatedSubclient>

<subclientName>default</subclientName>

<backupsetName>defaultBackupSet</backupsetName>

<instanceName>CS1\COMMVAULT</instanceName>

<appName>SQL Server</appName>

<clientName>CS1</clientName>

<displayName>CS1LAB</displayName>

<commCellName>CS1LAB</commCellName>

<csGUID>21320A30-5383-4248-BF3D-AD1478A6C05F</csGUID>

</associatedSubclient>

 

you can also do a “save as” script from the subclient to generate the XML.

View original
Did this answer your question?

6 replies

MFasulo
Vaulter
Forum|alt.badge.img+12
  • Vaulter
  • 175 replies
  • August 31, 2021

POST https://commserve/proxy/v2/sql/backup

 

{
  "backupType": "FULL",
  "instances": [
    {
      "sourceInstance": {
        "instanceId": 28,
        "instanceName": "SQL2\\PRODSQL2"
      },
      "selectedDatabases": [
        {
          "databaseId": 160,
          "databaseName": "AppStudioDB"
        }
      ]
    }
  ]
}


Melissa Adams
Commvault Certified Expert
Forum|alt.badge.img+8
  • Author
  • Commvault Certified Expert
  • 27 replies
  • August 31, 2021

@MFasulo  how does this translate to the xml?  We did see this in API equivalent but this doesn't give me what I need.

 


MFasulo
Vaulter
Forum|alt.badge.img+12
  • Vaulter
  • 175 replies
  • August 31, 2021

I see the challenge.  Let me dig a bit into this.   Is there a reason to force XML or can you use JSON?


Melissa Adams
Commvault Certified Expert
Forum|alt.badge.img+8
  • Author
  • Commvault Certified Expert
  • 27 replies
  • September 1, 2021

He is calling command line from within SQL studio.  I do understand how the APIs work, but how do we do that from within SSMS?  The command line was pretty easy to get working using qoperation execute.

 


Forum|alt.badge.img+11
  • Vaulter
  • 115 replies
  • Answer
  • September 3, 2021

Hi Melissa,

try adding this section in the XML -  you will need to replace the variables below with your config.

-<sqlDatabaseAssociation>

<databaseId>5</databaseId>

<databaseName>CommServ</databaseName>
-<associatedSubclient>

<subclientName>default</subclientName>

<backupsetName>defaultBackupSet</backupsetName>

<instanceName>CS1\COMMVAULT</instanceName>

<appName>SQL Server</appName>

<clientName>CS1</clientName>

<displayName>CS1LAB</displayName>

<commCellName>CS1LAB</commCellName>

<csGUID>21320A30-5383-4248-BF3D-AD1478A6C05F</csGUID>

</associatedSubclient>

 

you can also do a “save as” script from the subclient to generate the XML.


Melissa Adams
Commvault Certified Expert
Forum|alt.badge.img+8
  • Author
  • Commvault Certified Expert
  • 27 replies
  • November 8, 2021

@Gseibak  just getting back to this so we will try again!  Customer was doing a POC so we had tabled it.  We will also be working with Marcus so I’m pretty sure he will know the answer!

Hope all is well!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings