大网数据广告活动
磁盘与文件系统

JetTerm2 Function

· 52CE 我爱测

Learn more about: JetTerm2 Function

Applies to: Windows | Windows Server

JetTerm2 Function

The JetTerm2 function initiates the shutdown of an instance that has been initialized by JetInit.

JetTerm2 can also destroy an uninitialized instance that was created by JetCreateInstance.

    JET_ERR JET_API JetTerm2(
      __in          JET_INSTANCE instance,
      __in          JET_GRBIT grbit
    );

Parameters

instance

The instance to use for this call.

Windows 2000:  This parameter is ignored and should always be NULL.

Windows XP and later releases:  This parameter is overloaded. If the engine is operating in legacy mode (Windows 2000 compatibility mode) where only one instance is supported, then this parameter might be NULL or might contain the actual instance that is returned by JetInit. If the engine is operating in multi-instance mode, then this parameter must be a pointer to an instance that was created using JetCreateInstance.

grbit

A group of bits that contain the options to be used for this call, which include zero or more of the following values.

Value Meaning
JET_bitTermComplete Requests that the instance be shut down cleanly. Any optional cleanup work that would ordinarily be done in the background at run time is completed immediately.
JET_bitTermAbrupt Requests that the instance be shut down as quickly as possible. Any optional work that would ordinarily be done in the background at run time is abandoned.Note  This option can cause temporary or permanent space loss in the database. This lost space can always be recovered through an offline defragmentation of the database.
JET_bitTermStopBackup Requests that the instance be shut down even if there is currently a backup in progress. Ordinarily, a pending backup would cause <a href="gg269298(v=exchg.10).md">JetTerm</a> to fail with JET_errBackupInProgress. When this parameter is not present, its value is presumed to be JET_bitTermAbrupt.
JET_bitTermDirty Requests that the instance be shut down with all the attached databases left in a dirty state.Windows 7: JET_bitTermDirty is introduced in Windows 7.

Return Value

This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.

Return code Description
JET_errSuccess The operation completed successfully.
JET_errBackupInProgress The operation cannot complete because a backup operation is in progress on the instance.
JET_errInvalidParameter One of the parameters that was provided contained an unexpected value, or the combination of several parameters yielded an unexpected result. This error will be returned by <a href="gg269298(v=exchg.10).md">JetTerm</a> when the engine is in multi-instance mode and when pinstance refers to an invalid instance.Windows XP:  This return value is introduced in Windows XP.
JET_errNotInitialized The operation cannot complete because the instance has not yet been initialized.
JET_errTermInProgress The operation cannot complete because the instance is being shut down.
JET_errRestoreInProgress It is not possible to complete the operation because a restore operation is in progress on the instance.
JET_errTooManyActiveUsers The instance cannot be shut down because there are currently sessions with active transactions for the specified instance. This error occurs only if the JET_bitTermComplete is used.

If this function succeeds, the specified instance will be shut down. The instance handle will also be closed and made unavailable to any API that takes an instance handle. All other objects that are associated with the instance, such as sessions, will also be closed. The state of the checkpoint file, transaction log files, and the database files attached to the instance will be modified during the shutdown process.

If this function fails as a result of a usage error, then the instance remains in an initialized state and nothing changes. Otherwise, the instance is still shut down as stated for the success case. The difference is that the instance will need to go through crash recovery when it is next initialized. The engine will try to flush as much data as possible to minimize the amount of recovery that is required. Conceptually, such a failure of JetTerm is no different than a process crash.

Remarks

See JetTerm.

Requirements
Requirement Value
Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header Declared in Esent.h.
Library Use ESENT.lib.
DLL Requires ESENT.dll.
See Also

Extensible Storage Engine Files
JetCreateInstance
JET_ERR
JET_GRBIT
JetInit
JET_INSTANCE
JetTerm

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 04/11/2016
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。