Interface IDatabaseManager
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public interface IDatabaseManager
Methods
BackupDatabase(String, String, String, DateTime)
Backs up the database.
Declaration
string BackupDatabase(string masterConnectionString, string databaseName, string backupLocation, DateTime backupDate)
Parameters
Type | Name | Description |
---|---|---|
System.String | masterConnectionString | The master catalog connection string. |
System.String | databaseName | Name of the database to be backed up. |
System.String | backupLocation | The backup location. |
System.DateTime | backupDate | The backup date. |
Returns
Type | Description |
---|---|
System.String | Path to the database backup |
DefragmentDatabaseIndexes(String, ref Int32, ref Int32, ref Int32)
Defragments indexes on the target database.
Declaration
void DefragmentDatabaseIndexes(string connectionString, ref int rebuilt, ref int reorganised, ref int updated)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
System.Int32 | rebuilt | Count of rebuilt indexes. |
System.Int32 | reorganised | Count of reorganised indexes |
System.Int32 | updated | Count of updated statistics. |
Remarks
The following rules are used:
- Rebuild threshold of 10%
- Reorganise threshold of 10%
- Statistics update threshold of 7 days
IsDatabaseReadonly(String)
Determines whether the specified connection string is for a readonly database.
Declaration
bool IsDatabaseReadonly(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.Boolean |
|
RestoreDatabase(String, String, String)
Restores the database.
Declaration
void RestoreDatabase(string masterConnectionString, string databaseName, string backupPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | masterConnectionString | The master connection string. |
System.String | databaseName | Name of the database. |
System.String | backupPath | The backup path. |