Here's my problem: I have an application which uses sql server express 2005, and it is installed under default sql server express instance, SQLExpress
Under this instance there are several other databases, used by other applications (web based or desktop)
If I need to restore the database, sometimes it works, but sometimes it fails, telling that I need exclusive access to database to do this. I understand that, and of course when I try to restore, the application using the db is closed, but probably it was just closed minutes before so sql server still keeps some connections open, for caching purpose.
And in this case I have two options:
restart the sql server instance -
that's easiest to do from user point
of view(right click on server
connection in Enterprise Manager and
select restart (but worst since this
stops all databases)
Detach my db, attach again then restore (this works because detach
have option to close all
connections). But this is harder to
do (takes more time) since I have to
browse through the folders to find
where db is located to attach back (I
keep all db's in a custom location,
not under default sql server database
location)
My question is, is there any other easier way to do this?
Thanks
In SQL server Management Studio (not sure about Express, I'll check) you can use the Activity Monitor under Management to locate any connections still open to the database. Right-click the connection and choose 'Kill'
This way you can clear any outstanding connections.
[EDIT] I've checked a SQL server Express, and it also contains the Activity Monitor.
Alternatively you can use a script to close all connections. See here for an example.
Related
I've recently started using Azure Data Studio (Formerly SQL Operations Studio) instead of SSMS. I can't see an obvious way to tell which query windows relate to which connections.
Example:
I have 2 DB servers, and each has the same DB
server1.db1
server2.db1
Let's say I connect to both and open a query for each and run it. Then I get confused and cant remember which connection is for window SQLQuery_1 and which is for SQLQuery_2.
I can see at the top of each window that they are connected to the DB "db1", but I don't know if it is for server1 or server2. SSMS show's the server name.
Is there a way to make the server visible for a query window?
As in the comments, it's shown in the bottom right hand side of the screen:
For example, in this picture, you can see I'm connected to the server qebui and the database Sandbox.
I am running an SQL Server 2008 SP2 instance on my work desktop. Recently, after a power outage, I began having issues with the Object Explorer pane (from both local and remote connections). I can query against the databases fine using T-SQL, but if I attempt to initiate any actions using the Object Explorer (Import Data, Update Linked Server, run SQL Agent job), SSMS hangs and I am forced to close the application using Task Manager. Until I reboot the server instance, the Object Explorer will hang indefinitely upon connecting. When it hangs, there doesn't seem to be any unusual network or resource utilization and SSMS.exe does not show the typical "not responding" during a freeze.
The server only hosts data for my own projects, so it isn't anything truly business-critical. As such, downtime is not a real issue. I encounter this hang when accessing the server locally and remotely, so I don't think it's just my SSMS copy. I do have all of the databases backed up, so if necessary I can restore on a new instance (if the issue is corruption), but I wanted to check if anyone had encountered this.
There are three linked servers (2 Oracle, 1 Postgres).
Try executing ssms.exe-log filename and see if you get any more info.
We recently moved a database from MS SQL Server 2000 to MS SQL Server 2008. Everything works as expected with our main .NET client application but we are having problems with a MS Access 2003 application which connects via ODBC. A System DSN is used to make the connection.
When the database was running on SQL Server 2000 the Access application would request a user name and password once when the program was first started. Now, with the database running on SQL Server 2008 a user name and password dialog is requested every time a different table is accessed I believe.
This behavior occurs when using either the user account we have used for years and it also occurs if I use the database system admin account ( I know this is bad practice, it was just a test. )
What do I need to reconfigure to return to the previous, desirable behavior where the user is only authenticated a single time?
You could look at using a "DSN-Less" connection to MS SQL, microsoft provide instructions here: http://support.microsoft.com/kb/892490
The relevant connection string can be found here: http://www.connectionstrings.com/sql-server-2008#p3
All this aside, JMK's question is important, the method above is for if you are having linked tables to the server present in your Access database, however when working with dedicated database server's I always advise using "ADO" connections rather than "DAO" as this will avail better performance (especially if you are running queries)
If it is just queries you need to run then consider either the ADO method or take a look at the "Pass through" queries option, this like ADO will have the server doing the work rather than the local machine and the performance will be greatly improved.
I am attempting to move msdb (SQL Server 2005) by using the instructions here:
http://support.microsoft.com/kb/224071
However, when I start SQL Server in single user mode, I have no way to access the database. I have tried starting sqlcmd from the console (and also for good measure tried starting ssms), but I'm unable to get into any tool to do my work because it says it is in single user mode and only one administrator can be logged in. In the services console I see no other SQL Server related processes running, so what is preventing me from getting in?
Thanks...
Some application is stealing the only connection available. See Starting SQL Server in Single-User Mode for a tip how to prevent that:
When you use the -m option with sqlcmd or Management Studio, you can
limit the connections to a specified client application. For example,
-m"sqlcmd" limits connections to a single connection and that
connection must identify itself as the sqlcmd client program. Use this
option when you are starting SQL Server in single-user mode and an
unknown client application is taking the only available connection. To
connect through the Query Editor in Management Studio, use
-m"Microsoft SQL Server Management Studio - Query".
We have a Windows VPS server using SQL Server 2005 for our e-commerce site.
A while back we were suffering from attempts to access the database remotely so someone made changes so that only the IP of the server itself could access data. That was about 18 months ago and everything has been fine since.
However, we now have a second site (hosted on another VPS) that needs to access the same database and I can't get in contact with the person who made the original changes.
I know he was working in the SQL Server Management tool when he made the changes, can anyone point me in the correct direction.
Thanks.
SQL Server 2005 came locked down by default. Rather than SSMS, it also installs the SQL Server 2005 Surface Area Configuration tool, which has a Remote Connections setting where you can limit it to Local connections only.
You may also like to check any firewall on the server, which will have to allow Port 1433 (or different if changed from the default) TCP access from whichever machines you want to access it.
He might have turned the TCP/IP protocol off. In this case only the localhost can access the database. This link describes the procedure for sql server express, but the idea is the same