December 29, 2015 at 5:10 am
I am getting the below error when trying to execute the Posh
Set-Location : A parameter cannot be found that matches parameter name 'DBName'.
I am using below script on PS v2.0
Automate\TEST\Restore\ps_RestoreGene.ps1 `
-DBName = "BaselineData" `
-PrimaryServer = "ABC" `
-StandbyServer = "DEF" `
-FromFileFullUNC = "\\ABC\Prod_Backups\ABC\BaselineData\FULL\" `
-WithMoveDataFiles = "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA" `
-WithMoveDataFiles = "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA" `
-RestoreLog = "C:\Automate\Log_PBV001_PBV002_workspace.xml" `
-WithReplace = "1" `
-StandBy = "1" `
-Log_Reference = "PoSh Restore TEST"
December 29, 2015 at 5:29 am
Withmovedatafiles appears twice, also needs to terminate with '\'
Regards
December 29, 2015 at 6:43 am
Sorry my bad, i copied it wrong, made the modifications, replaced withmovedatafiles to withmoveLogfiles and ended with \ for the path but still same error:
Set-Location : A parameter cannot be found that matches parameter name 'DBName'.
At line:2 char:1
+ -DBName = "BaselineData" `
+ ~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Location], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
December 29, 2015 at 6:57 am
Could you try version 4 (the latest) https://paulbrewer.wordpress.com/ps_restoregene/
Thanks
December 29, 2015 at 7:18 am
hey paul,
Thanks for the replies, yes i am using the latest version but still same error. May be i am not that good or doing something wrong with Powershell.
Is there any doc on how to run this,
I just went to PS and executed below , but no luck
PS C:\> cd \Automate\TEST\Restore\ps_RestoreGene.ps1 `
>> -DBName "BaselineData" `
>> -PrimaryServer "ABC" `
>> -StandbyServer "DEF" `
>> -FromFileFullUNC "\\ABC\Prod_Backups\ABC\BaselineData\FULL\" `
>> -WithMoveDataFiles "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\" `
>> -WithMoveLogFiles "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\" `
>> -RestoreLog "C:\Automate\Log_PBV001_PBV002_workspace.xml" `
>> -WithReplace "1" `
>> -StandBy "1" `
>> -Log_Reference "PoSh Restore TEST"
Also, i am running this from secondary and have executed sp_restoregene on primary server
December 29, 2015 at 7:37 am
Hi,
There is some documentation here - https://paulbrewer.wordpress.com/2014/08/15/restore-gene-version-3-free-public-framework-technical-article/
Which version of powershell are you using?
Thanks
December 29, 2015 at 9:25 am
Thanks for the doc, its V2.0
December 29, 2015 at 1:17 pm
Hi Paul,
Any idea what could be going wrong here, Will it not work for V 2.0 PS?
December 29, 2015 at 3:34 pm
It should do, I'm not sure to be honest and need to retest. The most recent version was developed on Windows server 2012, PS V3. The error might be a parameter name changing in a cmdlet. I won't get a chance to look at it before the weekend though, sorry
January 8, 2016 at 6:57 am
Hey, Paul i was able to figure out what went wrong and ran the script, but after its run no restore happen with below message:
database on primary is in Simple recovery model, but i believe full backup should have at least been restored?
RestoreGene Batch Execution Starting
-----------------------------------------
Executing SQL Command - + EXEC dbo.sp_RestoreGene @LogShippingVariableDeclare = 0, @Database = 'BaselineData',@Log_Refe
rence = 'PoSh Restore TEST', @TargetDatabase = 'BaselineData',@WithMoveDataFiles = 'C:\Program Files\Microsoft SQL Serve
r\MSSQL11.MSSQLSERVER\MSSQL\DATA\', @WithMoveLogFile = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLDATA\', @FromFileFullUNC = '\\XXX\Prod_Backups\CXP\BaselineData\FULL\', @FromFileDiffUNC = '\\XXX\Prod_Backups\CXP\BaselineData\FULL\', @FromFileLogUNC= '\\XXX\Prod_Backups\CXP\BaselineData\FU
LL\', @StopAt = '2016-01-08T08:48:57', @StandbyMode = '1', @WithReplace = '1' , @WithRecovery = '0', @WithCHECKDB = '0'
-----------------------------------------
No new log file backups
Strange because after this i dont see anything being executed: (XXX is primary server and its backup folder is shared)
January 8, 2016 at 7:23 am
That's good news, pleased you got to the bottom of it. I'll add an error trap to the posh script on the next release. To be honest it wasn't a scenario I anticipated.
Best wishes
Paul
January 8, 2016 at 7:28 am
But Paul,
Actually it ran but its not restoring, it just shows me the above posted message and no restore happens.
What Am i missing now, even i put the database to full recovery model still no luck
January 8, 2016 at 7:37 am
After putting the database in full recovery, did you take a full and a log backup?
January 8, 2016 at 7:39 am
Yup, that was the first thing i did..
Just curious, for very first run i provided the parameter -LogShippingInitialize "1" as "0"..
Could that be a problem, do i need to first initialze and then can later make it 0?
January 8, 2016 at 7:40 am
Adding ----- For server XXX primary it displays below info followed by the message i posted:
Name : LogData
LocalName : LogData
NamespaceURI :
Prefix :
NodeType : Element
ParentNode : #document
OwnerDocument : #document
IsEmpty : True
Attributes : {}
HasAttributes : False
SchemaInfo : System.Xml.XmlName
InnerXml :
InnerText :
NextSibling :
PreviousSibling :
Value :
ChildNodes : {}
FirstChild :
LastChild :
HasChildNodes : False
IsReadOnly : False
OuterXml : <LogData />
BaseURI :
Viewing 15 posts - 16 through 30 (of 35 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy