使用powershell连接mssql的相关操作记录

Sqlserver安全篇之_启用TLS即配置SQL Server 数据库引擎以加密连接 Sql Server Configuration Manager–>SQL Server Network Configuration–>Right-click Protocols for MSSQLSERVER–>Properties–>Certificate–>Import,导入一个证书G:\Share\TLS\star.pan.com.pem的时候出现问题,本机的域名是daidbrestore1.dai.com,导入的的证书的dns是*.pan.com。Sqlserver导入一个外部的域名的证书。 阅读详情

使用powershell连接mssql的相关操作记录

input params

假设我们需要执行的脚本是a.ps1,我们可以进入到对应目录下,在powershell中执行.\a.ps1的命令,其中定义参数代码示例如下:

param( [Parameter(Mandatory=$true)] $localHostName,
              $Account="root",$password="123456789")

写在开头,其中Mandatory=$true修饰的参数是必须传入的,其他不传参的情况下使用默认参数。

logFile

定义logFile文件路径:

$logFile = "C:\config.log"
Start-Transcript -path $LogFile -Force -Append –NoClobber(防止被覆盖)
......
Write-Output ('-- log1;')
......
Write-Output ('-- log2;')
......
stop-transcript

连接与执行

连接函数;事务执行;非事务执行;

Function GetSqlConnection([string]$ServerName){
  IF ([string]::IsNullOrWhitespace($ServerName)){
    $ServerName = [System.Net.Dns]::GetHostName()
  }
  [string]$ConnectionString = "Data Source=$ServerName;Initial Catalog=$Database;user id=$userName;pwd=$password"
  try{
    $SqlConnection = New-Object System.Data.SqlClient.SqlConnection $ConnectionString
    $SqlConnection.Open()
    Write-Host 'Connected to sql server success.'
    return $SqlConnection
  }
  catch{
    Write-Warning ('Connect to database failed with error message:{0}' -f,$_) | WriteLog
    $SqlConnection.Dispose()
    return $null
  }
}

function Execute-SqlCommandNonQuery
{
    param
    (
    [System.Data.SqlClient.SqlConnection]$SqlConnection,
    [string]$Command
    )
    $cmd = $SqlConnection.CreateCommand()
    try
    {
        $cmd.CommandText = $Command
        $cmd.ExecuteNonQuery() | Out-Null
        return $true
    }
    catch [Exception] {
         Write-Warning ('Execute Sql command failed with error message:{0}' -f $_)
         return $false
    }
    finally{
        $SqlConnection.Close()
    }
}

function Execute-SqlCommandsNonQueryWithTran
{
    param
    (
    [System.Data.SqlClient.SqlConnection]$SqlConnection,
    [string[]]$Commands
    )
    $transaction = $SqlConnection.BeginTransaction()
    $command = $SqlConnection.CreateCommand()
    $command.Transaction = $transaction
    try
    {
        foreach($cmd in $Commands) {
            #Write-Host  $cmd -ForegroundColor Blue
            $command.CommandText = $cmd
            $command.ExecuteNonQuery()
        }
        $transaction.Commit()
        return $true
    }
    catch [Exception] {
         $transaction.Rollback()
         Write-Warning ('Execute Sql commands failed with error message:{0}' -f $_)
         return $false
    }
    finally{
        $SqlConnection.Close()
    }
}

