# Restore-CVSQLDatabase

The `Restore-CVSQLDatabase` cmdlet restores data to its original location on the same computer or to any location that you specify.

Before you can use this cmdlet, you must log on to your CommCell environment using the `Connect-CVServer` cmdlet. For more information, see Connecting to a CommCell Environment with PowerShell.

## Syntax

    Restore-CVSQLDatabase -Name $[String] [-OutofPlace] [-OverwriteExisting] [-Force] [-WhatIf] [-Confirm] [$[CommonParameters]]

    Restore-CVSQLDatabase -DatabaseObject $[Object] [-OutofPlace] [-OverwriteExisting] [-Force] [-WhatIf] [-Confirm] [$[CommonParameters]]

## Required Parameters

Parameter | Description | Data type | Accepts pipeline input? | Accepts wildcard characters? | Type of parameter
--- | --- | --- | --- | --- | ---
`–Name` | The name of the database. | String | No | No | Named
`–DatabaseObject` | The object that represents the database. | Object | Yes, by: Value Property name | No | Named

## Optional Parameters

### Commvault Parameters

Parameter | Description | Data type | Accepts pipeline input? | Accepts wildcard characters? | Type of parameter
--- | --- | --- | --- | --- | ---
PointInTime | Specify the database files for point in time restore. | Int32 | No | No | Named
CopyPrecedence | Specify the database files to restore with copy precedence that is applicable to your environment. | Int32 | No | No | Named
`–OutofPlace` | Restores the data out-of-place. | SwitchParameter | No | No | Named
`–OverwriteExisting` | Overwrites the existing virtual machine or database. | SwitchParameter | No | No | Named

### Out of Place Restore Parameters

Parameter | Description | Data type | Accepts pipeline input? | Accepts wildcard characters? | Type of parameter
--- | --- | --- | --- | --- | ---
DestClientName | Client name of the restore destination. | string | No | No | RuntimeDefinedParameterDictionary
DestInstanceName | Instance name of the restore destination. | string | No | No | RuntimeDefinedParameterDictionary
DestDatabaseName | Database name of the restore destination. | string | No | No | RuntimeDefinedParameterDictionary
DataFilePath | Path of the data files for restore operation. | string | No | No | RuntimeDefinedParameterDictionary
LogFilePath | Path of the log files for restore operation. | string | No | No | RuntimeDefinedParameterDictionary

### Microsoft PowerShell Parameters

You can use the following Microsoft PowerShell parameters:

- Debug

- ErrorAction

- ErrorVariable

- OutBuffer

- OutVariable

- PipelineVariable

- Verbose

- WarningAction

- WarningVariable

- Force

- Confirm

- WhatIf

Note

Only a few cmdlets support Force, Confirm, and WhatIf parameters.

For more information, see "About Common Parameters" in the Microsoft PowerShell documentation.

## Input

This cmdlet does not support input.

## Output

A message that indicates whether the restore completed successfully.

## Examples

### Restore a SQL Database In-Place

This example restores the AuditDB SQL database to the same client from which the database was backed up.

    Restore-CVSQLDatabase -Name AuditDB -OverwriteExisting

### Restore a SQL Database Out-Of-Place

This example restores the AuditDB SQL database to a different client.

    Restore-CVSQLDatabase -Name AuditDB -OverwriteExisting -OutofPlace

×

Loading...