单用户模式连接以及故障排除
场景 :这是一个命名实例,使用动态端口,需要进入单用户模式进行维护。 一、启动实例 我们将直接使用命令行窗口启动单用户模式。 1. 找到 sqlservr.exe 的路径 在Windows的“服务”中找到这个命名实例,查出“可执行文件的路径”。例如: "C:\Program Files
场景:这是一个命名实例,使用动态端口,需要进入单用户模式进行维护。
一、启动实例
我们将直接使用命令行窗口启动单用户模式。
1. 找到 sqlservr.exe 的路径
在Windows的“服务”中找到这个命名实例,查出“可执行文件的路径”。例如:
"C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\Binn\sqlservr.exe" -sSQL2008R2
2. 启动实例
打开一个命令行窗口。将“可执行文件的路径”复制到这个命令行窗口,然后添加“ -m "sqlcmd" ” 参数,指定单用户模式启动而且只有 sqlcmd 可以连接到这个实例。
C:\Users\Administrator> "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\Binn\sqlservr.exe" -sSQL2008R2 -m "sqlcmd" |
启动后,这个窗口将显示一大堆的启动信息。
注意:为了保证启动帐户有足够的权限,建议改为 Local System 启动。请在 SQL Server 配置管理器中修改。
二、确认端口配置
针对 TCP/IP 端口,面临两种选择。一种是统一配置本机所有的 IP 的端口,另一种是单独为本机每个 IP 地址配置端口。
1. 选择1:启用“全部侦听”
在前面的步骤中,在命令行窗口中注意寻找端口信息。例如:
2015-01-07 10:42:49.09 服务器 Server is listening on [ 'any' 2015-01-07 10:42:49.09 服务器 Server is listening on [ 'any' 2015-01-07 10:42:49.10 服务器 Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\SQL2008R2 ]. 2015-01-07 10:42:49.11 服务器 Server local connection provider is ready to accept connection on [ \\.\pipe\MSSQL$SQL2008R2\sql\query ]. 2015-01-07 10:42:49.11 服务器 Server is listening on [ ::1 2015-01-07 10:42:49.11 服务器 Server is listening on [ 127.0.0.1 2015-01-07 10:42:49.12 服务器 Dedicated admin connection support was established for listening locally on port 49163. |
注意:由于每个实例的配置不尽相同,所以不一定都会看到本例完全一样的信息。“Server is listening on [ 'any'
一旦“全部侦听”启用了,那么就只有最底下一栏“IPAll”生效,其它的IP单独的配置都无效!
说明:
(1)“TCP动态端口”如果留空,表示使用静态端口;如果在配置时设置为0,表示使用动态端口。使用动态端口时,在实例启动之后,才会显示当前的端口。每次重启实例都可能换成另一个端口。
(2)如果在“TCP端口”中填写一个固定的数据,同时将“TCP动态端口”留空,那么重启后,实例将使用这个静态端口。对于服务器上的默认实例,默认使用 TCP1433 端口。
2. 选择2:不启用“全部侦听”
下面的信息则显示只侦听127.0.0.1端口。
2015-01-07 11:03:53.76 服务器 Server is listening on [ 127.0.0.1 2015-01-07 11:03:53.77 服务器 Dedicated admin connection support was established for listening locally on port 49168. |
在配置界面,仅针对127.0.0.1这个IP,将“活动”和“已启用”都设为“是”。可以分别为每个IP配置不同的端口以及设置端口的活动状态。
故障排除:
如果本机曾经修改过IP地址,导致在不启用“全部侦听”时会将错误的旧IP地址绑定到该实例,这样会报错并导致启动失败。请参考 《修改 SQL Server 服务器的 IP 地址》 http://jimshu.blog.51cto.com/3171847/1120377
三、客户端连接
由于前面的步骤仅允许使用 SQLCMD 方式连接,所以需要另外打开一个命令行窗口。使用“-S”参数,后面加上IP地址以及端口号(两者之间用逗号隔开)。例如,下面的命令已经成功地建立了连接。
C:\Users\Administrator> sqlcmd -S 127.0.0.1,49163 1> |
连接成功后,即可参考《忘记管理员密码的补救办法》 http://jimshu.blog.51cto.com/3171847/1563207 进行一些维护操作。例如,重设sa的密码。
1> Alter Login [sa] with password='newpassword'; 2> GO |
注:在本例中,我们直接使用端口号。如果使用实例名(127.0.0.1\SQL2008R2),那么还需要启用 SQL Server Browser服务,并为防火墙打开 UDP1434 端口。请参考《SQL Server 客户端连接的问题》 http://jimshu.blog.51cto.com/3171847/1395199
四、停止实例
在启动实例的那个命令行窗口,使用 Ctrl-C 或者 Ctrl-Break 组合键,停止实例。
Do you wish to shutdown SQL Server (Y/N)? y 2015-01-07 11:36:37.76 spid7s SQL Server shutdown due to Ctrl-C or Ctrl-Break signal. This is an informational message only. No user action is required. 2015-01-07 11:36:37.76 spid7s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required. |
甚至,可以直接关闭这个命令行窗口。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

What does WeChat Do Not Disturb mode mean? Nowadays, with the popularity of smartphones and the rapid development of mobile Internet, social media platforms have become an indispensable part of people's daily lives. WeChat is one of the most popular social media platforms in China, and almost everyone has a WeChat account. We can communicate with friends, family, and colleagues in real time through WeChat, share moments in our lives, and understand each other’s current situation. However, in this era, we are also inevitably faced with the problems of information overload and privacy leakage, especially for those who need to focus or

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

Yesterday during the interview, I was asked whether I had done any long-tail related questions, so I thought I would give a brief summary. The long-tail problem of autonomous driving refers to edge cases in autonomous vehicles, that is, possible scenarios with a low probability of occurrence. The perceived long-tail problem is one of the main reasons currently limiting the operational design domain of single-vehicle intelligent autonomous vehicles. The underlying architecture and most technical issues of autonomous driving have been solved, and the remaining 5% of long-tail problems have gradually become the key to restricting the development of autonomous driving. These problems include a variety of fragmented scenarios, extreme situations, and unpredictable human behavior. The "long tail" of edge scenarios in autonomous driving refers to edge cases in autonomous vehicles (AVs). Edge cases are possible scenarios with a low probability of occurrence. these rare events

How to connect the keep body fat scale? Keep has a specially designed body fat scale, but most users do not know how to connect the keep body fat scale. Next is the graphic tutorial on the connection method of the keep body fat scale that the editor brings to users. , interested users come and take a look! How to connect the keep body fat scale 1. First open the keep software, go to the main page, click [My] in the lower right corner, and select [Smart Hardware]; 2. Then on the My Smart Devices page, click the [Add Device] button in the middle; 3 , then select the device you want to add interface, select [Smart Body Fat/Weight Scale]; 4. Then on the device model selection page, click the [keep body fat scale] option; 5. Finally, in the interface shown below, finally [Add Now] at the bottom

sudo (superuser execution) is a key command in Linux and Unix systems that allows ordinary users to run specific commands with root privileges. The function of sudo is mainly reflected in the following aspects: Providing permission control: sudo achieves strict control over system resources and sensitive operations by authorizing users to temporarily obtain superuser permissions. Ordinary users can only obtain temporary privileges through sudo when needed, and do not need to log in as superuser all the time. Improved security: By using sudo, you can avoid using the root account during routine operations. Using the root account for all operations may lead to unexpected system damage, as any mistaken or careless operation will have full permissions. and

What should I do if my Black Shark phone cannot be turned on? Teach you how to save yourself! In our daily lives, mobile phones have become an indispensable part of us. For many people, the Black Shark mobile phone is a beloved gaming phone. But it is inevitable that you will encounter various problems, one of which is that the phone cannot be turned on. When you encounter such a situation, don't panic. Here are some solutions that I hope will help you. First of all, when the Black Shark phone cannot be turned on, first check whether the phone has enough power. It may be that the phone cannot be turned on due to exhausted battery.

Even answering calls in Do Not Disturb mode can be a very annoying experience. As the name suggests, Do Not Disturb mode turns off all incoming call notifications and alerts from emails, messages, etc. You can follow these solution sets to fix it. Fix 1 – Enable Focus Mode Enable focus mode on your phone. Step 1 – Swipe down from the top to access Control Center. Step 2 – Next, enable “Focus Mode” on your phone. Focus Mode enables Do Not Disturb mode on your phone. It won't cause any incoming call alerts to appear on your phone. Fix 2 – Change Focus Mode Settings If there are some issues in the focus mode settings, you should fix them. Step 1 – Open your iPhone settings window. Step 2 – Next, turn on the Focus mode settings
