There are many tools that DBA can use. For SQL Server, there are query analyzers, event probes, and command line tools. Among them, SQL statements are the top priority, however, the appearance of powershell makes DBA have another option.
SQL Server 2008 introduces support for Windows powershell. Windows powershell is a powerful script shell that allows administrators and developers to automatically execute server management and applications.ProgramDeployment. Compared with Transact-SQL scripts, Windows powershell supports more complex logic, which enables SQL server administrators to generate powerful management scripts. Windows powershell scripts can also be used to manage other Microsoft Server products, which provides administrators with a cross-server public scripting language.
SQL Server provides two windows powershell management units for the following:
- An SQL Server Provider (a simple navigation mechanism similar to a file system path is allowed ). You can generate a path similar to the file system path. In the path, the drive is associated with the SQL Server Management object model, and the node is based on the object model class. Then, you can use commands that you are familiar with (suchCDAndDirIn the Command Prompt window. You can use other commands (suchRenOrDel.
- A set of cmdlet (they are used in Windows powershell scripts to specify SQL server operations ). The SQL Server cmdlet supports various operations, such as running statements that contain Transact-SQL or XQuery statements.SqlcmdScript.
SQL Server powershell extension (sqlpsx) 2.3 on codeplex recently released Version 2.3, which uses the installation package created by Wix, which is also a good example of learning Wix toolkit. For how to use powershell commands of SQL Server, refer toArticle:
Http://www.cnblogs.com/brooks-dotnet/archive/2010/10/11/1848282.html
Http://www.cnblogs.com/brooks-dotnet/archive/2010/10/13/1850621.html