cancel
Showing results for 
Search instead for 
Did you mean: 

SQL restore from command line fails with Error in CryptAcquireContext

bordio27
Level 4

Hi everyone,

 for automation purposes, I want that every user on a Win 2012 machine with NetBackup 8.1.2 can do SQL restore via command line using dbbackex command.

I observed that, if a user ("Y0001" in this case) has never done access to NetBackup MS SQL Client on the client and never set userid and password (typically "sa") for the SQL instance, dbbackex fails with this error:

18:06:46.669 [10912.356] <4> CDBIniParms::CDBIniParms: INF - NT User is Y0001
18:06:48.732 [10912.356] <16> DB_CryptAcquireContext: ERR - Error in CryptAcquireContext : 2148074309.
18:06:48.732 [10912.356] <1> DB_CryptAcquireContext: CONTINUATION: - The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.

When NT User Y0001 runs NetBackup SQL Agent and set for the first time userid and password, dbbackex ends fine

I need that other users could run dbbackex command, without setting userid and password in NetBackup MS SQL Client

Thanks in advance

db

1 ACCEPTED SOLUTION

Accepted Solutions

Ok, I seen that a user that has never set SQL username and password with NetBackup SQL Client, doesn't have this key registry:
"HKCU:\Software\Veritas\NetBackup\NetBackup for Microsoft SQL Server"

So I said to my PS script to check for the key and to create it if it doesn't exist, adding to the regkey the SQL properties that are needed for the access to the instance

$REGKEY_CHECK = Test-Path -Path "HKCU:\Software\Veritas\NetBackup"
if (-not $REGKEY_CHECK) {
$REGKEY_PATH = "HKCU:\Software\Veritas\NetBackup"
$REGKEY_NAME = "NetBackup for Microsoft SQL Server"
New-Item -Force -Path $REGKEY_PATH -Name $REGKEY_NAME
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_HOST" -Value $TARGETCLIENT
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_INSTANCE" -Value $TARGETINSTANCE
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_NB_MASTER_SERVER" -Value $NBU_MASTER
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_STANDARD_USERID" -Value "sa"
}
else {
}

 

View solution in original post

3 REPLIES 3

Michal_Mikulik1
Moderator
Moderator
Partner    VIP    Accredited Certified

Hello,

it is not probably possible, a user must login at least once - for example look here: https://www.veritas.com/support/en_US/article.100032299.

Also note that a user must have sysadmin role in SQL instance to pefrom restores.

Regards

Michal

I'm wondering if there is a way to set SQL instance credentials from command line

db

Ok, I seen that a user that has never set SQL username and password with NetBackup SQL Client, doesn't have this key registry:
"HKCU:\Software\Veritas\NetBackup\NetBackup for Microsoft SQL Server"

So I said to my PS script to check for the key and to create it if it doesn't exist, adding to the regkey the SQL properties that are needed for the access to the instance

$REGKEY_CHECK = Test-Path -Path "HKCU:\Software\Veritas\NetBackup"
if (-not $REGKEY_CHECK) {
$REGKEY_PATH = "HKCU:\Software\Veritas\NetBackup"
$REGKEY_NAME = "NetBackup for Microsoft SQL Server"
New-Item -Force -Path $REGKEY_PATH -Name $REGKEY_NAME
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_HOST" -Value $TARGETCLIENT
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_INSTANCE" -Value $TARGETINSTANCE
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_NB_MASTER_SERVER" -Value $NBU_MASTER
New-ItemProperty -Path "$REGKEY_PATH\$REGKEY_NAME" -Name "DEFAULT_SQL_STANDARD_USERID" -Value "sa"
}
else {
}