SQL Server Powershell 常用命令和用法
来源:互联网 发布:傲剑飞龙升级数据大全 编辑:程序博客网 时间:2024/05/01 13:27
SQL Server2008集成了powershell服务,这对于习惯用命令的DBA和DB业内人士来说是一个很好的工具,同时poweshell本身由于其自身的诸多优点,所以掌握好powershell在sql server里面的用法是很有帮助的。
根据作用,SQL server powershell分为两个工具模块: SQL server Powersehll Provider和SQL Server cmdlet. 前者用于对SQLserver进行驱动器式的管理,后者用于运行包含T-SQL或者Xquery语句的sqlcmd脚本。
运行query或者SP:
Invoke-Sqlcmd-Query "SELECT name astablename from lp_royal..sysobjects wherextype='U'"
Invoke-sqlcmd -query"execproduction.get_products_to_reorder" -database adventureworks2008-serverinstance localhost\sql2008 | export-csv -path c:\a.csv
查看和改变执行策略:
Get-ExecutionPolicy Set-ExecutionPolicy cmdlet
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser AllSigned
LocalMachine RemoteSigned
查看驱动器:
get -psdrive
获取帮助:
get-help get-childitem
备份数据库:
backup-sqldatabase
设置路径:
CD、set-location
获取目录:
Get-ChildItem | Select Edition, VersionString
new-item/copy-item/rename-item/move-item/remove-item新建、复制、重命名、移动、删除
服务操作:
start-service/stop-service/restart-service
进程操作
start-process/stop-process/debug-process/wait-process
- SQL Server Powershell 常用命令和用法
- SQL Server 性能基线和监控 (powershell )
- PowerShell在SQL Server 2008中一些用法 [实例]
- powershell connect sql server
- Powershell 操作SQL Server
- Powershell 操作SQL Server
- 使用PowerShell排错----使用PowerShell调校SQL Server性能
- PowerShell 常用命令
- PowerShell 常用命令
- powershell常用命令
- SQL Server 2008 CTP支持PowerShell
- SQL SERVER 2012 SSIS 之 POWERSHELL
- 安装 SQL Server 2008 需要 Windows PowerShell
- 在 PowerShell 中使用 SQL Server
- PowerShell 连接 SQL SERVER 数据库进行操作
- 用PowerShell命令查看SQL Server 进程
- powershell读CSV写入sql server数据库
- SQL Server 使用 Powershell 备份数据库
- P3
- 教大家怎样去除codeIgniter开发的网站url里面的index.php字符串
- const 指针与指向const的指针
- 翻转单词顺序
- 判断网络连接是否正常
- SQL Server Powershell 常用命令和用法
- 单元测试ConfigurationManager.AppSettings 为空的问题
- 学会挑选移动硬盘
- inline函数_内联函数的一些总结
- 安全测试工具
- (总结)CentOS Linux搭建SVN Server配置详解
- VNC“No configured security type is supported by 3.3 viewer“的解决办法!
- Javascript异步编程
- 黑马程序员_毕向东_Java基础视频教程学习笔记(十九)