GRANT .... AS &&<database Principal&&>

Apr 19, 2008




I am trying to grant various users permissions and am using the following sql command


GRANT Delete ON Resident TO hector AS barbara


barbara is a member of the fixed server role sysadmin and has Delete permission on the Resident table.

I log in to the server as barbara and try and execute this command and get:
Msg 15151, Level 16, State 1, Line 1
Cannot find the object 'Resident', because it does not exist or you do not have permission.


If I just run

GRANT Delete ON Resident TO hector

then everything works fine but the grantor is then dbo. I want to be able to have it recorded that barbara was the one that actually gave hector permissino to delete on the Resident table. Is there a way to do this?

View 2 Replies


ADVERTISEMENT

SQL Server 2005 Express: The Database Principal Owns A Schema In The Database, And Can Not Be Dropped.

Jan 11, 2006

I recently added a new user to my database.  Now I want to delete that user, but I keep getting the error above.  What do I need to do to delete my recently added user?

View 4 Replies View Related

The Database Principal Owns A Schema In The Database, And Cannot Be Dropped.

Feb 15, 2006

Trying to get my hands around all the new security features of SQL Server 2005. In Management Studio did something I don't know how to undo. I added a database role ReadOnlyRole and clicked the box next to db_datareader in the owned schemas box. Then I tried to remove the ReadOnlyRole and could not. How do I undo what I did? Is it possible?

The below is the TSQL that generates the my issue.



Use [master]
go
create database [test]
go

USE [test]
GO

CREATE ROLE [ReadOnlyRole]
GO

USE [test]
GO

ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [ReadOnlyRole]
GO

drop role [ReadOnlyRole]
go

View 12 Replies View Related

In What Situations Principal Database Might Become Unavailable ?

Dec 13, 2006

Is it correct to say

in any case exept when data or log file not available pricipal db will be availabe

and manual failover could be done only from from principal?











View 1 Replies View Related

The Database Principal Is Set As The Execution Context Of One Or More Procedures ...

Aug 14, 2007

I have database in the database there are a few users that no one is used. When I try to drop thpse users I got next error message:
"The database principal is set as the execution context of one or more procedures, functions, or event notifications and cannot be dropped." (Msg 15136)

Indeed, I think that those users have execute rights on store procedures.
How do I find for wich procedures or other database objects those users have grants?
How do I delete them from database (and maybe from logins of the server)?
How can I see what grants a user has?
How can I see what grants does STP has?

View 10 Replies View Related

Code To Programmatically Failover A Principal Database.

Mar 12, 2008



Hi Guys,
I was wondering if there is a system procedure / T-SQL code to programmatically Failover a Database from Principal to mirror mode?

also,
We noticed that at times few of all the databases that were kept on 'Principal' mode get randomly 'Failover'. Does anyone have any idea?

If so, pls respond.

Thank you.


View 9 Replies View Related

Principal Db In Principal, Synchronizing State, The Mirror In Restoring State

Sep 26, 2007

We have mirroring setup for 5 dbs, 4 of which are synchronized and 1 which is in "synchronizing" state on the principal and "restoring" state on the mirror. Mirroring for all dbs has been working fine for the past several months and we have a witness that has allowed automatic failover in the past without problems.

This database has several bulk inserts performed throughout the day and am sure there is some latency due to the size of these transactions.

Not sure as to why this is happening all of a sudden, but the db in question has been in this state for the past 12 hrs. I checked the mirroring status on the principal and it states that it is "synchronizing: data is being transferred from principal to mirror", but the mirror server states that db is in "restoring" state. Can anyone suggest as to how I can get the database on the mirroring server to get back to "mirror, synchronizing/restoring..." state? Or suggest on how I can troubleshoot this?

Thanks in advance.

View 3 Replies View Related

Setup And Upgrade :: Both Database Went To Suspended Mode In Principal And Mirror

Aug 10, 2015

I have checked my Production databases, both are went to Disconnected state, both are unable to connect to the application, i checked all the services and its working fine. and restarted the end points on Principal and Mirror, still issue not solved, after restart the witness server End point both the databases are working fine.

View 3 Replies View Related

The Server Principal XYuser Is Not Able To Access The Database Ydb Under The Current Security Context

May 23, 2007

SQL2005 on winserver 2003. I have a view in Xdb that accesses tables in 2 different databases (Xdb and Ydb) on the same server. I have mixed mode security. I have a SQL user (XYuser) that has read access to all tables and views on both databases, yet when I try to access the view using a C# windows application I get the following error:



The server principal "XYuser" is not able to access the database "Ydb" under the current security context



