Closed koglerk closed 5 years ago
This is because this line is added to the function but the logic itself was not written to handle it.
We should fix the parameter usage as well. This combination should be required -ReplaceExisting -InstallJobs:$false
just to update the objects.
We have an example that shows ReplaceExisting will drop everything, but I don't think this is common practice with Ola's objects and jobs. The deployment script for the jobs is a basic example, and not one I use with any client or system out of the box. I always go and modify that command to what I need it to handle. The main deployment script does not allow for advanced configurations (e.g. you can't deploy using Backup To URL without modifying the backup command in the jobs created).
Shoot when I want to go update to the latest version of the code I just go to GitHub and pull the procedures and just run those scripts to update the objects.
So with all that, I'd say -ReplaceExisting
should only do the procedures by default; then tie Force
to also replacing the jobs. // @potatoqualitee
@wsmelton I looked into your comments. I am not sure how to implement that without making it overly complex.
InstallJobs already has a default of false.
This is already implemented, but with the parameter -InstallJobs instead of -Force. So, if -ReplaceExisting is used, only the database objects (stored procedures and a table) are dropped and created. If -ReplaceExisting and -InstallJobs are used in combination, the jobs are also dropped and created again.
-Force has already a different meaning and changing that would be complicated.
An issue that I would have a problem with is that it is not possible to just update the stored procedures without dropping/creating the table:
I can address it at a later time if @potatoqualitee would like the adjustment to be implemented.
Before submitting a bug report:
powershell -NoProfile
)Steps to Reproduce
Running this code against the database where I have installed Ola Hallengren's Maintenance Solution:
Shows that the Ola stored procedures associated were created at 2:38PM:
Then I run this to reinstall the sprocs (but not the agent jobs), but I specify
-WhatIf
to see what'll happen:And the output sure looks like it made changes.
Let's confirm that changes were made by running the same
Find-DbaStoredProcedure
again:Sure enough, the create date has changed from 2:38PM to 2:42PM. It dropped and recreated these sprocs even though
-WhatIf
was used.Expected Behavior
Using
-WhatIf
should not make any permanent changes.Actual Behavior
Stored procedures are dropped and recreated.
Environmental data
PowerShell:
SQL Server:
Microsoft SQL Server 2016 (SP2-CU2) (KB4340355) - 13.0.5153.0 (X64) (Build 9600: ) (Hypervisor)
Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3