ChangeActiveDatabase method

Changes which database is currently active in the audit store.

Syntax

void ChangeActiveDatabase(
AuditStoreDatabase classdatabase
)

Parameters

Specify the following parameter when using this method.

Parameter Description

database

The database object of the audit store database that you want to make active.

Errors

The ChangeActiveDatabase method may throw one of the following exceptions:

  • Centrify.DirectAudit.Common.Logic.AuthenticationException if you do not have permission to connect to the Microsoft SQL Server instance that hosts the management database or you do not have permission to connect to the Microsoft SQL Server instance of the audit store database to be created.
  • Centrify.DirectAudit.Common.Logic.ConnectDatabaseException if you cannot connect to the Microsoft SQL Server instance either because the instance is not running or does not allow remote connections.
  • Centrify.DirectAudit.Common.Logic.UnauthorizedException if you do not have the Manage Database permission on the audit store or you do not have the SQL Server permission to create SQL Server databases on the Microsoft SQL Server instance.

Discussion

An audit store can have multiple databases attached, but only one can be active at a time. Once you have made a database inactive by calling this method, you cannot make it active again. You cannot detach the active database.

Example

The following code sample illustrates using AuditStore.ChangeActiveDatabase in a script:

' Change active Audit Store database
objAuditStore.ChangeActiveDatabase(objAuditStoreDatabase)
wscript.echo "Changed active database to '" & objAuditStore.ActiveDatabase.Name & "'."

See also