Solved

How to create Massive subclient on Windows Machine


Badge +5

Hello Folks,

I need to massively create Backup Sub-clients that contain information (prescanscript, postbackupcommand, runas).

When I try to run the command from the CLI however I have errors (after following the Login to the CommCell).

Do you have any advice and / or any indication?

Best regards

icon

Best answer by Graham Swift 24 August 2022, 23:07

View original

12 replies

Userlevel 6
Badge +12

What errors are you getting, can you show the XML you are using

Badge +5

Greeting @MFasulo ,

I used the following command. The *.xml file is the standard one I downloaded from the site.

All the info I put on the command line. I'm doing it wrong?

 

qoperation execscript -subClientEntity/clientName <<NameClient>> -backupsetName SecLog -subclientName SecLog -storagePolicyName <<StoragePolicy>> -contentOperationType ADD -content/path 'C:\Seclogs\tmp' -appName 'File System' -impersonateUser/userName USERNAMECUSTOM -impersonateUser/password PASSWORDCUSTOM -isSnapBackupEnabled true

execute: Error 0x911: Failed to process request due to invalid entity information.Invalid backupsetId for backupsetName[SecLog].Invalid subclientId for subclientName[SecLog].

Userlevel 4
Badge +10

Have you created the backup set called seclog on these clients?

 

if not you will need to create the backup set first and then create the subclient using the above script. 

Below is the doc page with the create backupset syntax

https://documentation.commvault.com/11.24/expert/18641_creating_windows_file_system_backup_set_from_command_line_interface.html

Userlevel 4
Badge +10

Hello @xor did this help?

Badge +5

Hello Graham Swift ,

I was able via script to create the BackupSet and the subclient.

Also through command I was able to enter the information I needed (pre / post command).

Now I have a problem with the Archive process not deleting files once backed up. and it's a big problem.

Best regards,

xor

qoperation execute -af create_backupset_template.xml -clientName <<CLIENTNAME>> -appName 'File System' -backupsetName <<NAME>> -isArchivingEnabled "False"

qoperation execute -af create_subclient_template.xml -appName 'File System' -clientName <<CLIENTNAME>> -backupSetName <<NAME>> -subclientName <<NAME>> -contentOperationType ADD -content/path '<<DIRECTORY>>' -preScanCommand 'DIRECTORY SCRIPT.BAT' -postBackupCommand 'DIRECTORY SCRIPT.BAT' -dataBackupStoragePolicy/storagePolicyName PolicyName400GGH -runAs 'USE_LOCAL_SYS_ADMIN'


 

 

Userlevel 4
Badge +10

Ok. If you are performing archiving rather than backups then you will need to look at archive clients and plans or using archiveSets rather than backup sets. 
 

I will send some info on this in the morning. 

Badge +5

Correct.

By setting everything up, however, the process does not work correctly.

I'll wait you.

best regards,

xor

Userlevel 4
Badge +10

Hello @xor ,

 

Sorry for the delay, too many things going on this week :)

So I can confirm that archives can and do delete files if you have configured an ArchiveSet (not a backupSet). And then there are some safety mechanisms in place to ensure that if the data is archived and delete that we can recover it. DR backups, multiple copies etc…

If it is not working then you have either configured it incorrectly, or you just need patience for teh DR backups to have run etc...

As you are configuring as new, I would recommend using Archive plans:

https://documentation.commvault.com/2022e/essential/134793_archive_plans.html

Then once you have an archive plan created you then run through a process of adding clients to it. This will create the archive set for you and they all get the archiving rules as set up on the plan.

Clients can be added using the API and if you get it set how you want you can then go through adding a client to it and using the Equivalent API link t get what can then be used as the template for additional clients.

For archiving you should test, test and test again. As this is potentially destructive and will impact end users. Get it working as you need first by testing the settings and creating it manually, then look at the automation side.

POST {{serverUrl}}/InstallClient

and a payload may look like and you will likely need to configure the settings to meet your requirements:

