Friday, March 30, 2012
Restricted access to system resources.
open and use the programs, for example, Quickbooks can
only be opened by the administrator. How do we change
the "restriced access" to aloud the other users to open
the programs. All the programs and files are in the
server, now we need everyone to access them.
Thank you.This is a SQL Server newsgroup - your question doesn't have anything to do
with SQL Server!
How you go about unlocking security settings on your server based programs
will have much to do with how those programs work (ie are they client /
server programs or simple windows apps?) as well as how they are secured in
the first place - via policies, roles or individual dacls..
You should probably ask this question in a security related newsgroup
though..
Regards,
Greg Linwood
SQL Server MVP
"email@.caseymauldin.com" <anonymous@.discussions.microsoft.com> wrote in
message news:02c401c3c836$054987c0$a401280a@.phx.gbl...
> We have 5 different users, and only the administrator can
> open and use the programs, for example, Quickbooks can
> only be opened by the administrator. How do we change
> the "restriced access" to aloud the other users to open
> the programs. All the programs and files are in the
> server, now we need everyone to access them.
> Thank you.sql
Restrict users to modify tabble structure
users are using "Windows authentication"
Thanks for any help.
J Justin
You need to limit what permissions each user has. Modify the security =
on each group or individual so that they have only the rights that they =
need. If you want to limit what they can do you will want to clear all =
checkboxes on the "server roles" tab and you will want to make sure that =
they have the appropriate database roles assigned. You access the forms =
that I am talking about via Enterprise Manager. Drill into the security =
folder, Logins node. double-click on a specific login to view its =
properties.
--=20
Keith
"Justin" <justinkumar@.hotmail.com> wrote in message =
news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx.gbl...
> Is it possible to restrict users to modify the table structure. Most =
of our
> users are using "Windows authentication"
> Thanks for any help.
>=20
> J Justin
>=20
>
|||Just make sure that they don't have such permissions/privileges in your database. I.e., should not have the
sysadmin server role. Should not be dbo in the database. Should not have db_ddladmin or db_owner database
role.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Justin" <justinkumar@.hotmail.com> wrote in message news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx.gbl...
> Is it possible to restrict users to modify the table structure. Most of our
> users are using "Windows authentication"
> Thanks for any help.
> J Justin
>
Restrict users to modify tabble structure
users are using "Windows authentication"
Thanks for any help.
J JustinYou need to limit what permissions each user has. Modify the security =
on each group or individual so that they have only the rights that they =
need. If you want to limit what they can do you will want to clear all =
checkboxes on the "server roles" tab and you will want to make sure that =
they have the appropriate database roles assigned. You access the forms =
that I am talking about via Enterprise Manager. Drill into the security =
folder, Logins node. double-click on a specific login to view its =
properties.
--=20
Keith
"Justin" <justinkumar@.hotmail.com> wrote in message =
news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx.gbl...
> Is it possible to restrict users to modify the table structure. Most =
of our
> users are using "Windows authentication"
> Thanks for any help.
>=20
> J Justin
>=20
>|||Just make sure that they don't have such permissions/privileges in your data
base. I.e., should not have the
sysadmin server role. Should not be dbo in the database. Should not have db_
ddladmin or db_owner database
role.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Justin" <justinkumar@.hotmail.com> wrote in message news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx
.gbl...
> Is it possible to restrict users to modify the table structure. Most of ou
r
> users are using "Windows authentication"
> Thanks for any help.
> J Justin
>
Restrict users to modify tabble structure
users are using "Windows authentication"
Thanks for any help.
J JustinYou need to limit what permissions each user has. Modify the security =on each group or individual so that they have only the rights that they =need. If you want to limit what they can do you will want to clear all =checkboxes on the "server roles" tab and you will want to make sure that =they have the appropriate database roles assigned. You access the forms =that I am talking about via Enterprise Manager. Drill into the security =folder, Logins node. double-click on a specific login to view its =properties.
-- Keith
"Justin" <justinkumar@.hotmail.com> wrote in message =news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx.gbl...
> Is it possible to restrict users to modify the table structure. Most =of our
> users are using "Windows authentication"
> Thanks for any help.
> > J Justin
> >|||Just make sure that they don't have such permissions/privileges in your database. I.e., should not have the
sysadmin server role. Should not be dbo in the database. Should not have db_ddladmin or db_owner database
role.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Justin" <justinkumar@.hotmail.com> wrote in message news:%23nTbnRiTEHA.2324@.TK2MSFTNGP10.phx.gbl...
> Is it possible to restrict users to modify the table structure. Most of our
> users are using "Windows authentication"
> Thanks for any help.
> J Justin
>sql
Restrict user from default tables (access given by public role)
I added few users with only SELECT permissions to 2 User Tables. But
when these users login,they could also see multiple system tables
(syscontraints, syssegments , dtproperties) . From reading this forum
and other articles, I understand these are visible due to the user
being part of the default "public" role.
My Question is, is there any way to remove/hide these system tables
from the user?.. The team manager doesnt like these users seeing
anything other than the 2 User Tables they supposed to see..
Thanks in advance for all tips/advices/suggestionsTell your team manager he's a turd. No...actually don't say that, it'll
probably get you fired.
I wouldn't go messing around with the permissions on the system tables,
you're likely to stuff up some functionality of SQL Server in that DB
for those users. The system tables are a very necessary part of
day-to-day data & schema manipulation...for every user of the DB.
Things like optimising query plans, for example, rely on data stored in
the system tables. I'm not positive if things will start breaking if
you start revoking or denying permissions on those system tables but I
wouldn't risk it.
There's an option in SSMS (Tools | Options | Environment | General |
Hide system objects in Object Explorer), not sure about SQLEM or QA,
that will hide the system tables in the GUI but not change their
underlying permissions. That may placate the pointy-haired manager
<http://www.dilbert.com/> asking for this change, perhaps.
What tool are the users using to "see" these system tables?
*mike hodgson*
http://sqlnerd.blogspot.com
sreejith.ram@.gmail.com wrote:
>I am newbie.. probably this is a silly question..
>I added few users with only SELECT permissions to 2 User Tables. But
>when these users login,they could also see multiple system tables
>(syscontraints, syssegments , dtproperties) . From reading this forum
>and other articles, I understand these are visible due to the user
>being part of the default "public" role.
>My Question is, is there any way to remove/hide these system tables
>from the user?.. The team manager doesnt like these users seeing
>anything other than the 2 User Tables they supposed to see..
>Thanks in advance for all tips/advices/suggestions
>
>|||Thanks Mike... This convinced me I should spend my time convincing the
manager to leave it alone than trying to hide the tables