This same scenario works under SQL 2000. I looked through the postings and tried to set TRUSTWORTHY ON on both databases but that didn't help. I can access any other views or tables on the SQL 2005 server, just not the one that joins the tables cross databases. Any help is much appreciated... john

View 17 Replies View Related

Windows Server Principal Denied Access To Database Under Current Context

May 1, 2007

Hi guys. I created a database "MyDatabase" using an AD Account "user01" which is a member of a domain group "GroupA". I have created a login in my SQL Server 2005 for this AD group. I have also added the said login as a user of my database. I created other AD users and put them in the same group. When I try to access the database using the other users, I get this message

The server principal "MyDomainuser02" is not able to access the database "MyDatabase" under the current security context.

This KB tells me that my situation is triggered by the first case in which the owner of the database is windows authenticated. I have already set the database to be TRUSTWORTHY. I haven't tried CERTIFICATES though. I believe I haven't done anything complex to warrant this solution.

I'm really lost with the myriads of principals and securables that SQL2005 has. All I want is just to execute a certain set of stored procedures. I can't do this because I can't even execute "USE MyDatabase". What are the permissions I need to give to "GroupA" ?

View 5 Replies View Related

GRANT SELECT ON [dbo].[TblAreaCatmap] TO [admin] Prevent Grant From Being Automaticly Add To Each Column

Oct 15, 2007



GRANT SELECT ON [dbo].[TblAreaCatmap] TO [admin] prevent grant from being automaticly add to each column?

Is there a way when you issue a grant select to a table or a view to not also grant select for each column.

The problem is when you use the grant command it automaticly adds the grant command to each column. I want to grant the permission at the table level so when the table is scripted it only has a single grant command instead of a grant for the table and a grant for each column which is not needed.

The sql managemnt studion interface will allow you to do this but onlt by using the interface. If you issue the above command from a query window it also creates A GRANT FOR EVERY COLUMN. How can I stop this behavior.

View 9 Replies View Related

Grant Execute On Sproc Doesn't Grant Privilege To Update?

Oct 31, 2014

I am writing a stored procedure which updates a table, but when I run the stored procedure using a login that I have granted execute privileges on, then I get a message that I cannot run an update on the table. This would happen in dynamic sql... while my SQL has parameter references, I don't think it is considered dynamic SQL?

sproc:
CREATE PROCEDURE [schemaname].[SetUserCulture]
@UserID int
, @Culture nvarchar(10)
AS
UPDATE dbo.SecUser
SET Culture = @Culture
WHERE UserID = @UserID

execute SQL:
EXEC schemaname.SetUserCulture @UserID = 9, @Culture = N'x'

error:
The UPDATE permission was denied on the object 'SecUser', database 'DatabaseName', schema 'schemaname'.

View 8 Replies View Related

How To Grant Create View Access Without Grant Alter On Schema::

Aug 16, 2007

In SQL Server 2005 SP2 I want to grant the ability to create views to a user but in order to do this it requires that the users has the ability to grant alter on a schema.

Is there any way to grant this privilage without granting alter on schema also?

View 1 Replies View Related

Finding Logins That Have GRANT CONTROL And GRANT VIEW DEFINITION

Jul 21, 2015

Have a certificate and symmetric key that i have used the following to GRANT to logins. How can I find out which SQL logins have the GRANT CONTROL and GRANT VIEW DEFINTION?

GRANT VIEW DEFINITION ON SYMMETRIC KEY:: Symetric1 TO Brenda
GRANT CONTROL ON CERTIFICATE:: Certificate1 to Brenda

View 5 Replies View Related

Grant - All Tables In Database

Aug 12, 1999

Hello:

Is there any way to grant all permissions on all of the tables in a database without doing a GRANT ALL command for each table?

Thanks in advance.

View 2 Replies View Related

How To Grant Access To Sql Database

Aug 27, 2004

i am working on a project using asp.net and microsoft sql server, i am now working on my home pc. so now the problem is whenever i try to access the database through asp a error message such as :

[OleDbException (0x80040e4d): Login failed for user 'JYHENGASPNET'.]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvid er() +57
System.Data.OleDb.OleDbConnection.Open() +203
JYHeng.USRRegistration.Page_Load(Object sender, EventArgs e) in C:Documents and SettingsHeng Jang Yang.JYHENGFYPFYPCacheJYHENGJYHengUSRRegistra tion.aspx.vb:63
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
will appear.
my connectionstring used is :
objCn.ConnectionString = "Provider=SQLOLEDB; Data Source=(local);Initial Catalog=fyp;Integrated Security=SSPI;"

i am told that i must check if my aspnet user have been granted access to the database. however i am not sure on how to check the access, not to mention granting accsss. How am i supposed to grant my aspnet user access to my sql database?