{
  "rebootClient": false,
  "createPseudoClientRequest": {
    "clientInfo": {
      "clientType": 0,
      "subclientInfo": {
        "contentOperationType": 2,
        "useLocalContent": true,
        "useLocalArchivalRules": true,
        "fsSubClientProp": {
          "afterDeletionKeepItemsForNDays": 0,
          "archiverRetention": true,
          "archiverRetentionMode": 2,
          "backupRetention": false,
          "backupRetentionMode": 1,
          "extendRetentionForNDays": -1,
          "extendStoragePolicyRetention": true,
          "keepOlderVersionsForNDays": 30,
          "keepVersions": 0,
          "olderFileVersionsMode": 2,
          "retainPerDayPeriod": 1,
          "retainPerMonthPeriod": 6,
          "retainPerWeekPeriod": 1,
          "diskCleanupRules": {
            "afterArchivingRule": 2,
            "enableArchivingWithRules": true,
            "archiveReadOnlyFiles": false,
            "enableRedundancyForDataBackedup": false,
            "fileAccessTimeOlderThan": 0,
            "fileCreatedTimeOlderThan": 0,
            "fileModifiedTimeOlderThan": 0,
            "fileSizeGreaterThan": 0,
            "maximumFileSize": 0,
            "startCleaningIfLessThan": 100,
            "stopCleaningIfupto": 100,
            "stubPruningOptions": 0,
            "stubRetentionDaysOld": 365
          }
        },
        "content": [
          {
            "path": "c:\\testArchive"
          }
        ]
      },
      "plan": {
        "planName": "ArchivePlan",
        "planId": 27
      },
      "archiverServerProperties": {
        "isArchiverClient": true
      }
    }
  },
  "packages": [
    {
      "packageId": 702,
      "packageName": "File System"
    }
  ],
  "entities": [
    {
      "hostName": "dc1",
      "clientName": "dc1",
      "clientId": 98
    }
  ]
}

Badge +5

Hello Graham Swift,

where I put the code ?

I use this command in PS, where’s the error?

 

qoperation execute -af create_subclient_template.xml -appName 'File System' -clientName CLIENTNAME -backupSetName TESTING -subclientName TESTING -contentOperationType ADD -content/path 'C:\tmp' -preScanCommand 'c:\tmp\command.bat 1>> c:\tmp\std.out 2>> c:\tmp\stderr.out'  -dataBackupStoragePolicy/storagePolicyName POLICY_180GG -runAs 'USE_LOCAL_SYS_ADMIN' -isArchivingEnabled "True" -enableArchivingWithRules "True" -enableOnePass "True" -enableArchivingWithRules "DELETE_THE_FILE"

 

Userlevel 4
Badge +10

OK, so I have not tried creating an ArchiveSet using qcommands but your example above is:

qoperation execute -af create_backupset_template.xml -clientName <<CLIENTNAME>> -appName 'File System' -backupsetName <<NAME>> -isArchivingEnabled "False"

If you used this then you created a backupSet, not an archiveSet.

You could try creating it with the following and see if it looks like an archiveSet?

qoperation execute -af create_backupset_template.xml -clientName <<CLIENTNAME>> -appName 'File System' -backupsetName <<NAME>> -isArchivingEnabled "True"

If it is an archiveSet it should look like this in the JAVA GUI, notice the icon is different:

You may then find when you use the create subclient command it works.

Badge +5

Greetings,

When I use the command: 

qoperation execute -af create_backupset_template.xml -clientName AW-WSA-FAOTB1T -appName 'File System' -backupsetName SecLogArchive -isArchivingEnabled "True"

I have this situation. I need the SubClient name in “MyCustom” Name and put in this more Settings.

Is it possible?

 

 

 

In alternative I need to create a New SubClient Name:

qoperation execute -af create_subclient_template.xml -appName 'File System' -clientName CLIENTNAME -backupSetName TESTING -subclientName TESTING -contentOperationType ADD -content/path 'C:\tmp' -preScanCommand 'c:\tmp\command.bat 1>> c:\tmp\std.out 2>> c:\tmp\stderr.out'  -dataBackupStoragePolicy/storagePolicyName POLICY_180GG -runAs 'USE_LOCAL_SYS_ADMIN' -isArchivingEnabled "True" -enableArchivingWithRules "True" -enableOnePass "True" -enableArchivingWithRules "DELETE_THE_FILE"

 But i have this problem:

 

Userlevel 4
Badge +10

So sorry for the delay @xor . I think the issue is likely to be the content of the create_subclient_content.xml. 

It has the whole archive section missing from it. I honestly can’t see a template for archiving subclients in our documentation so I will see if that can be added, however I am not sure this will be possible as archiving has been moved to Command Center and we can do all of this via API command.

POST {{serverURL}}/Subclient along with quite a simple payload. You can get this using the Command Center GUI to create the subclient and before finishing click the Equivalent API link.

