Binding with temporary databases

The following is required for sp_tempdb bind to succeed:

If

Then

objtype is login_name

objname must be a valid login name, and scope is NULL

objtype is application

objname is an application name, and scope is NULL.

If

Then

bindtype is group

bindobj must be the name of the existing group that you are binding to, which in this case is default.

bindtype is database

bindobj must be an existing temporary database name. It cannot be tempdb since tempdb cannot have explicit bindings.

When you successfully execute sp_tempdb bind, it inserts a new entry into sysattributes to represent this binding.

If an entry already exists for the objname/objtype/scope combination you specified in sp_tempdb bind, its entry in sysattributes is updated with the new information represented by the bindtype and bindobj you specify.

Although the new binding you create is effective immediately, any session that has already been assigned a temporary database continues to maintain that original assignment. Only new sessions are affected by the new binding.

NoteApplications can change their name through ct_lib and other interfaces such as jConnect, even after connecting and starting a session. This does not affect the temporary database assignment to the session. This is also true for the setuser command.

Binding an “sa” to its own temporary database

You can bind the “sa” login to a separate temporary database for maintenance and disaster recovery purposes. By isolating the “sa” user from the temporary database activities of other applications and users, the “sa” user is guaranteed to have access to temporary database resources when necessary.