Can someone please help me ? i am really lost. thank you

View 2 Replies View Related

Grant Database Access

Jan 18, 2007

I am setting up report services after I installed the report server add-ins
on sharepoint 2007.

at first step, Reporting services integration, I put
report server web service URL -- http://ssrsdev1/reportserver
authentication mode -- windows authentication
it went OK.

at second step, Grant Database Access,
I put ssrsdev1 for server name (default instance) and then click OK and then
I put the user name (a member of local admin group on ssrsdev1) and password,
but I always got errors says:
Unable to log on with the given username and password.
what wrong here? what should I check? I am sure the user and password is
right and I can log on to ssrsdev1 physically with admin right without any
problem.
thanks for any thought on this.
zwp

View 20 Replies View Related

Grant Login To Another Database

Dec 1, 2007



Hi there,

I need help. I can mapped login to another database by MSSQLManagement studio. I need that in sql.

Security->Logins->Select LoginName->properties->user mapping->from the users mapped that login I select my database name and from the Database role membership db_owner and then click ok. I need that in sql.

thank now

View 2 Replies View Related

How To Grant Permissions To A User In A Different Database

Feb 19, 2008


I have a larger stored procedure that is running, but I am getting stuck on where I need to grant permissions to a user in a a different database on various functions and stored procedures. For example:





Code Snippet

use [Database1]
grant exec on [Database2].[dbo].[MyFunction] to bob




returns this error: Cannot find the user 'bob' , because it does not exist or you do not have permission.

However, I know 'bob' exists, plus when I change the use statement to Database2, the line of SQL works correctly. Given the nature of the overall stored procedure this will be running in, I won't have the ability to just change the use statement. Is it possible to grant permissions to a user on a different database without explicity having the use statement set to a particular database?

Thanks for any advice!

-Flea#

View 1 Replies View Related

Mirroring :: Principal Database Get Role Back After Being Back On Line

May 14, 2015

New to Database Mirroring and I have a question about the Principal database server. I have a Database Mirroring setup configured for High-safety with automatic fail over mode using a witness.

When a fail over occurs because of a lost of communication between the principal and mirror, the mirror server takes on the roll of Principal. When communication is returned to the Principal server, at some point does the database that was the previous Principal database automatically go back to being the Principal server?

View 2 Replies View Related

SQL 2012 :: Grant DROP Table Permission Within Database

Mar 26, 2015

How to grant DROP table permission within a database to an SQL login. I could see in Databae properties-> permission tab, there is an option to grant CREATE TABLE, EXECUTE permission etc, but not DROP table permission. How to grant it?

View 3 Replies View Related

How To Grant Create Procedure Permission To Database User?

Apr 7, 2008

Can somebody tell me without pointing to any other link how to grant Create Procedure permission to DB user.

View 3 Replies View Related

Grant User Group Select Access To All Views In Database

Sep 24, 2013

I'm trying to grant a user group select access to all the views in a database. I already made a query which creates a result set whit the SQL Syntax I (displayed below) need but it seems to be impossible to get this result set executed after creation.

use [AdventureWorksDW2008R2]
SELECT
'GRANT SELECT ON [' + SCHEMA_NAME(Schema_id) + '].[' + name + '] TO [DOMAINGROUP]'
FROM sys.views;

View 5 Replies View Related

Data Access :: Grant A User Permissions To Only One Table In A Database?

Jul 28, 2015

How do I grant a user permissions to only one table in a database.  How would it affect him using our Main App which is NAV with regards to his user's permission in NAV

View 2 Replies View Related

Question About Create Database,login,user,schema And Grant Permissions.

Apr 25, 2007

Hi,



I created a database,login,user and schema like belows.









-- 2. create database
CREATE DATABASE MyTempDatabase;



-- 3. create login
CREATE LOGIN MyTempLogin WITH PASSWORD = '#mytemplogin$',
DEFAULT_DATABASE = MyTempDatabase,
CHECK_EXPIRATION = OFF,
CHECK_POLICY = OFF;

--
USE MyTempDatabase;



-- 4. create user
CREATE USER MyTempLogin FROM LOGIN MyTempLogin WITH DEFAULT_SCHEMA = MyTempSchema;



-- 5. create schema
CREATE SCHEMA MyTempSchema AUTHORIZATION MyTempLogin;









The created user,MyTempLogin, must have permissions that can create tables,drop tables,select,insert,delete,update and bulk insert.



How can I grant permissions to the user?(or schema?)

I failed to grant by T-SQL query.



Additionally, what is purppose of the ROLE? Should I create or use it?



I'm confusing in security concept(login,user,schema,role).



