Heeeeeelp: Prevent to Drop the Databse 
Author Message
 Heeeeeelp: Prevent to Drop the Databse

I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

"-2147217900 (80040e14) can not drop the database, it is currently in use....."

How do I prevent this?

Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 19:01:43 GMT
 Heeeeeelp: Prevent to Drop the Databse

You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted to single-user mode?

What database? Sounds like SQL Server?

ON a side note ......why would you ever want to 'drop' the database?

Chris.

  I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

  "-2147217900 (80040e14) can not drop the database, it is currently in use....."

  How do I prevent this?

  Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 19:08:10 GMT
 Heeeeeelp: Prevent to Drop the Databse

Quote:
>> Is there any way to know someone is using the database? <<

You can use sp_who /sp_who2 system procedures. Or you can query the
master..sysprocesses table to see the current connections.

To remove them, you can either kill all the spids in a loop or you can do
the popular method :

ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE

--
- Anith
( Please reply to newsgroups only )



Fri, 06 Jan 2006 19:10:03 GMT
 Heeeeeelp: Prevent to Drop the Databse

I am using sql server 2000.

Actually it is multicompany application, and database is created by the name of company code. I am allowing the user to deleting database and I just want take the precaution, if someone delete the shared database so an eror message should display.

How do I know that database in single-user mode? Is there any way of any command?


  You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted to single-user mode?

  What database? Sounds like SQL Server?

  ON a side note ......why would you ever want to 'drop' the database?

  Chris.

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 19:16:31 GMT
 Heeeeeelp: Prevent to Drop the Databse
No I dont want to kill all the spides, I want to gove error message to that
person who is trying to delete database.


Quote:
> >> Is there any way to know someone is using the database? <<

> You can use sp_who /sp_who2 system procedures. Or you can query the
> master..sysprocesses table to see the current connections.

> To remove them, you can either kill all the spids in a loop or you can do
> the popular method :

> ALTER DATABASE db SET SINGLE_USER WITH ROLLBACK IMMEDIATE

> --
> - Anith
> ( Please reply to newsgroups only )



Fri, 06 Jan 2006 19:36:00 GMT
 Heeeeeelp: Prevent to Drop the Databse

I'm sorry I have no idea of how to achieve this from a client app - I'm talking from a sys admin point of view using the SQl Server 2000 MMC Console to place the db into single user mode to do admin tasks on it.

Chris.


  I am using sql server 2000.

  Actually it is multicompany application, and database is created by the name of company code. I am allowing the user to deleting database and I just want take the precaution, if someone delete the shared database so an eror message should display.

  How do I know that database in single-user mode? Is there any way of any command?


    You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted to single-user mode?

    What database? Sounds like SQL Server?

    ON a side note ......why would you ever want to 'drop' the database?

    Chris.

      I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

      "-2147217900 (80040e14) can not drop the database, it is currently in use....."

      How do I prevent this?

      Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 20:06:00 GMT
 Heeeeeelp: Prevent to Drop the Databse

From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.  

-regards, -marty nicholson

  I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

  "-2147217900 (80040e14) can not drop the database, it is currently in use....."

  How do I prevent this?

  Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 20:56:30 GMT
 Heeeeeelp: Prevent to Drop the Databse

Dear

whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

Ash

  From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.  

  -regards, -marty nicholson

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 21:05:10 GMT
 Heeeeeelp: Prevent to Drop the Databse

You already have the appropriate error number:

"-2147217900 (80040e14) can not drop the database, it is currently in use....."

Chris.

  Dear

  whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

  Ash


    From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.  

    -regards, -marty nicholson

      I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

      "-2147217900 (80040e14) can not drop the database, it is currently in use....."

      How do I prevent this?

      Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Fri, 06 Jan 2006 23:02:23 GMT
 Heeeeeelp: Prevent to Drop the Databse

But it did not work every time

  You already have the appropriate error number:

  "-2147217900 (80040e14) can not drop the database, it is currently in use....."

  Chris.

    Dear

    whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

    Ash


      From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.  

      -regards, -marty nicholson

        I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

        "-2147217900 (80040e14) can not drop the database, it is currently in use....."

        How do I prevent this?

        Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Sat, 07 Jan 2006 06:33:40 GMT
 Heeeeeelp: Prevent to Drop the Databse
Why would you want to give USERS the ability to drop databases?!?!

Personally, I would implement a system whereby a user could mark
a database as being suitable for deletion; then implement scheduled
code on the server that dropped marked databases if appropriate...

I am using sql server 2000.

Actually it is multicompany application, and database is created by the name of company code. I am allowing the user to deleting
database and I just want take the precaution, if someone delete the shared database so an eror message should display.

How do I know that database in single-user mode? Is there any way of any command?


  You should keep your own running tab of users currently accessing the DB and only allow them to drop it when it can be converted
to single-user mode?

  What database? Sounds like SQL Server?

  ON a side note ......why would you ever want to 'drop' the database?

  Chris.

    I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a
single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop
the databse. It gives following error

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    How do I prevent this?

    Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message
accordingly?



Sat, 07 Jan 2006 07:33:14 GMT
 Heeeeeelp: Prevent to Drop the Databse

Therein lies the problem - dropping a multi-user databse is a sysy admin function, not really a user function.

As Daniel says - mark it and then deny users accessing it at the client code. You could implement a periodic check to see if its in use and notify when there are no connections and so allow the 'drop' at that time.

Sorry I can't really help you with the T-SQL - grab a copy of SQL Server Books Online and check out ALTER etc.

Chris.

  But it did not work every time

    You already have the appropriate error number:

    "-2147217900 (80040e14) can not drop the database, it is currently in use....."

    Chris.

      Dear

      whatever you are saying is true, but how do I trap the error code, as I dont know what error number is returning the application?

      Ash


        From what I read in the other replies, what you should do is write error handling code into your app to produce a more user-friendly error message.  

        -regards, -marty nicholson

          I have created client server visual basic application, in which I am allowing to drop thedatabse to user. It works fine when a single user is working on it, but it gives problem at same time multiple user working on same database and one of them want to drop the databse. It gives following error

          "-2147217900 (80040e14) can not drop the database, it is currently in use....."

          How do I prevent this?

          Is there any way to know someone is using the database? or I can lock the database ? So I can give the error message accordingly?



Sat, 07 Jan 2006 10:19:10 GMT
 
 [ 12 post ] 

 Relevant Pages 

1. Dropping a databse in rollback

2. Statement Permission (Prevent to create/drop a table)

3. DBCombo Box and preventing drop down list

4. HEEEEEELP!

5. HEEEEEELP MEEEEE !!!! please :-)

6. Problem Searching the Filesystem - Heeeeeelp !!!

7. Dropping Login Id's w/o dropping the users

8. Drop Vs (Truncate & Drop)

9. Problems dropping indexes when dropping tables

10. Problem ( ORA-03113) when dropping user with drop user cascade

11. Drop login before dropping user


 
Powered by phpBB® Forum Software