T-SQL执行示例:

 $tSqls=@("CREATE database dba;"
                    ,-Join("CREATE database ",${dbName})
        $conn=GetSqlConnection $dbName
        Execute-SqlCommandsNonQuery  $conn $tSqls

多线程执行

foreach ($computer in $computers)
{
    $ScriptBlock = {
        Param (
            [string] [Parameter(Mandatory=$true)] $svrInstance
        )
        enable-SqlAlwaysOn -ServerInstance $svrInstance  -Force
    }
    Start-Job -Name "enablealwayson---$computer" $ScriptBlock -ArgumentList $computer
}
#While loop that will wait until the remaining jobs are finished
for($c=0; $c -lt $computers.Length * 20;) {
    if ($(Get-Job -State Completed | Where-Object {$_.Name.Contains("enablealwayson")}).Count -eq $computers.Length){
        Remove-job -State Completed
        break
    }
     $c++
    Start-Sleep –s 3
     if ($c-eq $computers.Length * 20){
         throw "error"
     }
}

有关powershell多线程执行的操作,可以参考这篇文章:https://www.cnblogs.com/zqj-blog/p/10120743.html

windows自带powershell 连接mssql sqlserver windows自带powershell 连接mssql sqlserver 无需安装客户端。 自行修改IP、端口、账号、密码 使用命令:powershell -ExecutionPolicy unrestricted -File SqlserverQuery.ps1 立即下载

相关推荐

RK3588开发板实战:从零开始移植Ubuntu 24.04(讯为SDK版)

本文详细介绍了如何在RK3588开发板上从零开始移植Ubuntu 24.04系统(讯为SDK版),涵盖开发环境准备、SDK解析、根文件系统定制、驱动适配、系统集成与烧录等全流程。通过实战案例,帮助开发者快速掌握RK3588开发板的系统移植技巧,适用于嵌入式开发与定制化Linux系统构建。

sand8的博客 436

PowerShell 数据库MSSQL MYSQL操作简易示例代码

MSSQL封装模块 $conn function open{ param($db,$server,$usr,$passwd) $global:conn=New-Object System.Data.SqlClient.SqlConnection $global:conn.ConnectionString="Data Source=$server;Initial Catalog=$db;user id=$usr;pwd=$passwd" $global:conn.

LegendHonor的博客 533

PowerShell连接sqlserver数据库

有朋友问过我, 学习脚本语言对开发人员有什么用处, 还有一些开发人员看不起使用脚本的技术人员. 这让我想起了曹丕说过的"文人相轻", 如果不明白这句话请自己baidu一下. 有时候我们需要对一些文件进行替换操作, 查找一些特殊的关键字, 编写DailyBuild脚本(每日构建), Makef...

cihe6308的博客 793

用户视角下的vfsglobal预约困境:从注册到登录的全流程避坑指南

本文详细解析了vfsglobal签证预约系统从注册到登录的全流程操作,帮助用户避开常见技术陷阱。针对IP限制、DNS解析、浏览器缓存等登录障碍提供实用解决方案,并揭示账号管理的隐藏规则与支付环节的延时处理技巧,助力用户高效完成签证预约。

ol78901234的博客 871

C语言实战:高效端口扫描器的多线程优化与性能对比

本文详细介绍了使用C语言开发高效端口扫描器的多线程优化技术,包括TCP全连接扫描、SYN半连接扫描和FIN扫描的实现原理。通过线程池、I/O复用技术和性能优化策略,显著提升扫描效率,并与Nmap进行性能对比。文章还涵盖了常见问题解决方案及安全伦理注意事项,为开发者提供全面的实战指导。

ol789012的博客 134

powershell连接sqlserver

0.如何处理一个bug 或者 解决一个问题 step1: 查阅资料 请动用你的大脑将资料整合, 具体到代码里就是筛选出合适的解决方案 总的来说,遇到任何问题,现在大脑里面过滤一下,别一根筋一样往前冲 step2:实验代码 代码一定会报错,那么根据代码报错的顺序,按照顺序解决代码 step3: 获得成就感 1. powershell 连接 sqlserver 1.1 连接代码格式 #配置信息 $Da...

刘同学的博客 2374

10、边缘智能学习技术解析

本文深入解析了边缘智能学习技术的四大核心方法:联邦学习、DNN拆分、迁移学习和八卦学习。文章从人类大脑的学习机制出发,引出边缘级智能的重要性,并详细阐述各类技术的架构、优势、挑战及适用场景。通过对比分析,展示了不同技术在隐私性、效率、可扩展性等方面的特性,并探讨了未来融合多种技术、软硬件协同优化及应用领域拓展的发展趋势,为边缘智能在物联网与人工智能领域的应用提供了系统性参考。

ppp33的博客 117

powershell连接数据库_PowerShell连接SQL SERVER数据库进行操作的实现代码

核心代码#配置信息$Database= 'DemoDB'$Server= '"WIN-AHAU9NO5R6U\DOG"'$UserName= 'kk'$Password= '123456'#创建连接对象$SqlConn = New-Object System.Data.SqlClient.SqlConnection#使用账号连接MSSQL$SqlConn.ConnectionString = "D...

weixin_42515376的博客 836

Mac版 Android Studio自带模拟器无法联网解决方案

前言 作为一枚安卓开发者,免不了使用模拟器来开发调试(毕竟它比手机方便太多)。但是因为适配需要,我们会更多的使用真机开发调试,那么当模拟器遇到这样那样的问题,我们往往会无从下手,其中最烦的就是网络问题。 我最近图方便,又重新用起了模拟器,但是发现联网失败,用模拟器内置的浏览器也打不开网页,于是百度上一通找,毫无效果,各种说用cmd命令行设置模拟器dns的都没用,显示没有什么dns文件啥的,后来...

陈万洲的专栏 1万+

【报错】open /var/lib/docker/tmp/docker-import-863402796/bin/json: no such file or directory

然后,通过docker images可以看到镜像已经加载进来了。然后,通过docker images可以看到镜像已经加载进来了。

静谧、淡雅 6222

PowerShell查询sql server

function Invoke-SQL1: function Invoke-SQL { param( [string] $DBServer, [string] $Database, [string] $SQLCMD ) $connectionString = "Data Source=$DBServe...

weixin_34245082的博客 234

基于STM32L4XX、HAL库的BQ25713RSNR充电芯片驱动程序设计

define BQ25713_I2C_ADDR (0x6B << 1) // 7位地址为 0x6B,HAL库需要左移一位。// 示例:配置 CHARGE_OPTION_0 寄存器:使能充电,使能 ICO(输入电流优化)reg_data |= (EN_CHG_MASK | EN_ICO_MASK);

zhusl6688的博客 406

MSSQL数据导入导出Excel的相关代码

MSSQL数据导入导出Excel的相关代码 参考:https://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926 1 Export data to existing EXCEL file from SQL Server table insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', ...

tlammon的专栏 831

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

PowerShell 内网不能直接安装SqlServer模块的处理办法

PowerShell 内网不能直接安装SqlServer模块的处理办法。

par@ish的博客 1622

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

SMB+MSSQL

常规nmap扫描目标IP,得到有哪些端口号开放以及哪些服务,可以看到SMB协议的1433端口号开放,伴随着还有MySQL的服务。 利用SMB中的smbclient工具远程连接并枚举: smbclient -N -L \\\\{TARGET_IP}\\ #-N:no password ,-L:查找的服务在服务器端是是可适用的。 针对出现的一组share,经过试验,ADMIN$和C$并不能被访问,因为只能访问backups目录, 根据下述命令枚举backups: smbcli...

m0_56010012的博客 3740

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

最新域环境MSSQL的枚举和认证技术

点击星标,即时接收最新推文本文选自《内网安全攻防:红队之路》扫描二维码五折购书域环境MSSQL枚举在渗透测试过程,如果我们获取了一个普通域用户权限,或者针对域环境执行假定入侵渗透测试,我们通常需要枚举域环境是否集成了MS SQL数据库,并测试是否存在漏洞或者误配置可以利用进行权限提升。传统的方法是使用nmap之类的工具扫描开放的1433端口来定位MSSQL数据库服务器,但是一些数据库实例可能配置运...

Ms08067安全实验室 897

Powershell 渗透测试(一)

本节介绍了渗透测试的基本元素,并介绍了 PowerShell 作为跨平台脚本引擎以及 PowerShell 脚本编写的基本原则。还展示了如何在多个异构平台上安装并使用 JSON、XML 模块/函数。在这个模块中,您将进行一系列简单的脚本编写练习,以帮助您理解如何使用/应用 PowerShell。在本书中,我们将使用 PowerShell 7。本部分包含以下章节:第一章渗透测试简介第二章PowerShell 中的编程原则本章解释了什么是渗透测试及其各个组成部分。

龙哥盟 1583

MSSQL/WMI/PowerShell结合篇(一)简介

本文主要介绍Windows的WMI与PowerShell实现实时告警,如若觉得麻烦,可用MSSQL的WMI alerts,相对更为简单。为什么考虑MSSQL与WMI、PowerShell三者结合?它们可以做什么? WMI/PowerShell都是Windows的插件及功能,用它们来实现MSSQL监控、自动化作业等等,无疑是最简单方便的。为什么不考虑用监控工具?...

weixin_34203426的博客 262

Windows11安装sqlserver2012失败后解决方案

无法使用文件 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\mastlog.ldf',因为最初格式化此文件时所用扇区大小为 4096,而目前所在卷的扇区大小为 32768。EnableLog]7.恭喜你,sqlserver总算卸载干净,同时安装环境已经弄好了。6.重启电脑,完成后 右键管理员模式运行PowerShell,输入命令,检查扇区是否已经更改回来;,检查这两个参数是不是4096,如果不是,则需要去更改;

经历过大厂、小厂风风雨雨的程序佬 9905

PowerShell连接 SQL Server 2005

[学习PowerShell可以做什么][1][连接 SQL Server 2005] 收藏 有朋友问过我, 学习脚本语言对开发人员有什么用处, 还有一些开发人员看不起使用脚本的技术人员. 这让我想起了曹丕说过的"文人相轻",...

cm333666的博客 168

无需插件就能实现异构数据库的互联互通?(powershell妙用)

看了一下自己的powershell脚本记录,十几年前就曾经使用powershell来做oracle的一些例如tablespace的监控,partition table的监控,做的更多的是一些本地文件和数据库直接的交互,在这个方面powershell拥有得天独厚的优势,比如抓取某个目录下的所有文件名,插入到数据库中 等等;虽然这种方式并不太适合大数据量的交互和迁移,但是在一些无需大数据量的应用场景下,还是很有用的,比如设置个定时任务就可以将oracle数据库中的数据,

xiaofan23z的专栏 1369

33. PowerShell -- SQL Server的使用

PowerShell -- SQL Server的使用 (1)一、概述  SQL Server 2012 提供了一个名为 sqlps 的 Windows PowerShell 模块,该模块用于将 SQL Server 组件导入到 Windows PowerShell 2.0 环境或脚本中。sqlps 模块提供一组 SQL Server cmdlet ,支持各种操作,如运行...

weixin_34400525的博客 695

Powershell语言的数据库编程

PowerShell是由微软推出的一款任务自动化和配置管理框架,它集成了命令行界面和脚本语言,旨在帮助系统管理员和开发者轻松管理Windows环境及其他操作系统的任务。PowerShell的强大在于其面向对象的特性,能处理复杂的数据结构,并通过管道(pipeline)将数据流畅地传递。数据库是一个有组织的数据集合,通常是以表格的形式存储。每个表由行(记录)和列(字段)构成,支持对数据的增、删、查、改等操作。

2501_90383755的博客 932

使用PowerShell最后执行SQL Server代理作业监视

作者: Alejandro Cobar | 更新日期:2020-07-27 | 评论 | 相关: 1 | 2 | 3 | 4 | 5 | 6 | 更多 > 监控 (By: Alejandro Cobar | Updated: 2020-07-27 | Comments | Related: 1 | 2 | 3 | 4 | 5 | 6 | More > Moni...

cule6339的博客 387

MSSQL/WMI/PowerShell结合篇(五)SQL Server镜像状态变化实时告警

本文介绍SQL Server镜像状态变化实时告警,利用WMI Monitor实时监控镜像状态,在状态发生变化时捕获相关信息,通过PowerShell发送微信信息,以达到实时告警的目的。1、创建WMI监控DATABASE_MIRRORING_STATE_CHANGE为镜像状态变化信息表,通过WQL语句可以获取相关镜像状态变化详细信息,参考《MSSQL/WMI/P...

weixin_34372728的博客 162
上一篇: springboot中本地测试相关,开启jsp页面热部署
下一篇: 比较全乎的ArrayList和LinkedList的区别
code_feien
博客等级 码龄7年 71粉丝 85原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值