Thanks.

View 3 Replies View Related

How To Grant 'Network Service' Or 'ASPNET' User Accounts Permissions To Connect To Database

Feb 18, 2008

set up asp .net user account on sql server 2005Question:

I've read the instructions in this article: http://www.netomatix.com/Development/aspnetuserpermissions.aspxBut do not know how to do this:You can grant 'Network Service' or 'ASPNET' user accounts permissions to connect to database.Please provide example on how to do this, thanks!

View 2 Replies View Related

SQL 2012 :: Grant Read-only Access To Windows Logins On Remote Standby Database

Mar 23, 2015

We log ship our production database tansaction logs to a secondary database on a separate remote domain.

Incidentally, this was not set up via the "Ship Transaction Logs" wizard, but instead we had to use the various system stored procedures after restoring a copy of the database on the remote domain in standby mode.

We now have an issue where users are unable to access the remote secondary database without having sysadmin privileges. Clearly we want to avoid this!

We want to be able to use Windows Authentication mode on the server of the secondary database. But since the two domains differ, is it possible to even achieve this?

How can we set up read-only access for users on the secondary database without giving them sysadmin privileges?

View 3 Replies View Related

Cannot Use The Special Principal 'sa'

Aug 29, 2006

Hello,

I am starting to use SQL Server 2005. I am having trouble connecting remotely. I tried to enable the 'sa' user and got this error:

Cannot use the special principal 'sa'

Is the 'sa' user no longer valid for remote connections?

Thank you





View 11 Replies View Related

Server Principal Already Exists

Jul 7, 2014

I have deleted a windows login user under security in SQL 2012 Management Studio. The users have also been removed from the associated databases. When I try to add back the login, I receive the message 'The server principal 'xxxx' already exists'. What do I need to do so that I can re-add the login ?

View 1 Replies View Related

Principal To Proxy Problem

Aug 8, 2007

I can successfully execute my package via Business Studio but when I schedule it in SQL Agent I get the error message, 'could not get proxy data for proxy id = 2.' I am trying to execute the scheduled job with that proxy (call it abcd_proxy) because I have a logon id (call it abcd) with access to a specific network drive folder, which holds a required source flat file. The abcd logon is defined as a sysadmin account. I am unable to see that the abcd logon id is an added principal within the abcd_proxy, which I think is because the abcd logon principal has a sysadmin role. My proxy id = 2 definition looks to be defined the same way that my first proxy id was.

Does anyone have an idea about what the message means and how I can fix it?

View 1 Replies View Related

Not In Correct State To Become Principal

Jan 4, 2006

I am using asynchronous mirroring. When I try to failover on the mirror server using €œalter database xxx set partner force_service_allow_data_loss€? (having disconnected the primary server from the network) it sometimes fails to failover (it reports that the database is not in the correct state to failover). I can re-connect the primary server, get them sync€™d again, then unplug the primary and it will failover ok.

Any ideas... or is this just an issue that will be fixed in the next SP?

View 5 Replies View Related

How To Only Backup Principal, Not Mirror

Apr 13, 2007

I have a Server Agent Job that does a full backup of my principal database. I then have a separate job which does an incremental backup of the log files every 20 mins throughout the working day - the incremental backup sends me an email if it fails.

If I establish a failover to the mirror server, the backups continually try to run, sending me an email every 20 mins telling me that it can't back up the database as it's a Mirror.

Is there any way to script a method in the job that checks to see if the DB is a principal or mirror. if it's a principal I want the backup to happen, if it's a mirror I want it to skip the job.

Thanks in advance to anyone that can help

Niels

View 8 Replies View Related

Explanation Wanted About The Service Principal Name ( SPN )

Jun 26, 2007

Hello,



In the ErrorLog of my Sql Server , i found this line :

2007-06-26 05:35:18.37 Serveur The SQL Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.


Operating System XP Home SP2

SQL Server 2005 Express Edition with Advanced SP1 )



( idem for another workstation with XP Pro SP2 and same version of SQL Server 2005 Express



My problem is :

i want use the windows authentification but my computers are on Worhkgroup linked by a router ( no window server )

i have read that's possible to connect from a remote computer to a computer having a SQL Server 2005 Express through SPN

How can i do it ? ( activating NTLM ? but how ?)

I'm writing a C# program which must be executing on several computers with a SQL Server 2005 Express installed on a particular computer. These computers will belong to a domain of Windows Server 2003.

As i can't connect to this "normal" network, i am trying to simulate this network at home because i want to test this program and especially the possible locks problems.

I don't know whether i'm querying with the "correct" forum.

Sorry for my poor english.

I shall appreciate any help about this problem

Have a nice day

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved