Subscribe

SMSQL delete-clone powershell command not working "Database Name specified is not valid"

[ Edited ]

I'm trying to automate cloning our databases into our different development environments with powershell. I can create the database clone with the clone-database command, but when I try to delete it with this command:

delete-clone -Server PER-0-SQL08-INF\SQL2008INF -Database InfusionImport -ServerInstance STG-0-DB0-B\LOCAL

I get this output:

Initializing [delete-clone]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [processing]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [completed]

Retrieving SnapManager Configuration Information: [processing]

Retrieving SnapManager Configuration Information: [completed]

Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that you wish to de

lete.

An Error occured while deleting the Database clone.Please check the SnapManager Reports/Windows EventLogs for more informat

ion.

Details:The pipeline has been stopped.

delete-clone : Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that

you wish to delete.

At line:1 char:13

+ delete-clone <<<<  -Server PER-0-SQL08-INF\SQL2008INF -Database InfusionImport -ServerInstance STG-0-DB0-B\LOCAL

    + CategoryInfo          : InvalidArgument: (SMSQLPSSnapIn.SMSQLPSDeleteClone:SMSQLPSDeleteClone) [delete-clone], Excep

   tion

    + FullyQualifiedErrorId : [Invalid Database Name],SMSQLPSSnapIn.SMSQLPSDeleteClone

The InfusionImport is defiantly valid on the  PER-0-SQL08-INF\SQL2008INF SQL instance.

I can't find anything in the Windows Event logs. Any ideas why this may be happening?

Also, why is it necessary to give the source server in the -ServerInstance option?

Re: SMSQL delete-clone powershell command not working "Database Name specified is not valid"

The database name need to be either single quote or double quote.

Here is the example: delete-clone -Server SQL2012HADR3 -database 'AdventureWorks'

Re: SMSQL delete-clone powershell command not working "Database Name specified is not valid"

Sorry, that didn't help either.

PS D:\Scripts> delete-clone -Server PER-0-SQL08-INF\SQL2008INF -Database 'InfusionImport' -ServerInstance STG-0-DB0-B\LOCAL

Initializing [delete-clone]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [processing]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [completed]

Retrieving SnapManager Configuration Information: [processing]

Retrieving SnapManager Configuration Information: [completed]

Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that you wish to de

lete.

An Error occured while deleting the Database clone.Please check the SnapManager Reports/Windows EventLogs for more informat

ion.

Details:The pipeline has been stopped.

delete-clone : Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that

you wish to delete.

At line:1 char:13

+ delete-clone <<<<  -Server PER-0-SQL08-INF\SQL2008INF -Database 'InfusionImport' -ServerInstance STG-0-DB0-B\LOCAL

    + CategoryInfo          : InvalidArgument: (SMSQLPSSnapIn.SMSQLPSDeleteClone:SMSQLPSDeleteClone) [delete-clone], Excep

   tion

    + FullyQualifiedErrorId : [Invalid Database Name],SMSQLPSSnapIn.SMSQLPSDeleteClone

PS D:\Scripts> delete-clone -Server PER-0-SQL08-INF\SQL2008INF -Database "InfusionImport" -ServerInstance STG-0-DB0-B\LOCAL

Initializing [delete-clone]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [processing]

Connecting to server: [PER-0-SQL08-INF\SQL2008INF] [completed]

Retrieving SnapManager Configuration Information: [processing]

Retrieving SnapManager Configuration Information: [completed]

Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that you wish to de

lete.

An Error occured while deleting the Database clone.Please check the SnapManager Reports/Windows EventLogs for more informat

ion.

Details:The pipeline has been stopped.

delete-clone : Database Name specified InfusionImport is not valid. Please specify a valid name for the Database clone that

you wish to delete.

At line:1 char:13

+ delete-clone <<<<  -Server PER-0-SQL08-INF\SQL2008INF -Database "InfusionImport" -ServerInstance STG-0-DB0-B\LOCAL

    + CategoryInfo          : InvalidArgument: (SMSQLPSSnapIn.SMSQLPSDeleteClone:SMSQLPSDeleteClone) [delete-clone], Excep

   tion

    + FullyQualifiedErrorId : [Invalid Database Name],SMSQLPSSnapIn.SMSQLPSDeleteClone

Re: SMSQL delete-clone powershell command not working "Database Name specified is not valid"

Ok from the picture you sent.  Isn't the syntax should be as follows:

delete-clone -Server PER-0-SQL08-INF -ServerInstance PER-0-SQL08-INF\SQL2008INF -Database 'InfusionImport'

Re: SMSQL delete-clone powershell command not working "Database Name specified is not valid"

Thank you so much, that worked. I thought I had tried that combination before.

According to the documentation -ServerInstance is for the Source of the backup. I cloned the database from STG-0-DB0-B\LOCAL to PERF-0-SQL08-INF\SQL2008INF. The documentation isn't very clear.

From the SnapManager® 5.1 for Microsoft® SQL Server® Installation and Administration Guide

"-ServerInstance (String Parameter): This parameter specifies the SQL

server instance where the database is backed up originally. SnapManager takes

the local computer name as the default server instance.

If multiple databases reside on the same LUN but are owned by different SQL

server instances when you backed them up originally, use the following format:

-Inst "SQLServerInstance1","SQLServerInstance2"

The first database specified in the -Database parameter refers the first server

instance in the -ServerInstance parameter, the second database in the -Database

parameter refers to the second server instance in the -ServerInstance parameter

and so on."