Skip to content

Commit

Permalink
reduced examples
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Dec 1, 2017
1 parent 68e6e88 commit 7e97226
Showing 1 changed file with 9 additions and 72 deletions.
81 changes: 9 additions & 72 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ $old = $instance = "localhost"
$allservers = $old, $new
# Alternatively, use Registerd Servers?
Get-DbaRegisteredServer -SqlInstance $instance | Out-GridView
# Quick overview of commands
Start-Process https://dbatools.io/commands
$allservers = Get-DbaRegisteredServer -SqlInstance $instance
# Need to restore a database? It can be as simple as this:
Restore-DbaDatabase -SqlInstance $instance -Path "C:\temp\AdventureWorks2012-Full Database Backup.bak"
# But what if the database already exists? You'll be warned to add -WithReplace
Restore-DbaDatabase -SqlInstance $instance -Path "C:\temp\AdventureWorks2012-Full Database Backup.bak" -WithReplace
# Use Ola Hallengren's backup script? We can restore an *ENTIRE INSTNACE* with just one line
Get-ChildItem -Directory \\workstation\backups\sql2012 | Restore-DbaDatabase -SqlInstance $new
Expand Down Expand Up @@ -112,63 +106,30 @@ $allservers | Get-DbaSqlBuildReference
# We evaluated 37,545 SQL Server stored procedures on 9 servers in 8.67 seconds!
$new | Find-DbaStoredProcedure -Pattern dbatools
# Check out the differences when you use Select *
$new | Find-DbaStoredProcedure -Pattern dbatools | Select * | Out-GridView
# Here's how you can search for email patterns
$new | Find-DbaStoredProcedure -Pattern '\w+@\w+\.\w+'
# Have an employee who is leaving? Find all of their objects.
$allservers | Find-DbaUserObject -Pattern ad\jdoe | Out-GridView
# Find detached databases, by example
Detach-DbaDatabase -SqlInstance $instance -Database AdventureWorks2012
Find-DbaOrphanedFile -SqlInstance $instance | Out-GridView
# Find it! - JSON file powers command and website search
Find-DbaCommand Backup
Find-DbaCommand -Tag Backup | Out-GridView
# View and change service account
Get-DbaSqlService -ComputerName workstation | Out-GridView
Get-DbaSqlService -ComputerName workstation | Select * | Out-GridView
Get-DbaSqlService -Instance SQL2016 -Type Agent | Update-DbaSqlServiceAccount -Username 'Local system'
# Check out how complete our sp_configure command is
Get-DbaSpConfigure -SqlInstance $new | Out-GridView
Get-DbaSpConfigure -SqlInstance $new -ConfigName XPCmdShellEnabled
# Easily update configuration values
Set-DbaSpConfigure -SqlInstance $new -ConfigName XPCmdShellEnabled -Value $true
# DB Cloning too!
Invoke-DbaDatabaseClone -SqlInstance $new -Database db1 -CloneDatabase db1_clone | Out-GridView
# XEvents - more coming soon, like easy replays on remote servers
# Easy start/stop
Get-DbaXESession -SqlInstance $new
$session = Get-DbaXESession -SqlInstance $new -Session system_health | Stop-DbaXESession
$session | Start-DbaXESession
# Read and watch
# Read and watch XEvents
Get-DbaXEventSession -SqlInstance $new -Session system_health | Read-DbaXEventFile
Get-DbaXEventSession -SqlInstance $new -Session system_health | Read-DbaXEventFile | Select -ExpandProperty Fields | Out-GridView
# Reset-DbaAdmin
Reset-DbaAdmin -SqlInstance $instance -Login sqladmin -Verbose
Get-DbaDatabase -SqlInstance $instance -SqlCredential (Get-Credential sqladmin)
# Configs and enterprise logging
Get-DbaConfig | Out-GridView
Invoke-Item (Get-DbaConfig -FullName path.dbatoolslogpath).Value
Get-DbaConfig -Module tabexpansion
Set-DbaConfig -Name tabexpansion.disable -Value $true
Get-DbatoolsLog | Out-GridView
New-DbatoolsSupportPackage
# sp_whoisactive
Install-DbaWhoIsActive -SqlInstance $instance -Database master
Invoke-DbaWhoIsActive -SqlInstance $instance -ShowOwnSpid -ShowSystemSpids
Expand All @@ -188,10 +149,7 @@ Set-DbaStartupParameter -SqlInstance $instance -SingleUser -WhatIf
Invoke-DbaDatabaseClone -SqlInstance $new -Database dbwithsprocs -CloneDatabase dbwithsprocs_clone
# Schema change and Pester tests
Invoke-Sqlcmd2 -SqlInstance $new -Database tempdb -Query "CREATE TABLE dbatoolsci_schemachange (id int identity)"
Invoke-Sqlcmd2 -SqlInstance $new -Database tempdb -Query "EXEC sp_rename 'dbatoolsci_schemachange', 'dbatoolsci_schemachange_new'"
Get-DbaSchemaChangeHistory -SqlInstance $new -Database tempdb
Invoke-Sqlcmd2 -SqlInstance $new -Database tempdb -Query "DROP TABLE dbatoolsci_schemachange_new"
# Get Db Free Space AND write it to table
Get-DbaDatabaseSpace -SqlInstance $instance | Out-GridView
Expand All @@ -201,10 +159,6 @@ Invoke-Sqlcmd2 -ServerInstance $instance -Database tempdb -Query 'SELECT * FROM
# History
Get-Command -Module dbatools *history*
# More histories
Get-DbaAgentJobHistory -SqlInstance $instance | Out-GridView
Get-DbaBackupHistory -SqlInstance $new | Out-GridView
# Identity usage
Test-DbaIdentityUsage -SqlInstance $instance | Out-GridView
Expand All @@ -214,30 +168,17 @@ $allservers | Test-DbaMaxMemory | Format-Table
$allservers | Test-DbaMaxMemory | Where-Object { $_.SqlMaxMB -gt $_.TotalMB } | Set-DbaMaxMemory -WhatIf
Set-DbaMaxMemory -SqlInstance $instance -MaxMb 1023
# Test recovery models for "pseudo simple"
Test-DbaFullRecoveryModel -SqlInstance $new
Test-DbaFullRecoveryModel -SqlInstance $new | Where { $_.ConfiguredRecoveryModel -ne $_.ActualRecoveryModel }
# Testing sql server linked server connections
Test-DbaLinkedServerConnection -SqlInstance $instance
# See protocols
Get-DbaServerProtocol -ComputerName $instance | Out-GridView
# SQL Modules - View, TableValuedFunction, DefaultConstraint, StoredProcedure, Rule, InlineTableValuedFunction, Trigger, ScalarFunction
Get-DbaSqlModule -SqlInstance $instance | Out-GridView
Get-DbaSqlModule -SqlInstance $instance -ModifiedSince (Get-Date).AddDays(-7) | Select-String -Pattern sp_executesql
# Reads trace files - default trace by default
Read-DbaTraceFile -SqlInstance $instance | Out-GridView
# Get the registry root
Get-DbaSqlRegistryRoot -ComputerName $instance
# don't have remoting access? Explore the filesystem. Uses master.sys.xp_dirtree
Get-DbaFile -SqlInstance $instance
Get-DbaFile -SqlInstance $instance -Depth 3 -Path 'C:\Program Files\Microsoft SQL Server' | Out-GridView
New-DbaSqlDirectory -SqlInstance $instance -Path 'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\test'
# Test your SPNs and see what'd happen if you'd set them
$servers | Test-DbaSpn | Out-GridView
Expand All @@ -247,22 +188,18 @@ $servers | Test-DbaSpn | Out-GridView -PassThru | Set-DbaSpn -WhatIf
Get-DbaDbVirtualLogFile -SqlInstance $new -Database db1
Get-DbaDbVirtualLogFile -SqlInstance $new -Database db1 | Measure-Object
# Out-GridView madness <3
Get-DbaDatabase -SqlInstance $old | Out-GridView -PassThru | Copy-DbaDatabase -Destination $new -BackupRestore -NetworkShare \\workstation\c$\temp -Force
```

## Support

dbatools aims to support as many configurations as possible, including

<ul>
<li>SQL Server 2000 - 2017</li>
<li>Express - Datacenter Edition</li>
<li>Clustered and stand-alone instances</li>
<li>Windows and SQL authentication</li>
<li>Default and named instances</li>
<li>Multiple instances on one server</li>
<li>Auto-populated parameters for command-line completion (think -Database and -Login)</li>
</ul>
* SQL Server 2000 - 2017
* Express - Datacenter Edition
* Clustered and stand-alone instances
* Windows and SQL authentication
* Default and named instances
* Multiple instances on one server
* Auto-populated parameters for command-line completion (think -Database and -Login)

Read more at our website at [dbatools.io](https://dbatools.io)

0 comments on commit 7e97226

Please sign in to comment.