{
"subClientProperties": {
"contentOperationType": 2,
"subClientEntity": {
"clientId": 251,
"clientName": "fs1.cv-lab.local",
"applicationId": 33,
"backupsetId": 627,
"backupsetName": "DefaultArchivingSet",
"subclientName": "testCCArchiveSubclient"
},
"commonProperties": {
"enableBackup": true,
"impersonateUserCredentialinfo": {
"credentialId": 1,
"credentialName": "administrator"
}
},
"planEntity": {
"planId": 27
},
"content": [
{
"path": "\\\\fs1.cv-lab.local\\sql"
}
],
"fsSubClientProp": {
"useGlobalFilters": "USE_CELL_LEVEL_POLICY",
"extendStoragePolicyRetention": true,
"archiverRetention": true,
"backupRetention": false,
"archiverRetentionMode": 2,
"backupFilesQualifiedForArchive": true,
"forcedArchiving": true,
"diskCleanupRules": {
"afterArchivingRule": 1,
"archiveReadOnlyFiles": false,
"enableArchivingWithRules": true,
"enableRedundancyForDataBackedup": false,
"fileAccessTimeOlderThan": 0,
"fileCreatedTimeOlderThan": 0,
"fileModifiedTimeOlderThan": 91,
"fileSizeGreaterThan": 1024,
"maximumFileSize": 0,
"startCleaningIfLessThan": 100,
"stopCleaningIfupto": 100,
"stubPruningOptions": 0,
"stubRetentionDaysOld": 365
},
"backupConfiguration": {
"backupDataAccessNodes": [
{
"_type_": 3,
"clientId": 98,
"clientName": "dc1"
}
]
}
},
"useLocalContent": true,
"useLocalArchivalRules": false
}
}

However what I have done below, and is good tip, create an archive subclient manually in the JAVA GUI with all the settings you are wanting and then before clicking OK, click Save As Script. This will then save the XML which you can then use for your new template.

You should get something like below. As you can see there is a whole section for archiving rules.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<App_CreateSubClientRequest>

