online database

Description

Marks a database available for public use after a normal load sequence; if needed, upgrades a loaded database to the current version of Adaptive Server; brings a database online after loading a transaction log dumped with the for standby_access option. You can also use online database to bring an archive database online.

Syntax

online database database_name [for standby_access]

Parameters

database_name

specifies the name of the database to be brought online.

for standby_access

brings the database online on the assumption that the database contains no open transactions.

Examples

Example 1

Makes the pubs2 database available for public use after a load sequence completes:

online database pubs2

Example 2

Brings the database inventory_db online. Used after loading inventory_db with a transaction-log dump obtained through dump tran...with standby_access:

online database inventory_db for standby_access

Usage


Upgrading databases


Archive databases

The online database database_name command performs undo recovery during which modified and allocated pages may be remapped to the modified pages section.

You do not need to bring a database online if it has been loaded with norecovery, since the load automatically brings the database online without running the recovery undo pass.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for online database differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be the database owner, or a user with online database privilege or own database privilege on the database.

Granular permissions disabled

With granular permissions disabled, you must be the database owner, or a user with any of these roles:

  • sa_role, or,

  • replication_role, or,

  • oper_role

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

83

security

online database

  • Roles – current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – NULL

  • Proxy information – original login name, if set proxy is in effect

See also

Commands dump database, dump transaction, load database, load transaction

System procedures sp_helpdb