Sqlserver
 SQL >> Database >  >> RDS >> Sqlserver

Come risolvere l'errore "The configuration option 'Agent XPs' does not exist" in SQL Server (T-SQL)

Se incontri l'errore Msg 15123, Level 16, probabilmente stavi eseguendo EXEC SP_CONFIGURE 'Agent XPs' mentre le opzioni avanzate erano nascoste.

La correzione è semplice.

Esempio dell'errore

EXEC SP_CONFIGURE 'Agent XPs';

Risultato:

Msg 15123, Level 16, State 1, Procedure SP_CONFIGURE, Line 62 The configuration option 'Agent XPs' does not exist, or it may be an advanced option.

Come detto, significa che show advanced options è impostato su 0.

Soluzione

Basta eseguire:

EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO

Risultato:

Started executing query at Line 18 Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install. Started executing query at Line 20 Commands completed successfully. Total execution time: 00:00:00.126

Dopo la prima riga il sistema ci ha invitato a eseguire RECONFIGURE, cosa che abbiamo fatto.

Ora, rilanciando il codice precedente, l'errore non compare più.

EXEC SP_CONFIGURE 'Agent XPs';

Risultato:

+-----------+-----------+-----------+----------------+-------------+ | name      | minimum   | maximum   | config_value   | run_value   | |-----------+-----------+-----------+----------------+-------------| | Agent XPs | 0         | 1         | 0              | 0           | +-----------+-----------+-----------+----------------+-------------+ 

Modificare un'impostazione

Probabilmente il tuo obiettivo era proprio modificare un'opzione avanzata, ad esempio abilitare Agent XPs.

EXEC SP_CONFIGURE 'Agent XPs', 1; GO RECONFIGURE; GO

Risultato:

Started executing query at Line 23 Configuration option 'Agent XPs' changed from 0 to 1. Run the RECONFIGURE statement to install. Started executing query at Line 25 Commands completed successfully. Total execution time: 00:00:00.142

Verifichiamo di nuovo l'impostazione.

EXEC SP_CONFIGURE 'Agent XPs';

Risultato:

+-----------+-----------+-----------+----------------+-------------+ | name      | minimum   | maximum   | config_value   | run_value   | |-----------+-----------+-----------+----------------+-------------| | Agent XPs | 0         | 1         | 1              | 1           | +-----------+-----------+-----------+----------------+-------------+ 

Nascondere di nuovo le opzioni avanzate

Quando hai finito, è buona norma nasconderle nuovamente.

EXEC sp_configure 'show advanced options', 0; GO RECONFIGURE; GO