<subClientProperties>
<subClientEntity>
<subclientName>newArchiveSubclient</subclientName>
<backupsetName>archive</backupsetName>
<instanceName>DefaultInstanceName</instanceName>
<appName>File System</appName>
<clientName>sql1</clientName>
<hostName></hostName>
<displayName></displayName>
<commCellName></commCellName>
<csGUID></csGUID>
<flags/>
<newName></newName>
<providerDomainName></providerDomainName>
<multiCommCellId>0</multiCommCellId>
<entityInfo/>
<workloadRegionId>0</workloadRegionId>
<workloadRegionDisplayName></workloadRegionDisplayName>
<serviceType>0</serviceType>
</subClientEntity>
<commonProperties>
<encryptionFlag>ENC_NETWORK_AND_MEDIA</encryptionFlag>
<prepostProcess>
<preScanCommand></preScanCommand>
<postScanCommand></postScanCommand>
<preBackupCommand></preBackupCommand>
<postBackupCommand></postBackupCommand>
<preSNAPCommand></preSNAPCommand>
<postSNAPCommand></postSNAPCommand>
<runPostScan>NO</runPostScan>
<runPostBackup>NO</runPostBackup>
<runAs>NO_SELECTION</runAs>
<prepostUserName>
<userName></userName>
</prepostUserName>
<preSnapProcessOn>SOURCE</preSnapProcessOn>
<postSnapProcessOn>SOURCE</postSnapProcessOn>
</prepostProcess>
<storageDevice>
<dataBackupStoragePolicy>
<storagePolicyName>SP1_GDSP1</storagePolicyName>
</dataBackupStoragePolicy>
<softwareCompression>USE_STORAGE_POLICY_SETTINGS</softwareCompression>
<networkAgents>2</networkAgents>
<throttleNetworkBandwidth>0</throttleNetworkBandwidth>
<applicableReadSize>512</applicableReadSize>
<deDuplicationOptions>
<enableDeduplication>true</enableDeduplication>
<generateSignature>ON_CLIENT</generateSignature>
</deDuplicationOptions>
<overrideDataPath>false</overrideDataPath>
<overrideIncrementalDataPath>false</overrideIncrementalDataPath>
<dataPathOperationType>OVERWRITE</dataPathOperationType>
</storageDevice>
<snapCopyInfo>
<snapToTapeProxyToUseSource>false</snapToTapeProxyToUseSource>
<isRMANEnableForTapeMovement>false</isRMANEnableForTapeMovement>
<snapToTapeProxyToUse>
<clientName></clientName>
</snapToTapeProxyToUse>
<snapToTapeSelectedEngine>
<snapShotEngineName></snapShotEngineName>
</snapToTapeSelectedEngine>
<isSnapBackupEnabled>false</isSnapBackupEnabled>
<useSeparateProxyForSnapToTape>false</useSeparateProxyForSnapToTape>
<separateProxyForSnapToTape>
<clientName></clientName>
</separateProxyForSnapToTape>
</snapCopyInfo>
<securityAssociations/>
<enableBackup>true</enableBackup>
<isDecoupleSCPContent>false</isDecoupleSCPContent>
<isReferenceCopySubclient>false</isReferenceCopySubclient>
<isSystemStateSubclient>false</isSystemStateSubclient>
<indexCycleToEveryBackupJobs>0</indexCycleToEveryBackupJobs>
<turboNASClient>
<clientName></clientName>
</turboNASClient>
<associatedSnapShotSCId>
<subclientName></subclientName>
</associatedSnapShotSCId>
<expandSymbolicLinks>false</expandSymbolicLinks>
<enableAppleDoubleSupport>false</enableAppleDoubleSupport>
<isDefaultSubclient>false</isDefaultSubclient>
<description></description>
<numberOfBackupStreams>0</numberOfBackupStreams>
<allowMultipleDataReaders>true</allowMultipleDataReaders>
<onDemandSubClient>false</onDemandSubClient>
<excludeFromSLA>false</excludeFromSLA>
<enableBackupAfterDelay>false</enableBackupAfterDelay>
<enableBackupAtDateTime/>
<associatedPolicy/>
<prepostCredentialinfo/>
<impersonateUserCredentialinfo/>
<runAs>CV_NO_SELECTION</runAs>
<ignoreStrikesBefore>0</ignoreStrikesBefore>
<isAdAppAwareSubclient>false</isAdAppAwareSubclient>
<disableArchivingTurboRule>false</disableArchivingTurboRule>
<subclientPolicy/>
</commonProperties>
<content>
<path>c:\archivePath</path>
</content>
<impersonateUser>
<userName></userName>
</impersonateUser>
<fileSystemSubClient/>
<fsSubClientProp>
<includePolicyFilters>false</includePolicyFilters>
<useGlobalFilters>USE_CELL_LEVEL_POLICY</useGlobalFilters>
<useVSS>true</useVSS>
<vssOptions>FOR_LOCKED_FILES_ONLY</vssOptions>
<useVssForAllFilesOptions>CONTINUE_AND_DO_NOT_RESET_ACCESS_TIME</useVssForAllFilesOptions>
<useVSSForSystemState>true</useVSSForSystemState>
<enableOnePass>true</enableOnePass>
<diskCleanupModified>false</diskCleanupModified>
<backupFilesQualifiedForArchive>true</backupFilesQualifiedForArchive>
<isDDBSubclient>false</isDDBSubclient>
<oneTouchSubclient>false</oneTouchSubclient>
<oneTouchServer>
<clientName></clientName>
</oneTouchServer>
<oneTouchServerDirectory></oneTouchServerDirectory>
<honorArchiverAgentRetention>false</honorArchiverAgentRetention>
<keepAtLeastPreviousVersions>0</keepAtLeastPreviousVersions>
<deleteArchiveJobAfterDays>0</deleteArchiveJobAfterDays>
<isSynthfullRunAfterOnePassEnabledOnSubclient>false</isSynthfullRunAfterOnePassEnabledOnSubclient>
<catalogAdditional>false</catalogAdditional>
<catalogACL>false</catalogACL>
<scanOption>OPTIMAL_SCAN</scanOption>
<preserveFileAccessTime>false</preserveFileAccessTime>
<checkArchiveBit>false</checkArchiveBit>
<isTrueUpOptionEnabledForFS>true</isTrueUpOptionEnabledForFS>
<runTrueUpJobAfterDaysForFS>30</runTrueUpJobAfterDaysForFS>
<runTrueUpJobAfterJobsForFS>0</runTrueUpJobAfterJobsForFS>
<blockLevelBackup>0</blockLevelBackup>
<createFileLevelIndexDuringBackup>false</createFileLevelIndexDuringBackup>
<blockLevelSPOSBackup>0</blockLevelSPOSBackup>
<backupFilesOnOrAfter>false</backupFilesOnOrAfter>
<backupFilesOnOrAfterDate/>
<backupFileTimeZoneName></backupFileTimeZoneName>
<deletePSTFileOnly>false</deletePSTFileOnly>
<enableOCSBackupOnSubclient>false</enableOCSBackupOnSubclient>
<ocsUserName>
<userName></userName>
</ocsUserName>
<useIncremental>false</useIncremental>
<diskCleanupRules>
<enableArchivingWithRules>true</enableArchivingWithRules>
<startCleaningIfLessThan>100</startCleaningIfLessThan>
<stopCleaningIfupto>100</stopCleaningIfupto>
<fileAccessTimeOlderThan>0</fileAccessTimeOlderThan>
<fileModifiedTimeOlderThan>91</fileModifiedTimeOlderThan>
<fileCreatedTimeOlderThan>0</fileCreatedTimeOlderThan>
<fileSizeGreaterThan>1024</fileSizeGreaterThan>
<maximumFileSize>0</maximumFileSize>
<archiveReadOnlyFiles>false</archiveReadOnlyFiles>
<afterArchivingRule>REPLACE_FILE_WITH_STUB</afterArchivingRule>
<stubRetentionDaysOld>365</stubRetentionDaysOld>
<stubPruningOptions>DISABLED</stubPruningOptions>
<patternMatch></patternMatch>
<entityMatch></entityMatch>
<enableRedundancyForDataBackedup>false</enableRedundancyForDataBackedup>
<diskCleanupFileTypes/>
</diskCleanupRules>
<vssShadowCopy></vssShadowCopy>
<DefaultBMPVolume></DefaultBMPVolume>
<backupSaveFileData>true</backupSaveFileData>
<backupSpooledFileData>false</backupSpooledFileData>
<backupQueueData>false</backupQueueData>
<backupPrivateAuthority>false</backupPrivateAuthority>
<targetReleaseForBackupData></targetReleaseForBackupData>
<syncAllLibForBackup>false</syncAllLibForBackup>
<activeWaitTime>0</activeWaitTime>
<syncQueue></syncQueue>
<txtlibSyncCheckPoint></txtlibSyncCheckPoint>
<customSubclientContentFlags>0</customSubclientContentFlags>
<customSubclientFlag>false</customSubclientFlag>
<backupAsObjects>false</backupAsObjects>
<saveWhileActiveOpt></saveWhileActiveOpt>
<ibmiSubclientprop>
<saveSecData>true</saveSecData>
<saveConfObject>true</saveConfObject>
<printSysInfo>false</printSysInfo>
</ibmiSubclientprop>
<retentionPolicy>0</retentionPolicy>
<backupConfiguration/>
<saveAccessPath>*SYSVAL</saveAccessPath>
<enableFolderLevelMultiThread>false</enableFolderLevelMultiThread>
<folderLevelThreadCount>0</folderLevelThreadCount>
<extendStoragePolicyRetention>true</extendStoragePolicyRetention>
<archiverRetention>true</archiverRetention>
<archiverRetentionMode>EXTEND_RETENTION_INDEFINITELY</archiverRetentionMode>
<extendRetentionForNDays>-1</extendRetentionForNDays>
<backupRetention>false</backupRetention>
<keepVersions>10</keepVersions>
<useSubclientPolicyRetention>false</useSubclientPolicyRetention>
<backupFilesAsExtents>false</backupFilesAsExtents>
<extentSize>4</extentSize>
<bigFileSize>1024</bigFileSize>
<updateHistory>*NO</updateHistory>
<enableContentIndexing>false</enableContentIndexing>
<contentIndexingPolicy>0</contentIndexingPolicy>
<genSignatureOnIBMi>0</genSignatureOnIBMi>
<ibmiCompression>*NO</ibmiCompression>
<openvmsBackupDate>false</openvmsBackupDate>
<isManualDDBSubclient>false</isManualDDBSubclient>
<enableNetworkShareAutoMount>false</enableNetworkShareAutoMount>
<retainPerDayPeriod>0</retainPerDayPeriod>
<retainPerWeekPeriod>0</retainPerWeekPeriod>
<retainPerMonthPeriod>0</retainPerMonthPeriod>
<backupUsingMultipleDrives>false</backupUsingMultipleDrives>
</fsSubClientProp>
<dfsSubclientProp>
<useGPFSSnapshot>false</useGPFSSnapshot>
</dfsSubclientProp>
<cloudAppsSubClientProp>
<collectACL>true</collectACL>
</cloudAppsSubClientProp>
<hcSubclientProp/>
<analyticsSubclientProp/>
<cassandraProps/>
<fsContentOperationType>OVERWRITE</fsContentOperationType>
<fsExcludeFilterOperationType>CLEAR</fsExcludeFilterOperationType>
<fsIncludeFilterOperationType>CLEAR</fsIncludeFilterOperationType>
<useLocalArchivalRules>false</useLocalArchivalRules>
<dcPlanEntity/>
</subClientProperties>

</App_CreateSubClientRequest>

 

Reply