The users are using SQL Server Enterprise Manager.|||> The users are using SQL Server Enterprise Manager.
EM is more of a DBA/Developer tool than an end-user tool. In any case, you
can hide most of the system object noise by unchecking the 'show system
databases and system objects' option under the EM server registration
properties.
Hope this helps.
Dan Guzman
SQL Server MVP
<sreejith.ram@.gmail.com> wrote in message
news:1138983030.862156.116660@.f14g2000cwb.googlegroups.com...
> Thanks Mike... This convinced me I should spend my time convincing the
> manager to leave it alone than trying to hide the tables

> The users are using SQL Server Enterprise Manager.
>|||I thought there was that "hide" option in SQLEM. I just couldn't
remember where it was (been using SSMS too long <g> ).
*mike hodgson*
http://sqlnerd.blogspot.com
Dan Guzman wrote:
>EM is more of a DBA/Developer tool than an end-user tool. In any case, you
>can hide most of the system object noise by unchecking the 'show system
>databases and system objects' option under the EM server registration
>properties.
>
>
Restrict Printing based on User?
even exporting it)?
If so, what is the difficulty level on a scale of 1-10? I received a
request from a user to prohibit some users from printing, but I would
argue that if you don't want them to print it, they probably shouldn't
even see it.
Still, I'm curious as to the feasibility.
Thanks,
MikeNot with Report Manager. You can remove certain export types but it is for
everybody. Same thing with the new printing control, everybody or nobody.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Bassist695" <Michael.EJ.Reynolds@.gmail.com> wrote in message
news:1122382697.120430.226760@.g47g2000cwa.googlegroups.com...
> Is there any way to restrict certain users from printing a report (or
> even exporting it)?
> If so, what is the difficulty level on a scale of 1-10? I received a
> request from a user to prohibit some users from printing, but I would
> argue that if you don't want them to print it, they probably shouldn't
> even see it.
> Still, I'm curious as to the feasibility.
> Thanks,
> Mike
>|||If you allow users to view your reports, you can't prevent them from
printing them.. Even if you find a way to do that, they'll still be
able to use "Print Screen" and then print out the screenshot...
restrict local cube
Thank you.I'm almost certain that this isn't possible. There are ways that you can make it a bit more difficult, but those will only annoy your users.
If you find some way to do this, please let me know how you went about it.
-PatP|||Deny them access to the cubes ?|||Deny them access to the cubes ?
No, users still allowed to perform live access but must be prevented from creating local (offline) cube which they can bring home.
I'm aware of a new property introduced on SQL 2000 SP3a named RESTRICTED CLIENT but not sure if it has anything to do with our need nor how to set it up.sql
restrict enterprise manager to see all the databases
my question is about security, but I am sure it has something to do
with the server configuration. It is about normal users other than SA.
In the server, multiple users, and each user has ownership of a
seperate database. When any of these users connect to the sql server
via Enterprise Manager, they are able to see all the databases, not
only they owned, also other databases they do not have ownership of.
Not that, they can see the tables or the data, but this still
bothers the user(s). How can I restrict the normal users to see only
their database(s) when they logged in thru enterprise manager with
their username and password ?
I aplogize if this quesiton has asked before and answered. If so,
please direct me to the correct link, I could not seek it.
Thank you.
Hi,
As far as I know there is a no way to restrict this in enterprise manager.
You can only hide system databases and system tables
from SQL Server's Registration Properties.
Thanks
Hari
SQL Server MVP
"murtix van basten" <murtix@.gmail.com> wrote in message
news:1158899177.310068.275240@.d34g2000cwd.googlegr oups.com...
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>
|||murtix van basten wrote:
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>
Can't do this with Enterprise Manager...
Tracy McKibben
MCDBA
http://www.realsqlguy.com
|||Thank you for the answers.
Tracy McKibben wrote:
> murtix van basten wrote:
> Can't do this with Enterprise Manager...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
restrict enterprise manager to see all the databases
my question is about security, but I am sure it has something to do
with the server configuration. It is about normal users other than SA.
In the server, multiple users, and each user has ownership of a
seperate database. When any of these users connect to the sql server
via Enterprise Manager, they are able to see all the databases, not
only they owned, also other databases they do not have ownership of.
Not that, they can see the tables or the data, but this still
bothers the user(s). How can I restrict the normal users to see only
their database(s) when they logged in thru enterprise manager with
their username and password ?
I aplogize if this quesiton has asked before and answered. If so,
please direct me to the correct link, I could not seek it.
Thank you.Hi,
As far as I know there is a no way to restrict this in enterprise manager.
You can only hide system databases and system tables
from SQL Server's Registration Properties.
Thanks
Hari
SQL Server MVP
"murtix van basten" <murtix@.gmail.com> wrote in message
news:1158899177.310068.275240@.d34g2000cwd.googlegroups.com...
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>|||murtix van basten wrote:
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>
Can't do this with Enterprise Manager...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thank you for the answers.
Tracy McKibben wrote:
> murtix van basten wrote:
> > Hi,
> >
> > my question is about security, but I am sure it has something to do
> > with the server configuration. It is about normal users other than SA.
> >
> > In the server, multiple users, and each user has ownership of a
> > seperate database. When any of these users connect to the sql server
> > via Enterprise Manager, they are able to see all the databases, not
> > only they owned, also other databases they do not have ownership of.
> >
> > Not that, they can see the tables or the data, but this still
> > bothers the user(s). How can I restrict the normal users to see only
> > their database(s) when they logged in thru enterprise manager with
> > their username and password ?
> >
> > I aplogize if this quesiton has asked before and answered. If so,
> > please direct me to the correct link, I could not seek it.
> >
> > Thank you.
> >
> Can't do this with Enterprise Manager...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
restrict enterprise manager to see all the databases
my question is about security, but I am sure it has something to do
with the server configuration. It is about normal users other than SA.
In the server, multiple users, and each user has ownership of a
seperate database. When any of these users connect to the sql server
via Enterprise Manager, they are able to see all the databases, not
only they owned, also other databases they do not have ownership of.
Not that, they can see the tables or the data, but this still
bothers the user(s). How can I restrict the normal users to see only
their database(s) when they logged in thru enterprise manager with
their username and password ?
I aplogize if this quesiton has asked before and answered. If so,
please direct me to the correct link, I could not seek it.
Thank you.Hi,
As far as I know there is a no way to restrict this in enterprise manager.
You can only hide system databases and system tables
from SQL Server's Registration Properties.
Thanks
Hari
SQL Server MVP
"murtix van basten" <murtix@.gmail.com> wrote in message
news:1158899177.310068.275240@.d34g2000cwd.googlegroups.com...
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>|||murtix van basten wrote:
> Hi,
> my question is about security, but I am sure it has something to do
> with the server configuration. It is about normal users other than SA.
> In the server, multiple users, and each user has ownership of a
> seperate database. When any of these users connect to the sql server
> via Enterprise Manager, they are able to see all the databases, not
> only they owned, also other databases they do not have ownership of.
> Not that, they can see the tables or the data, but this still
> bothers the user(s). How can I restrict the normal users to see only
> their database(s) when they logged in thru enterprise manager with
> their username and password ?
> I aplogize if this quesiton has asked before and answered. If so,
> please direct me to the correct link, I could not seek it.
> Thank you.
>
Can't do this with Enterprise Manager...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thank you for the answers.
Tracy McKibben wrote:
> murtix van basten wrote:
> Can't do this with Enterprise Manager...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
Restrict DTS execution
Does anyone know how to restrict the exceution of DTS packages?
The case is I've got some users which want to see the packages that are
currently created but I do not want them to run those packages. I already
know how to restrict the creation via sp_add_dtspackage.
Hi!
> Does anyone know how to restrict the exceution of DTS packages?
> The case is I've got some users which want to see the packages that are
> currently created but I do not want them to run those packages. I already
> know how to restrict the creation via sp_add_dtspackage.
I find this article very helpful:
http://www.windowsitpro.com/Article/...11/27111.html.
Dejan Sarka, SQL Server MVP
Mentor, www.SolidQualityLearning.com
Anything written in this message represents solely the point of view of the
sender.
This message does not imply endorsement from Solid Quality Learning, and it
does not represent the point of view of Solid Quality Learning or any other
person, company or institution mentioned in this message
Restrict DTS execution
Does anyone know how to restrict the exceution of DTS packages?
The case is I've got some users which want to see the packages that are
currently created but I do not want them to run those packages. I already
know how to restrict the creation via sp_add_dtspackage.Hi!
> Does anyone know how to restrict the exceution of DTS packages?
> The case is I've got some users which want to see the packages that are
> currently created but I do not want them to run those packages. I already
> know how to restrict the creation via sp_add_dtspackage.
I find this article very helpful:
http://www.windowsitpro.com/Article...111/27111.html.
Dejan Sarka, SQL Server MVP
Mentor, www.SolidQualityLearning.com
Anything written in this message represents solely the point of view of the
sender.
This message does not imply endorsement from Solid Quality Learning, and it
does not represent the point of view of Solid Quality Learning or any other
person, company or institution mentioned in this messagesql
Restrict DTS execution
Does anyone know how to restrict the exceution of DTS packages?
The case is I've got some users which want to see the packages that are
currently created but I do not want them to run those packages. I already
know how to restrict the creation via sp_add_dtspackage.Hi!
> Does anyone know how to restrict the exceution of DTS packages?
> The case is I've got some users which want to see the packages that are
> currently created but I do not want them to run those packages. I already
> know how to restrict the creation via sp_add_dtspackage.
I find this article very helpful:
http://www.windowsitpro.com/Article/ArticleID/27111/27111.html.
--
Dejan Sarka, SQL Server MVP
Mentor, www.SolidQualityLearning.com
Anything written in this message represents solely the point of view of the
sender.
This message does not imply endorsement from Solid Quality Learning, and it
does not represent the point of view of Solid Quality Learning or any other
person, company or institution mentioned in this message
restrict deletion
What would be the best practice to prevent users who didn't create a record in sql from deleting? When a record is created I have the username who created the record in one of the fields. I was thinking maybe a query?
Thank you in advance.
Hi fpena,
You can just compare the username again to the current user to see if he is the owner of this record. If yes, delete it. All this can be done in a single stored procedure.
HTH. If this does not answer you question, please feel free to mark it as Not Answered and post your reply. Thanks!
|||could you point me on the right direction? Thank you.|||Hi fpena,
You can use a single sentence to achieve that. Assume that there is a field in the table named RecordOwner, and your stored procedure passes in a parameter named @.Deleter. You can use
DELETE FROM Table1 WHERERowID=@.RowID ANDRecordOwner=@.Deleter
You can check the AffectedRows in your code. If it is 0, it means that the row does not exist or the deleter is not the owner, so that he cannot delete it.
|||i'm not sure i can accomplish what i'm looking for with that. i have a gridview visible to everyone all records visible no matter what userID owns the record what i'm trying to do is prevent a user who doesn't own a record from deleting when trying to delete. hope my question is clear enough. Thank you.|||Hi fpena,
I'm sure that this will do what you need. You just need to modify the delete command you're currently using to check the ownership info.
If you have any questions on how to do this, please feel free to reply to my post.
|||how is it done?
Wednesday, March 28, 2012
Restrict access to certain db
have access to certain db's, What is best way to manage this? ALso, in QA I
want them to only be able to run Select/Update/Make Table queries. How do
I force a user to logon whe
n they open EM or QA with a certain login account?Hi,
1. Create a new login in sql server (Use enterprise manager -- Security
option)
2. Go to database and select users option and add a new user
3. Assign that user db_reader and db_writer role (this will only allow that
user to browse and update/insert/delete contents in this database)
4. Login to QA as SA user
5. Select the database in which the user need create table prev.
6. Execute "Grant CREATE TABLE to <User name>
If you need to restrict the Insert and Delete from tables - Have a look into
DENY command .
Tahnks
Hari
MCDBA
"mikeb" <anonymous@.discussions.microsoft.com> wrote in message
news:AAC88C32-6D4C-44C8-B6D8-607F078F6A7A@.microsoft.com...
> I need to install EM and QA on some users machines, but I only want them
to have access to certain db's, What is best way to manage this? ALso, in
QA I want them to only be able to run Select/Update/Make Table queries. How
do I force a user to logon when they open EM or QA with a certain login
account?
Saturday, February 25, 2012
Restoring DB for files...
In order to copy a database from a server to a server, I cant detach the database as there are many users connected to it. The transaction log is large file while the data is about 46 MB, I made a backup for the data file only, zipped it and copied it to the target server.
Ex: the name of the source DB on the source server is x, the file I took as a backup for is x-data
From the Enterprise Manager, right-click the x DB, All tasks, Backup database, in the backup option click the File and Filegroup option and chose the primary file group with x_data file.
Then, I created a new database name it y with y_data , y_log files on primary filegroup. I want to restore my backup to have the DB x on my target server,
I tried:
RESTORE DATABASE y
FILE = 'y_data',
FILEGROUP = 'primary'
FROM disk= 'E:\VMS\DBFiles\test'
GO
But it did not work. Any help?
Thanks,what is the error you are getting ?
restoring databases
not be in use by anothet user.
1) How can I track the users using that specific database?
2) How can I send those users a messages using sql server?
3) How can I cancel their connections with that database?
exec sp_who
within Query Analyzer
If they are using NT authentication you might be able to determine their
user account. You could then send them an email or you could try NET SEND.
ALTER DATABASE pubs SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
Keith
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
> I want to restore a user database that is in use. Therefore the database
must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?
|||all of the three tasks you can do in Enterprise manager -> Management ->
Current Activity -> Process info.
Just right click on the process that you can see is using the database and
select the prefered option (Send message, Kill Process)
Danijel
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
>I want to restore a user database that is in use. Therefore the database
>must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?
restoring databases
not be in use by anothet user.
1) How can I track the users using that specific database?
2) How can I send those users a messages using sql server?
3) How can I cancel their connections with that database?exec sp_who
within Query Analyzer
If they are using NT authentication you might be able to determine their
user account. You could then send them an email or you could try NET SEND.
ALTER DATABASE pubs SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
--
Keith
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
> I want to restore a user database that is in use. Therefore the database
must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?|||all of the three tasks you can do in Enterprise manager -> Management ->
Current Activity -> Process info.
Just right click on the process that you can see is using the database and
select the prefered option (Send message, Kill Process)
Danijel
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
>I want to restore a user database that is in use. Therefore the database
>must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?
restoring databases
t
not be in use by anothet user.
1) How can I track the users using that specific database?
2) How can I send those users a messages using sql server?
3) How can I cancel their connections with that database?exec sp_who
within Query Analyzer
If they are using NT authentication you might be able to determine their
user account. You could then send them an email or you could try NET SEND.
ALTER DATABASE pubs SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
Keith
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
> I want to restore a user database that is in use. Therefore the database
must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?|||all of the three tasks you can do in Enterprise manager -> Management ->
Current Activity -> Process info.
Just right click on the process that you can see is using the database and
select the prefered option (Send message, Kill Process)
Danijel
"An Buysse" <An Buysse@.discussions.microsoft.com> wrote in message
news:5FEE0E06-2DA4-43A7-B003-9CB907F60ABB@.microsoft.com...
>I want to restore a user database that is in use. Therefore the database
>must
> not be in use by anothet user.
> 1) How can I track the users using that specific database?
> 2) How can I send those users a messages using sql server?
> 3) How can I cancel their connections with that database?
Tuesday, February 21, 2012
Restoring database problem
I tried to restore a msde database file in c#. Since SQL Server
requires that no users be connected to the database during the restore
operation, I tried to shut down the sql server, then start the sql
server again. Unfortunately, it did not work. The following is the
code:
//create an instance of a server class
SQLDMO.SQLServer srv = new SQLDMO.SQLServer();
//connect to the server
srv.Connect("local)\\NetSDK", "sa", "abc");
try
{
srv.Shutdown(5000); // stop db server, wait for 2 seconds
}
catch (Exception e)
{
; // do nothing
}
Thread.Sleep(10000); // sleep 10 seconds
// restart server
srv.Start(true, "(local)\\NetSDK", "sa", "abc");
//create a restore class instance
SQLDMO.Restore restore = new SQLDMO.Restore();
restore.Action = 0; // full db restore
//set the database to the chosen database
restore.Database = "mydbfile";
restore.Files = Path.GetFullPath(@."..\..\backup\DBLPS.bak");
SqlConnection conn = new SqlConnection("server=(local)\\NetSDK;
uid=sa; password=abc; pooling=false");
// Restore the database
restore.ReplaceDatabase = true;
restore.SQLRestore(srv);
An exception is thrown at srv.Start with message:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in myapp.exe
Additional information: [SQL-DMO]This server object is already
connected."
Mandy
Mandy wrote:
> Hello All,
> I tried to restore a msde database file in c#. Since SQL Server
> requires that no users be connected to the database during the restore
> operation, I tried to shut down the sql server, then start the sql
> server again. Unfortunately, it did not work. The following is the
> code:
> //create an instance of a server class
> SQLDMO.SQLServer srv = new SQLDMO.SQLServer();
> //connect to the server
> srv.Connect("local)\\NetSDK", "sa", "abc");
> try
> {
> srv.Shutdown(5000); // stop db server, wait for 2 seconds
> }
> catch (Exception e)
> {
> ; // do nothing
> }
> Thread.Sleep(10000); // sleep 10 seconds
> // restart server
> srv.Start(true, "(local)\\NetSDK", "sa", "abc");
> //create a restore class instance
> SQLDMO.Restore restore = new SQLDMO.Restore();
> restore.Action = 0; // full db restore
> //set the database to the chosen database
> restore.Database = "mydbfile";
> restore.Files = Path.GetFullPath(@."..\..\backup\DBLPS.bak");
> SqlConnection conn = new SqlConnection("server=(local)\\NetSDK;
> uid=sa; password=abc; pooling=false");
> // Restore the database
> restore.ReplaceDatabase = true;
> restore.SQLRestore(srv);
>
> An exception is thrown at srv.Start with message:
> "An unhandled exception of type
> 'System.Runtime.InteropServices.COMException' occurred in myapp.exe
> Additional information: [SQL-DMO]This server object is already
> connected."
And if you use the T-SQL commands instead of SQLDMO? (RESTORE DATABASE) You
could even shutdown the mssqlserver process through executing "net stop
mssqlserver" as a process and then restart it again with "net start
mssqlserver" as a process.
FB
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
|||Hi,
Thanks for replying! How to execute T-SQL commands to stop and start
database in C#?
Mandy
"Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@.xs4all.nl> wrote in message news:<xn0dnlsxj3398s001@.msnews.microsoft.com>...
> Mandy wrote:
>
> And if you use the T-SQL commands instead of SQLDMO? (RESTORE DATABASE) You
> could even shutdown the mssqlserver process through executing "net stop
> mssqlserver" as a process and then restart it again with "net start
> mssqlserver" as a process.
> FB
|||Mandy wrote:
> Thanks for replying! How to execute T-SQL commands to stop and start
> database in C#?
stop and start the server process. You can do that through:
// stopping
System.Diagnostics.Process.Start("CMD.exe", "/C net stop mssqlserver");
// starting
System.Diagnostics.Process.Start("CMD.exe", "/C net start mssqlserver");
Of course you have to wait some seconds between the two.
Frans.[vbcol=seagreen]
> Mandy
>
> "Frans Bouma [C# MVP]" <perseus.usenetNOSPAM@.xs4all.nl> wrote in message
> news:<xn0dnlsxj3398s001@.msnews.microsoft.com>...
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP