Data Backup and Recovery

Trouble using powershell new-smclone

mbros_bfischer
4,896 Views

I'm having trouble trying to get a clone to work from powershell. We have a nightly backup that occurs, and I just want to use that to create a clone of one of the databases, or all, doesn't matter at this point to another host.  Right now the command looks like this:

 

PS C:\computer> New-SmClone -BackupName "SQL Nightly Backup 10-04-2017_22.00.15.0920" -Resources @{"Host"="sql1
6-test.domain.com";"Type"="SQL Database";"Names"="sql16-test\sql16-test"} -AppPluginCode smsql -CloneToInstance "sql16-
test" -Suffix _clone -AutoAssignMountPoint -LogRestoreType None

Which isn't throwing any errors at all in powershell.  But, it's not doing anything either.  It does return the following results:

 

Result : SMCoreContracts.SMResult
TotalCount : 0
DisplayCount : 0
Context :
Job : SMCoreContracts.SmJob
Clones : {}

 

Any help would be greatly appreciated! 

5 REPLIES 5

matte
4,878 Views

Hi, the syntax looks correct and is working for me.

 

1.JPG

and this is the clone in SQL

 

2.JPG

 

Check the monitor tab in the SC gui to see if you can find some errors.

Please check alsto if the database name and the instance name are written properly.

mbros_bfischer
4,861 Views

I think I have everything correct as far as hosts and instance names go.  

 

Your example looks like it is cloning to the original host of the backup, is that correct? I'm attempting to clone to a different host.  I wonder is that part of the problem?

 

For the -Resources flag I'm giving the following as inputs @{"Host"="remote server FQDN";"Type"="SQL Database";"Names"="SQL Instance on remote server"} and for the -CloneToInstance I'm giving it the instance on the remote server.

 

Shouldn't I have to sepcify which database from the backup I'm looking to restore?  Or does it by default try to do the whole instance?

 

Thanks in advance,

Ben

matte
4,777 Views

Looks like your syntax is correct..

but in yuor case, does the clone job start? do you see the job and all its related errors in the monitor tab? that can help to understand the problem..

akhil393
4,686 Views

Hi 

 

Syntax looks correct but I would look at the job report to see the output, when you run the new-smclone it qeues the job so wouldn't know the result right way you need to look at the report. 

 

 

 

--Run Clone command 

$clonejob = New-SmClone -CloneLastBackup 0 -Resources @{"host"="Server";"Type"="SQL Database";"
Names"="DBSERVER\DatabaseName"} -AppPluginCode SMSQL -CloneToInstance "CloneServer" -AssignMountPointUnderPath "C:\SQLmntp
nt"

--Get Clone output 

Get-SmJobSummaryReport -JobId $clonejob.Job.ID

 

mbros_bfischer
4,667 Views

Here's what I get back after executing the clone, and then monitoring it. Obviously changing the variables to the correct server, database, and instance names. 

 


SmJobId : 2587
JobCreatedDateTime :
JobStartDateTime : 10/16/2017 12:34:35 PM
JobEndDateTime : 10/16/2017 12:34:42 PM
JobDuration : 00:00:06.2816300
JobName : Clone life cycle of Resource Group '' with policy ''
JobDescription :
Status : Failed
IsScheduled : False
JobError : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
JobType : CloneLifeCycle
PolicyName :

Public