zoukankan      html  css  js  c++  java
  • 通过sqlserver用户操作远程服务器



    USE master
    GO
    RECONFIGURE --先执行一次刷新,处理上次的配置
    GO
    EXEC sp_configure 'show advanced options',1 --启用xp_cmdshell的高级配置
    GO
    RECONFIGURE --刷新配置
    GO
    EXEC sp_configure 'xp_cmdshell',1 --打开xp_cmdshell,可以调用SQL系统之外的命令
    GO
    RECONFIGURE
    GO
    --使用xp_cmdshell在D盘创建一个myfile 文件夹
    EXEC xp_cmdshell 'd: dir',no_output --[no_output]表示是否输出信息
    GO

    EXEC xp_cmdshell 'shutdown -r now',no_output --[no_output]表示是否输出信息
    EXEC xp_cmdshell 'shutdown -r -m \127.0.0.1 -t 0 -f'

    --关闭
    EXEC sp_configure 'show advanced options','1' --确保show advances options 的值为1,这样才可以执行xp_cmdshell为0的操作
    GO
    RECONFIGURE
    GO
    EXEC sp_configure 'xp_cmdshell',0 --关闭xp_cmdshell
    GO
    RECONFIGURE
    GO
    EXEC sp_configure 'show advanced options','0' --关闭show advanced options
    GO
    RECONFIGURE
    GO
  • 相关阅读:
    kubernetes_mk_lgg_
    kubernetes_tb宝满
    hcna
    kubernetes_book
    ipset和iptables配合来自动封闭和解封有问题的IP
    microk8s
    iptables
    docker kubernetes Swarm容器编排k8s CICD部署 麦兜
    scala Actor Akka
    数据库——mysql数据类型2
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/11283129.html
Copyright © 2011-2022 走看看