Solved

DB2 Command Line Recover

  • 9 September 2021
  • 4 replies
  • 642 views

Userlevel 4
Badge +14

Good afternoon all

I have DB2 backing up successfully and successfully executed the rollforward recovery within Commvault.

the DBA would like to be able to run this from the command line and we used:

 

db2 recover db <database_name> to 2001-12-31-04.00.00

 

The issue we have is that due to the way we have been routed, we need to specify a media agent for the recovery operation (easy in the GUI), but I can’t see a way to do this in the command line.

I’ve saved the XML script that would allow this, but the DBA would prefer to just run a command.
Is there anyway I can specify which Media Agent must always be used in this operation?
I hope that makes sense?

Thanks,
Mauro

icon

Best answer by Mahender Reddy 9 September 2021, 17:34

View original

4 replies

Userlevel 3
Badge +5

@Mauro, We have an option to pass the MediaAgent name with the command line backups/restores.
Please check the below documentation link.

https://documentation.commvault.com/commvault/v11_sp20/article?p=14906.htm

 

 

 

Userlevel 4
Badge +14

Hi Mahender

Thanks so much for this. It’s definitely going to be a huge help.
I assume I’ll need to get this completed by the DBA, as I don’t have access to his systems?

Userlevel 3
Badge +5

Hi Mauro.


Before submitting the restore, your DBA should update VENDOROPT and LOGARCHOPT1 parameters as following:-

db2 update db cfg for <database name> using VENDOROPT "'CvClientName=<client_name_on_CommCell>,CvInstanceName=Instance001,CVDB2USEMEDIAPARAMS=1'"

db2 update db cfg for <database name> using LOGARCHOPT1 "'CvClientName=<client_name_on_CommCell>,CvInstanceName=Instance001,CVDB2USEMEDIAPARAMS=1'"

Where <database name> is the name of the database
<client_name_on_CommCell> is the name of the client in commcell console.

After updating the parameter, you or your DBA should create a parameter file in any location on the client with the following entries:-

The name of the file can be any(for example: parameter.txt)
You can add only MediaAgent entry and also any other media related info((like storage policy, Library)
In your case, you only need MediaAgent entry, so the file should have the following info:

[mediaagent]
<name of the MediaAgent>


Where replace the mediaagent name in the <name of the MediaAgent>.

After creating the parameter.txt file, you need to add the following registry key to the client properties, under additional settings.

Registry Key name: sDB2MEDIAPARAMS_<instanacename>_<DATABASENAME>
Category: Db2Agent
Type: String
Value: <complete path of the parameter file>

Replace the parameter.txt path in <complete path of the parameter file>.

Ref:- https://documentation.commvault.com/commvault/v11_sp20/article?p=14904.htm


Please let me know in case of any questions.

--
Mahender

Userlevel 4
Badge +14

Hi Mauro.


Before submitting the restore, your DBA should update VENDOROPT and LOGARCHOPT1 parameters as following:-

db2 update db cfg for <database name> using VENDOROPT "'CvClientName=<client_name_on_CommCell>,CvInstanceName=Instance001,CVDB2USEMEDIAPARAMS=1'"

db2 update db cfg for <database name> using LOGARCHOPT1 "'CvClientName=<client_name_on_CommCell>,CvInstanceName=Instance001,CVDB2USEMEDIAPARAMS=1'"

Where <database name> is the name of the database
<client_name_on_CommCell> is the name of the client in commcell console.

After updating the parameter, you or your DBA should create a parameter file in any location on the client with the following entries:-

The name of the file can be any(for example: parameter.txt)
You can add only MediaAgent entry and also any other media related info((like storage policy, Library)
In your case, you only need MediaAgent entry, so the file should have the following info:

[mediaagent]
<name of the MediaAgent>


Where replace the mediaagent name in the <name of the MediaAgent>.

After creating the parameter.txt file, you need to add the following registry key to the client properties, under additional settings.

Registry Key name: sDB2MEDIAPARAMS_<instanacename>_<DATABASENAME>
Category: Db2Agent
Type: String
Value: <complete path of the parameter file>

Replace the parameter.txt path in <complete path of the parameter file>.

Ref:- https://documentation.commvault.com/commvault/v11_sp20/article?p=14904.htm


Please let me know in case of any questions.

--
Mahender

Hi Mahender

Thank you so much for this information. We managed to complete this successfully and the POC was signed off as successful.
I appreciate your help.

Reply