Clase Job
The Job class represents a Microsoft SQL Server Agent job.
Jerarquía de herencia
System. . :: . .Object
Microsoft.SqlServer.Management.Smo. . :: . .SmoObjectBase
Microsoft.SqlServer.Management.Smo. . :: . .SqlSmoObject
Microsoft.SqlServer.Management.Smo. . :: . .NamedSmoObject
Microsoft.SqlServer.Management.Smo.Agent. . :: . .AgentObjectBase
Microsoft.SqlServer.Management.Smo.Agent..::..Job
Espacio de nombres: Microsoft.SqlServer.Management.Smo.Agent
Ensamblado: Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)
Sintaxis
'Declaración
Public NotInheritable Class Job _
Inherits AgentObjectBase _
Implements IAlterable, ICreatable, IDroppable, IRenamable, _
IScriptable
'Uso
Dim instance As Job
public sealed class Job : AgentObjectBase, IAlterable,
ICreatable, IDroppable, IRenamable, IScriptable
public ref class Job sealed : public AgentObjectBase,
IAlterable, ICreatable, IDroppable, IRenamable, IScriptable
[<SealedAttribute>]
type Job =
class
inherit AgentObjectBase
interface IAlterable
interface ICreatable
interface IDroppable
interface IRenamable
interface IScriptable
end
public final class Job extends AgentObjectBase implements IAlterable, ICreatable, IDroppable, IRenamable, IScriptable
El tipo Job expone los siguientes miembros.
Constructores
Nombre | Descripción | |
---|---|---|
Job() () () () | Initializes a new instance of the Job class. | |
Job(JobServer, String) | Initializes a new instance of the Job class on the specified instance of Microsoft SQL Server Agent and with the specified name. | |
Job(JobServer, String, Int32) | Initializes a new instance of the Job class on the specified instance of SQL Server Agent and with the specified name and category |
Arriba
Propiedades
Nombre | Descripción | |
---|---|---|
Category | Gets or sets the category to which the job belongs. | |
CategoryID | Gets the ID value that uniquely identifies the job category. | |
CategoryType | Gets or sets the type of category, with respect to local or multiserver jobs. | |
CurrentRunRetryAttempt | Gets the number of times Microsoft SQL Server Agent has attempted to run the job unsuccessfully. | |
CurrentRunStatus | Gets the current execution status of the job. | |
CurrentRunStep | Gets information about the job step that is currently running. | |
DateCreated | Gets the date and time when the job was created. | |
DateLastModified | Gets the date and time when the job was last modified. | |
DeleteLevel | Gets or sets the completion action that determines whether to delete the job definition when the job finishes execution. | |
Description | Gets or sets the textual description of the job. | |
EmailLevel | Gets or sets the completion action that determines whether to send an e-mail notification to an operator when the job finishes execution. | |
EventLogLevel | Gets or sets the completion action that determines whether to generate an operating system event log entry when the job finishes execution. | |
ExecuteForScalar | Obtiene o establece el valor de propiedad Boolean que especifica si el objeto está establecido para que se ejecute para la opción escalar. (Se hereda de SqlSmoObject.) | |
HasSchedule | Gets the Boolean property value that specifies whether the job has at least one schedule. | |
HasServer | Gets the Boolean property value that specifies whether the job has a target server assigned for multiple-server operations. | |
HasStep | Gets the Boolean property value that specifies whether the job has at least one job step. | |
IsEnabled | Gets or sets the Boolean property value that specifies whether the job is enabled. | |
IsTouched | Obtiene el valor de propiedad Boolean que especifica si las propiedades del objeto se han actualizado pero todavía no son persistentes en el servidor. (Se hereda de SqlSmoObject.) | |
JobID | Gets the job ID value. | |
JobSchedules | Gets a collection of JobSchedule objects that represent the schedules assigned to the job. | |
JobSteps | Gets a collection of JobStep objects that represent the job steps defined for the job. | |
JobType | Gets the job type, which specifies whether the job is local or multiserver. | |
LastRunDate | Gets the date and time when the job was last run. | |
LastRunOutcome | Gets the result of the job from the last time it completed execution. | |
Name | Gets or sets the name of the Job. (Invalida NamedSmoObject. . :: . .Name.) | |
NetSendLevel | Gets or sets the completion action that determines whether to net-send a notification to an operator when the job finishes execution. | |
NextRunDate | Gets the date and time when the job is next scheduled to run. | |
NextRunScheduleID | Gets the ID value of the schedule that is responsible for the next execution of the job. | |
ObjectInSpace | Obtiene el valor de propiedad Boolean que especifica si el objeto existe en aislamiento, o si está conectado directa o indirectamente con la instancia de SQL Server. (Se hereda de SqlSmoObject.) | |
OperatorToEmail | Gets or sets the operator that receives notification by e-mail when the job finishes execution. | |
OperatorToNetSend | Gets or sets the operator that receives a net-send notification when the job finishes execution. | |
OperatorToPage | Gets or sets the operator that receives a pager notification when the job finishes execution. | |
OriginatingServer | Gets the name of the server that is acting as the master server in a multiserver job. | |
OwnerLoginName | Gets or sets the owner of the job. | |
PageLevel | Gets or sets the completion action that determines whether to send a pager notification to an operator when the job finishes execution. | |
Parent | Gets or sets the JobServer object that is the parent of the Job object. | |
Properties | Obtiene una colección de objetos Property que representa las propiedades del objeto. (Se hereda de SqlSmoObject.) | |
ScalarResult | Obtiene el resultado escalar para el objeto al que se hace referencia. (Se hereda de SqlSmoObject.) | |
StartStepID | Gets or sets the ID value of the first job step in the sequence to be executed. | |
State | Gets the state of the referenced object. (Se hereda de SmoObjectBase.) | |
Urn | Obtiene el valor de la dirección URN (nombre de recursos uniforme) que identifica de forma única el objeto. (Se hereda de SqlSmoObject.) | |
UserData | Gets or sets user-defined data associated with the referenced object. (Se hereda de SmoObjectBase.) | |
VersionNumber | Gets a system-maintained value that is incremented every time the job is modified. |
Arriba
Métodos
Nombre | Descripción | |
---|---|---|
AddDatabaseContext(StringCollection) | Agrega el contexto de la base de datos a la colección de consultas identificada por el parámetro queries. (Se hereda de SqlSmoObject.) | |
AddDatabaseContext(StringCollection, ScriptingOptions) | Agrega el contexto de la base de datos a la colección de consultas identificada por el parámetro queries usando las opciones de scripting especificadas. (Se hereda de SqlSmoObject.) | |
AddSharedSchedule | Adds a shared schedule to the Microsoft SQL Server Agent job. | |
Alter | Updates any Job object property changes on an instance of Microsoft SQL Server. | |
AlterImpl | Activa el evento de objeto modificado. (Se hereda de SqlSmoObject.) | |
AlterImplFinish | Método al que se llama cuando finaliza el evento de objeto modificado. (Se hereda de SqlSmoObject.) | |
AlterImplInit | Método al que se llama cuando se inicializa el evento de objeto modificado. (Se hereda de SqlSmoObject.) | |
AlterImplWorker | Llama a los métodos Alter. (Se hereda de SqlSmoObject.) | |
ApplyToTargetServer | Adds a server to the list of target servers maintained for the referenced Microsoft SQL Server Agent job. | |
ApplyToTargetServerGroup | Adds one or more servers to the list of target servers maintained for the referenced Microsoft SQL Server Agent job. | |
BindDefaultImpl | Enlaza los elementos predeterminados identificados por los parámetros. (Se hereda de SqlSmoObject.) | |
BindRuleImpl | Enlaza el esquema de la regla a la regla y las columnas identificadas por los parámetros. (Se hereda de SqlSmoObject.) | |
CheckCollation | Comprueba el orden de las opciones de scripting por el método de intercalación identificado por el parámetro collationName. (Se hereda de SqlSmoObject.) | |
CheckObjectState() () () () | Valida el estado del objeto al que se hace referencia. (Se hereda de SqlSmoObject.) | |
CheckObjectState(Boolean) | Valida el estado del objeto al que se hace referencia, con la opción de especificar que se produzca una excepción si todavía no se ha creado el objeto. (Se hereda de SqlSmoObject.) | |
CheckObjectStateImpl | Comprueba el estado de un objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
CheckVersion100 | Comprueba si la versión de SQL Server es SQL Server 2008. (Se hereda de SqlSmoObject.) | |
CheckVersion80 | Comprueba la validez del objeto en SQL Server 2000. (Se hereda de SqlSmoObject.) | |
CheckVersion80SP3 | Comprueba la validez del objeto en SQL Server 2000 SP3. (Se hereda de SqlSmoObject.) | |
CheckVersion90 | Comprueba la validez del objeto en SQL Server 2005. (Se hereda de SqlSmoObject.) | |
CheckVersionBelow90 | Comprueba si la versión de SQL Server es anterior a SQL Server 2005. (Se hereda de SqlSmoObject.) | |
CleanObject | Establece el objeto en el estado no modificado. (Se hereda de SqlSmoObject.) | |
Create | Creates a job on the instance of Microsoft SQL Server as defined by the Job object. | |
CreateImpl | Crea un objeto con opciones de scripting. (Se hereda de SqlSmoObject.) | |
CreateImplFinish | Método al que se llama cuando finaliza el evento Create. (Se hereda de SqlSmoObject.) | |
CreateImplInit | Método al que se llama cuando se inicializa el evento Create. (Se hereda de SqlSmoObject.) | |
DeleteJobStepLogs(DateTime) | Deletes job step log files that are older than the specified date. | |
DeleteJobStepLogs(Int32) | Deletes job step log files that are larger that the specified log ID number. | |
Discover | Detecta una lista del tipo Object. (Se hereda de SqlSmoObject.) | |
Drop() () () () | Removes an existing job. | |
Drop(Boolean) | Removes an existing job. | |
DropImpl | Quita un SqlSmoObject. (Se hereda de SqlSmoObject.) | |
DropImplWorker | Llama a los métodos Drop. (Se hereda de SqlSmoObject.) | |
EnumAlerts | Enumerates a list of Agent alerts that cause automated execution of the referenced job. | |
EnumHistory() () () () | Enumerates a list of execution history associated with the referenced job. | |
EnumHistory(JobHistoryFilter) | Enumerates a list of execution history associated with the referenced job. | |
EnumJobStepLogs() () () () | Enumerates a list of job step log files for the referenced job. | |
EnumJobStepLogs(Int32) | Enumerates a list of job step log files for the job step with the specified ID value. | |
EnumJobStepLogs(String) | Enumerates a list of job step log files for the job step with the specified name. | |
EnumJobStepsByID | Returns an array of JobStep objects that belong to the referenced job and that are ordered by ID value. | |
EnumScriptImpl | Enumera los scripts especificados por el parámetro so. (Se hereda de SqlSmoObject.) | |
EnumScriptImplWorker | Llama a los métodos que enumeran los scripts especificados por el parámetro so. (Se hereda de SqlSmoObject.) | |
EnumScriptImplWorkerSOChanged | Devuelve una cadena IEnumerable que describe las opciones de scripting de un objeto. (Se hereda de SqlSmoObject.) | |
EnumTargetServers | Enumerates a list of execution target servers that have been assigned to the referenced job. | |
Equals | (Se hereda de Object.) | |
ExecuteNonQuery | (Se hereda de SqlSmoObject.) | |
Finalize | (Se hereda de Object.) | |
FormatSqlVariant | Da formato a un objeto como tipo SqlVariant. (Se hereda de SqlSmoObject.) | |
GenerateDataSpaceFileStreamScript | Genera un script para crear el archivo de datos. (Se hereda de SqlSmoObject.) | |
GenerateDataSpaceScript | Genera un script para asignar espacio en el archivo de datos. (Se hereda de SqlSmoObject.) | |
GetBindDefaultScript | Obtiene el script que enlaza los valores predeterminados especificados por los parámetros defSchema y defName. (Se hereda de SqlSmoObject.) | |
GetBindRuleScript | Obtiene el script que especifica las reglas de enlace. (Se hereda de SqlSmoObject.) | |
GetBoolParameter(StringBuilder, ScriptingOptions, String, String, Int32%) | Asigna un parámetro booleano del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetBoolParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) | Asigna una propiedad booleana del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetDateTimeParameter | Asigna la propiedad datetime del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetDateTimeParameterAsInt | Asigna la propiedad datetime del objeto SqlSmoObject como un valor entero si la propiedad datetime no es NULL. (Se hereda de SqlSmoObject.) | |
GetDBName | No haga referencia directamente a este miembro en el código. Admite la infraestructura de SQL Server. Gets the database name that is associated with the object. (Se hereda de AgentObjectBase.) | |
GetEnumParameter | Asigna una propiedad enumeration del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetFragOptionString | Obtiene un objeto FragmentationOption como un valor de cadena. (Se hereda de SqlSmoObject.) | |
GetGuidParameter | Asigna una propiedad Guid del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetHashCode | (Se hereda de Object.) | |
GetParameter(StringBuilder, ScriptingOptions, String, String, Int32%) | Asigna un parámetro del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) | Asigna un parámetro del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetPropValue | Obtiene un valor de propiedad del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetPropValueOptional | Obtiene un valor de propiedad del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetPropValueOptionalAllowNull | Obtiene un valor de propiedad del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetRealValue | Obtiene un valor de propiedad del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetScriptingOptionsForCreate | Obtiene ScriptingOptions para el objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetServerName | Obtiene el nombre de la instancia de SQL Server con la que está asociado el objeto. (Se hereda de SqlSmoObject.) | |
GetServerObject | Obtiene el servidor del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetSqlServerVersionName | Obtiene el nombre de la versión de la instancia de SQL Server con la que está asociado el objeto. (Se hereda de SqlSmoObject.) | |
GetStringParameter(StringBuilder, ScriptingOptions, String, String, Int32%) | Asigna un parámetro de cadena del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetStringParameter(StringBuilder, ScriptingOptions, String, String, Int32%, Boolean) | Asigna un parámetro de cadena del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetTimeSpanParameterAsInt | Asigna un parámetro de intervalo de tiempo del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetType | (Se hereda de Object.) | |
GetUrnRecursive(StringBuilder) | Asigna un objeto Urn del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
GetUrnRecursive(StringBuilder, UrnIdOption) | Asigna un objeto Urn del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
ImplInitialize | Inicializa los campos del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
Initialize() () () () | Inicializa el objeto y fuerza la carga de las propiedades. (Se hereda de SqlSmoObject.) | |
Initialize(Boolean) | Inicializa el objeto y fuerza la carga de las propiedades. (Se hereda de SqlSmoObject.) | |
Invoke | Runs the job. | |
IsObjectDirty | Comprueba si se han modificado las propiedades del objeto y los cambios todavía no son persistentes en la instancia de SQL Server. (Se hereda de SqlSmoObject.) | |
IsObjectInitialized | Comprueba si se ha inicializado el objeto. (Se hereda de SqlSmoObject.) | |
IsObjectInSpace | Comprueba si el objeto está aislado o conectado a la instancia de SQL Server. (Se hereda de SqlSmoObject.) | |
IsVersion80SP3 | Determina si la versión de SQL Server es SQL Server 2000 con SP3. (Se hereda de SqlSmoObject.) | |
IsVersion90AndAbove | Determina si la versión de SQL Server es SQL Server 2005 o posterior. (Se hereda de SqlSmoObject.) | |
MarkDropped | Establece SqlSmoState en quitado. (Se hereda de SqlSmoObject.) | |
MarkForDropImpl | Establece SqlSmoState en quitado. (Se hereda de SqlSmoObject.) | |
MemberwiseClone | (Se hereda de Object.) | |
PostAlter | Método que se activa tras modificar el objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
PostCreate | Método que se activa tras crear el objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
PostDrop | Método que se activa tras quitar el objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
PurgeHistory | Removes system records maintaining execution history for the referenced job. | |
Refresh | Actualiza el objeto y recupera las propiedades la próxima vez que se tiene acceso al objeto. (Se hereda de SqlSmoObject.) | |
RemoveAllJobSchedules() () () () | Removes all shared and unshared schedules from the job. | |
RemoveAllJobSchedules(Boolean) | Removes all unused schedules from the job. | |
RemoveAllJobSteps | Removes all the job steps associated with the job. | |
RemoveFromTargetServer | Removes an execution target server from the list of target servers maintained for a job. | |
RemoveFromTargetServerGroup | Removes a group of execution target servers from the list of target servers maintained for a job. | |
RemoveSharedSchedule(Int32) | Removes the specified shared schedule from the job. | |
RemoveSharedSchedule(Int32, Boolean) | Removes the specified shared schedule from the job and keeps unused schedules. | |
Rename | Renames the job. | |
RenameImpl | Solamente se identifica con fines informativos. No compatible. La compatibilidad con versiones posteriores no está garantizada. (Se hereda de NamedSmoObject.) | |
RenameImplWorker | Solamente se identifica con fines informativos. No compatible. La compatibilidad con versiones posteriores no está garantizada. (Se hereda de NamedSmoObject.) | |
Script() () () () | Generates a Transact-SQL script that can be used to re-create the Microsoft SQL Server Agent job. | |
Script(ScriptingOptions) | Generates a Transact-SQL script that can be used to re-create the Microsoft SQL Server Agent job as specified by the scripting options. | |
ScriptAlter | Modifica el objeto SqlSmoObject de acuerdo con los parámetros. (Se hereda de SqlSmoObject.) | |
ScriptChangeOwner | This method supports the SMO infrastructure and is not intended to be used directly from your code. (Se hereda de NamedSmoObject.) | |
ScriptCreate | Modifica el objeto SqlSmoObject de acuerdo con los parámetros. (Se hereda de SqlSmoObject.) | |
ScriptDdl | Inicia InvalidSmoOperationException. (Se hereda de SqlSmoObject.) | |
ScriptDrop | Inicia InvalidSmoOperationException. (Se hereda de SqlSmoObject.) | |
ScriptImpl() () () () | Obtiene una colección de los scripts del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
ScriptImpl(ScriptingOptions) | Obtiene una colección de los scripts del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
ScriptImplWorker | Obtiene una colección de los scripts del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
ScriptOwner | Alters the script owner authorization. (Se hereda de NamedSmoObject.) | |
ScriptRename | This method supports the SMO infrastructure and is not intended to be used directly from your code. (Se hereda de NamedSmoObject.) | |
SetParentImpl | Establece el elemento primario del objeto SqlSmoObject en el parámetro newParent. (Se hereda de SqlSmoObject.) | |
SetSchemaOwned | Sets the schema owned value. (Se hereda de NamedSmoObject.) | |
Start() () () () | Runs the referenced job. | |
Start(String) | Runs the referenced job starting at the specified job step. | |
Stop | Stops executing the referenced job. | |
ToString | Devuelve un valor String que representa el objeto al que se hace referencia. (Se hereda de SqlSmoObject.) | |
TouchImpl | No implementado. (Se hereda de SqlSmoObject.) | |
UnbindDefaultImpl | Desenlaza las columnas predeterminadas del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
UnbindRuleImpl | Desenlaza las reglas del objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
Validate | Validates the state of an object. (Se hereda de SmoObjectBase.) |
Arriba
Eventos
Nombre | Descripción | |
---|---|---|
PropertyChanged | Representa el evento que se produce cuando se cambia una propiedad. (Se hereda de SqlSmoObject.) | |
PropertyMetadataChanged | Representa el evento que se produce cuando cambian los metadatos de la propiedad. (Se hereda de SqlSmoObject.) |
Arriba
Campos
Nombre | Descripción | |
---|---|---|
m_ExtendedProperties | Representa una propiedad definida para extender las propiedades proporcionadas por un objeto SqlSmoObject. (Se hereda de SqlSmoObject.) | |
singletonParent | Representa el elemento primario singleton. (Se hereda de SqlSmoObject.) |
Arriba
Implementaciones de interfaces explícitas
Nombre | Descripción | |
---|---|---|
IAlienObject. . :: . .Discover | Detecta las dependencias. No haga referencia directamente a este miembro en el código. Admite la infraestructura de SQL Server. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .GetDomainRoot | Devuelve la raíz del dominio. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .GetParent | Obtiene el elemento primario de este objeto. No haga referencia directamente a este miembro en el código. Admite la infraestructura de SQL Server. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .GetPropertyType | Obtiene el tipo de la propiedad especificada. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .GetPropertyValue | Obtiene el valor de la propiedad especificada. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .GetUrn | Obtiene el Nombre de recursos uniforme del objeto. No haga referencia directamente a este miembro en el código. Admite la infraestructura de SQL Server. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .Resolve | Obtiene la instancia que contiene la información sobre el objeto del Nombre de recursos unificado del objeto. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .SetObjectState | Establece el estado del objeto en el valor SfcObjectState especificado. (Se hereda de SqlSmoObject.) | |
IAlienObject. . :: . .SetPropertyValue | Establece el valor de la propiedad. (Se hereda de SqlSmoObject.) | |
ISfcPropertyProvider. . :: . .GetPropertySet | Obtiene la referencia de interfaz al conjunto de propiedades de este objeto. No haga referencia directamente a este miembro en el código. Admite la infraestructura de SQL Server. (Se hereda de SqlSmoObject.) |
Arriba
Comentarios
To get or set Job object properties, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be the owner of the job, or be a member of the sysadmin fixed server role.
To create a job, users must be a member of the SQLAgentUserRole, SQLAgentReaderRole, and SQLAgentOperatorRole database roles on the MSDB database, or be a member of the sysadmin fixed server role.
To drop a job, users must be a member of the SQLAgentUserRole database role on the MSDB database, or be the owner of the job, or be a member of the sysadmin fixed server role.
Thread Safety
Todos los miembros estáticos (compartidos en Microsoft Visual Basic) públicos de este tipo son seguros para operaciones multiproceso. No se garantiza que los miembros de instancia sean seguros para subprocesos.
Seguridad para subprocesos
Cualquier miembro público static (Shared en Visual Basic) de este tipo es seguro para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.
Vea también