Showing posts with label regarding. Show all posts
Showing posts with label regarding. Show all posts

Wednesday, March 28, 2012

killing sqlservr.exe from sqlclr code

I keep getting different answers from different people on regarding if you can or cannot kill the hosting sql server process with an unsafe assembly. Can you do this? If so could you please attach a sample demonstrating this?

Thanks,

Derek

Uhh, delicate question. Sure Microsoft did everything to prevent this. I know that in beta this was sort of unstable, but right now I have no clue how to do this.
If someone has an example to do this, this should be reported as a bug to Microsoft in order to prevent this. But I would assume that the CLR hosting process is quite stable right now.


HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||There are many ways to kill sql server. If we allow PInvoke or unsafe code, then the possibilities are endless. There is no way to prevent a user from calling TerminateProcess with PInvoke. We are more concerned with safe assemblies not corrupting the sql server process then a user focused on terminating sql server.

You can always write an XP to do the same anyway for instance.|||could you please give me some quick code in C#/VB.Net that will kill the hosting process in that case?|||I am only concerned about this becaseu I am a lead author on a sqlclr book.|||

Is this simple enough?

public static void killsql()
{
System.Environment.Exit(-1);
}

Steven

Monday, March 26, 2012

Killing a user/login

I have a user that I need to get rid of in a database. I tried to us
sp_droplogin but got an error regarding the user, I used sp_user and
then was told that the user owns objects and cannot be dropped.
This user has over 300 objects encompassing stored procedures, views,
tables and so on -- and I don't have enterprise manager. Is there a
quick and clean way of just zapping the user and everything it owns?!
Essentially I need to create a script to send to somebody to do this --
their user and objects are all out of wack.
JamesIt's not really clear what you are attempting to accomplish.
Removing a user is easy, removing all objects owned by that user isn't very
difficult either.
BUT, do you really want the objects to be DELETED from the database?
OR do you really want the user to be removed and the objects kept -but just
assigned to other ownership?
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<starritt@.gmail.com> wrote in message
news:1158605443.645160.227840@.e3g2000cwe.googlegroups.com...
>I have a user that I need to get rid of in a database. I tried to us
> sp_droplogin but got an error regarding the user, I used sp_user and
> then was told that the user owns objects and cannot be dropped.
> This user has over 300 objects encompassing stored procedures, views,
> tables and so on -- and I don't have enterprise manager. Is there a
> quick and clean way of just zapping the user and everything it owns?!
> Essentially I need to create a script to send to somebody to do this --
> their user and objects are all out of wack.
> James
>

Killing a user/login

I have a user that I need to get rid of in a database. I tried to us
sp_droplogin but got an error regarding the user, I used sp_user and
then was told that the user owns objects and cannot be dropped.
This user has over 300 objects encompassing stored procedures, views,
tables and so on -- and I don't have enterprise manager. Is there a
quick and clean way of just zapping the user and everything it owns?!
Essentially I need to create a script to send to somebody to do this --
their user and objects are all out of wack.
James
It's not really clear what you are attempting to accomplish.
Removing a user is easy, removing all objects owned by that user isn't very
difficult either.
BUT, do you really want the objects to be DELETED from the database?
OR do you really want the user to be removed and the objects kept -but just
assigned to other ownership?
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<starritt@.gmail.com> wrote in message
news:1158605443.645160.227840@.e3g2000cwe.googlegro ups.com...
>I have a user that I need to get rid of in a database. I tried to us
> sp_droplogin but got an error regarding the user, I used sp_user and
> then was told that the user owns objects and cannot be dropped.
> This user has over 300 objects encompassing stored procedures, views,
> tables and so on -- and I don't have enterprise manager. Is there a
> quick and clean way of just zapping the user and everything it owns?!
> Essentially I need to create a script to send to somebody to do this --
> their user and objects are all out of wack.
> James
>
sql

Killing a user/login

I have a user that I need to get rid of in a database. I tried to us
sp_droplogin but got an error regarding the user, I used sp_user and
then was told that the user owns objects and cannot be dropped.
This user has over 300 objects encompassing stored procedures, views,
tables and so on -- and I don't have enterprise manager. Is there a
quick and clean way of just zapping the user and everything it owns?!
Essentially I need to create a script to send to somebody to do this --
their user and objects are all out of wack.
JamesIt's not really clear what you are attempting to accomplish.
Removing a user is easy, removing all objects owned by that user isn't very
difficult either.
BUT, do you really want the objects to be DELETED from the database?
OR do you really want the user to be removed and the objects kept -but just
assigned to other ownership?
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<starritt@.gmail.com> wrote in message
news:1158605443.645160.227840@.e3g2000cwe.googlegroups.com...
>I have a user that I need to get rid of in a database. I tried to us
> sp_droplogin but got an error regarding the user, I used sp_user and
> then was told that the user owns objects and cannot be dropped.
> This user has over 300 objects encompassing stored procedures, views,
> tables and so on -- and I don't have enterprise manager. Is there a
> quick and clean way of just zapping the user and everything it owns?!
> Essentially I need to create a script to send to somebody to do this --
> their user and objects are all out of wack.
> James
>