I write a restore program to restore a database.
But it must stop all connecions to the database before resotre.
How can I stop all connecions to the database by program? 7 7194
ad,
There is no way to do this out of the box. If anything, it depends on
the database. Most likely, you will have to use some sort of administrative
interface (there might or might not be one you can access programatically ,
depending on the database) to kick everyone off.
Which database are you using?
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. I write a restore program to restore a database. But it must stop all connecions to the database before resotre. How can I stop all connecions to the database by program?
If you are using SQL Server...
Take it offline: http://developer.mimer.com/documenta...tements84.html
Restore it: http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
--
Derek Davis dd******@gmail. com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... ad,
There is no way to do this out of the box. If anything, it depends on the database. Most likely, you will have to use some sort of administrative interface (there might or might not be one you can access programatically , depending on the database) to kick everyone off.
Which database are you using?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"ad" <fl****@wfes.tc c.edu.tw> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..I write a restore program to restore a database. But it must stop all connecions to the database before resotre. How can I stop all connecions to the database by program?
A better link for the offline part: http://msdn.microsoft.com/library/de...da-di_8c32.asp
--
Derek Davis dd******@gmail. com
"carion1" <dd******@gmail .com> wrote in message
news:e7******** ******@tk2msftn gp13.phx.gbl... If you are using SQL Server...
Take it offline: http://developer.mimer.com/documenta...tements84.html
Restore it: http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
--
Derek Davis dd******@gmail. com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... ad,
There is no way to do this out of the box. If anything, it depends on the database. Most likely, you will have to use some sort of administrative interface (there might or might not be one you can access programatically , depending on the database) to kick everyone off.
Which database are you using?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"ad" <fl****@wfes.tc c.edu.tw> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..I write a restore program to restore a database. But it must stop all connecions to the database before resotre. How can I stop all connecions to the database by program?
Thanks,
I use the codes below, but it fail when there are some users accessing the
database
------------------------------------------------------------------------------------------------------------------
C. Take a database offline
This example takes the sales database offline if there are no users
accessing the database.
USE master
EXEC sp_dboption 'sales', 'offline', 'TRUE'
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: uh************* ***@TK2MSFTNGP1 4.phx.gbl... A better link for the offline part:
http://msdn.microsoft.com/library/de...da-di_8c32.asp
--
Derek Davis dd******@gmail. com
"carion1" <dd******@gmail .com> wrote in message news:e7******** ******@tk2msftn gp13.phx.gbl... If you are using SQL Server...
Take it offline: http://developer.mimer.com/documenta...tements84.html
Restore it: http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
--
Derek Davis dd******@gmail. com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... ad,
There is no way to do this out of the box. If anything, it depends on the database. Most likely, you will have to use some sort of administrative interface (there might or might not be one you can access programatically , depending on the database) to kick everyone off.
Which database are you using?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"ad" <fl****@wfes.tc c.edu.tw> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. I write a restore program to restore a database. But it must stop all connecions to the database before resotre. How can I stop all connecions to the database by program?
Well you could find who is connected to the db in question with sp_who and
then kill those open connections.
--
Derek Davis dd******@gmail. com
"ad" <ad@wfes.tcc.ed u.tw> wrote in message
news:OP******** ******@TK2MSFTN GP15.phx.gbl... Thanks, I use the codes below, but it fail when there are some users accessing the database
------------------------------------------------------------------------------------------------------------------ C. Take a database offline This example takes the sales database offline if there are no users accessing the database.
USE master EXEC sp_dboption 'sales', 'offline', 'TRUE'
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: uh************* ***@TK2MSFTNGP1 4.phx.gbl...A better link for the offline part:
http://msdn.microsoft.com/library/de...da-di_8c32.asp
--
Derek Davis dd******@gmail. com
"carion1" <dd******@gmail .com> wrote in message news:e7******** ******@tk2msftn gp13.phx.gbl... If you are using SQL Server...
Take it offline: http://developer.mimer.com/documenta...tements84.html
Restore it: http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
--
Derek Davis dd******@gmail. com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... ad,
There is no way to do this out of the box. If anything, it depends on the database. Most likely, you will have to use some sort of administrative interface (there might or might not be one you can access programatically , depending on the database) to kick everyone off.
Which database are you using?
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"ad" <fl****@wfes.tc c.edu.tw> wrote in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. >I write a restore program to restore a database. > But it must stop all connecions to the database before resotre. > How can I stop all connecions to the database by program? > >
Thanks,
Could you give me an example?
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: ek************* *@TK2MSFTNGP12. phx.gbl... Well you could find who is connected to the db in question with sp_who and then kill those open connections.
--
Derek Davis dd******@gmail. com
"ad" <ad@wfes.tcc.ed u.tw> wrote in message news:OP******** ******@TK2MSFTN GP15.phx.gbl... Thanks, I use the codes below, but it fail when there are some users accessing the database
------------------------------------------------------------------------------------------------------------------ C. Take a database offline This example takes the sales database offline if there are no users accessing the database.
USE master EXEC sp_dboption 'sales', 'offline', 'TRUE'
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: uh************* ***@TK2MSFTNGP1 4.phx.gbl...A better link for the offline part:
http://msdn.microsoft.com/library/de...da-di_8c32.asp
--
Derek Davis dd******@gmail. com
"carion1" <dd******@gmail .com> wrote in message news:e7******** ******@tk2msftn gp13.phx.gbl... If you are using SQL Server...
Take it offline: http://developer.mimer.com/documenta...tements84.html
Restore it: http://msdn.microsoft.com/library/de...ra-rz_25rm.asp
--
Derek Davis dd******@gmail. com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... > ad, > > There is no way to do this out of the box. If anything, it depends > on the database. Most likely, you will have to use some sort of > administrative interface (there might or might not be one you can > access programatically , depending on the database) to kick everyone > off. > > Which database are you using? > > Hope this helps. > > > -- > - Nicholas Paldino [.NET/C# MVP] > - mv*@spam.guard. caspershouse.co m > > "ad" <fl****@wfes.tc c.edu.tw> wrote in message > news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. >>I write a restore program to restore a database. >> But it must stop all connecions to the database before resotre. >> How can I stop all connecions to the database by program? >> >> > >
kill [spid]
--
Derek Davis dd******@gmail. com
"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:Oi******** *****@TK2MSFTNG P15.phx.gbl... Thanks, Could you give me an example?
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: ek************* *@TK2MSFTNGP12. phx.gbl... Well you could find who is connected to the db in question with sp_who and then kill those open connections.
--
Derek Davis dd******@gmail. com
"ad" <ad@wfes.tcc.ed u.tw> wrote in message news:OP******** ******@TK2MSFTN GP15.phx.gbl... Thanks, I use the codes below, but it fail when there are some users accessing the database
------------------------------------------------------------------------------------------------------------------ C. Take a database offline This example takes the sales database offline if there are no users accessing the database.
USE master EXEC sp_dboption 'sales', 'offline', 'TRUE'
"carion1" <dd******@gmail .com> ¼¶¼g©ó¶l¥ó·s»D: uh************* ***@TK2MSFTNGP1 4.phx.gbl... A better link for the offline part:
http://msdn.microsoft.com/library/de...da-di_8c32.asp
--
Derek Davis dd******@gmail. com
"carion1" <dd******@gmail .com> wrote in message news:e7******** ******@tk2msftn gp13.phx.gbl... > If you are using SQL Server... > > Take it offline: > http://developer.mimer.com/documenta...tements84.html > > Restore it: > http://msdn.microsoft.com/library/de...ra-rz_25rm.asp > > -- > > Derek Davis > dd******@gmail. com > > "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> > wrote in message news:Ot******** ******@TK2MSFTN GP15.phx.gbl... >> ad, >> >> There is no way to do this out of the box. If anything, it >> depends on the database. Most likely, you will have to use some sort >> of administrative interface (there might or might not be one you can >> access programatically , depending on the database) to kick everyone >> off. >> >> Which database are you using? >> >> Hope this helps. >> >> >> -- >> - Nicholas Paldino [.NET/C# MVP] >> - mv*@spam.guard. caspershouse.co m >> >> "ad" <fl****@wfes.tc c.edu.tw> wrote in message >> news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. >>>I write a restore program to restore a database. >>> But it must stop all connecions to the database before resotre. >>> How can I stop all connecions to the database by program? >>> >>> >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mudge |
last post by:
Hi,
My hosting provider only allows me to use 50 connections to my MySQL
database that my Web site will use.
I don't know what this 50 connections means exactly. Does this mean that
only 50 visitors to my Web site can access my database through my Web site
at one time?
Or does this mean that in my code I can only use 50 connections? and like
|
by: Sven Jacobs |
last post by:
Dear newsgroup,
I've upgraded to PEAR::DB 1.6.5 recently. Unfortunately now the database
connection doesn't work as expected anymore :( The problems seems to be the
method disconnect(), which now closes the database connections of _all_
database objects. I ask myself if this is intentional or a bug. Below a
code example:
01 <?php
02 error_reporting(E_ALL);
|
by: Toralf Kirsten |
last post by:
Hi,
we are using db2 8.1 on Linux. I'd like to close all open connection at
a defined time point. Therfore I wrote a sql script including the command
disconnect all
or
release all
|
by: Marc Jennings |
last post by:
Hi,
I need to rebuild a database each time I redeploy a test applicatio,
and I was wondering if anyone could give me some clues as to how to go
about disconnecting any users that may be logged into that database in
SQL. I know I can do this quite easily using MSBuild, but the reason
I need to know is so I can get awayt from using beta tools in
development. (We have a specific issue with MSBuild)
Also, if anyone knows of a good...
|
by: ad |
last post by:
I am use the AttachDbFilename to connection to a .mdf file of SqlExpress
(like the example below)
After the database is attached, it will be free again until all session time
out.
But sometime I want to move the .mdf file to another place, but the .mdf is
not free.
How can I disconnect all the connections to that database immediately?...
| |
by: mamod20 |
last post by:
Please advise, I have the following example and want to know the best
way to use $dbh->disconnect; and $sth->finish;
--------------
$sql_host="localhost";
$sql_dataname = "database";
$sql_userid = "root";
$sql_password = "password";
&connect_sql;
|
by: Laurence |
last post by:
Hi there,
Does anyone know what's difference among "connect reset", "disconnect",
and "terminate"?
Thanks in advance,
|
by: TMAG |
last post by:
If i do "db2 disconnect all" after an application finishes, does it
mean that any application that connects after this will find the buffer
pool "cold"? Or the pages accessed by last application will be still in
buffer pool? Apparently when I do "db2 disconnect all" at the end, the
windows task manager shows that all bufferpool memory has been deallocated.
thanks
|
by: Kelii |
last post by:
Currently I have a button that allows the user to "Close Company" - at
the moment it doesn't do anything :D I would like the button to
"disconnect" the back end then show my Open Company form.
My question is:
1. Short of closing the application or deleting the linked tables, is
there a way to disconnect the user's front end from the common back
end using VBA?
2. Does disconnecting the user serve any purpose? I've read a lot of
posts...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |