Best Practices Database Owner, Database Connection Method (asp)
Sep 18, 2007
Hi-
I have a sql server database, and am wring web apps to access it.
I've created databases different ways, and ended up with different owners (eg dbo, nt authority
etwork services...)
I also have connection strings using windows authentication, and some using a user name and password.
I have read that using windows authentication is the best way to go, as far as security goes, but I have noticed some connectivity issues when I upload the site to the server, and test it remotely.
What is the safest 'owner' of the database, and what's the safest way to connect?
I have a database with 'sa' as the database owner. When I detach the database and than attach it, I get the following error: "The proposed new database owner is already a user in the database". When I look in my Management Studio, I see that my database is attached and it has my domain name as database owner.
So it seems like that whenever a database is attached, SQL Server changes the database owner to the user who is attaching the database.
Am I right or is it something else?
One more question, is it good or bad to put 'sa' as the database owner for all my databases?
I have created a sql login account called "webuser" and has given public role in my database. In my asp.net application i build connection string using above account and its password . We give permission on store procedure for for the above account to execute .We dont give table level permission for the above account . When we run the application with the above settings it runs fine on test server . However Now i have transfered the databse object to live server with its permissions . Now while I executing the aspx page , I am getting above error . I have checked that the store procedure has execute permission for webuser account and dbo(i.e SA) has all the permissions for all database objects . Still why i am getting error ? (Please note , the thing is working fine in test server)
I was wondering if you guys know of a good site that talks about programmatically accessing and displaying data from a sql server 05 database in ASP.NET 2.0.I want to have a data adapter in a dataset, but I would like to create my own class file and pull the data from the adapter through code into the class. Is this the best way? Im wondering about the best practices while learning this new technology. Any articles provided would be appreciated. Thanks!
I am developing an inventory database in SQL Server. I realize there aremany commercial (as well as some non-commercial) inventory offerings, but myclient has specific requirements that would necessitate significantcustomization of any off-the-shelf application. In the end, we decided itwould be more feasible to build one to our specifications.What I am looking for are a list of best practices/recommendations for thearchitecture and modeling of an inventory database. This inventoryapplication will be for managing a wholesale products operation. It mustmanage purchase orders to the manufacturer of the products, sales invoicesfor the retail customers of the products, as well as manage product stocklevels in the warehouse. We will need a number of reports, including:1. What products are in stock.2. What products are on order from the manufacturer.3. What products are needed to fulfill outstanding sales.4. Warehouse operations (e.g., receipt of delivery, inspection, add toinventory, pull from inventory, packing lists, invoices, return toinventory, etc.)5. Sales analysis (e.g., product velocity, sales by associate, etc.)My main question is regarding the managing of products in stock. As I see itthere are three ways of accomplishing this:1. Track only transactions (products received, products shipped, etc.) andcalculate the stock based on the sum of all transactions. But as transactionvolume accumulates over time, this would get very slow and cumbersome.2. Have a table of "units in stock" and add and subtract to it astransactions occur. This has the advantage of always providing an instantsnapshot of inventory levels. But it makes it more difficult to managechanges or corrections to a transaction once it has been entered.3. A combination of the above two concepts. Choose a point in time (forexample, when the warehouse inventory is audited) and capture that in a(semi) "static" table. After that, transactions are summed as needed againstthose static numbers. The next time the warehouse is audited, the "static"table is updated and all prior transactions are archived. New transactionsare once again summed against the most recent audit numbers. Of course, thiswould mean halting operations at the time of the audit (probably not anissue for my client's business).Recommendations? Suggestions? Comments?(Btw, I've tried to find this info in books and online, but so far have notfound anything that makes specific inventory system design recommendations.If you know of a good reference, please let me know.)Thanks in advance!Michael
Are there generalized best practices with regards to which method/provider to use when accessing an Oracle database? I have used both the "Native OLE DBMicrosoft OLE DB Provider for Oracle" and the "Native OLE DBOracle Provider for OLE DB" and both seem to have their own quirks (requirement to convert to Unicode, etc) but I also have heard that I shouldn't be using an "OLE DB" source at all, but to set it up as an ADO .Net connection.
We are just beginning to implement SSIS, and are trying to establish Best Practices/Standards etc.
Are there any gotchas - performance and/or otherwise I should know about?
I am making a form that takes input for 1 to 5 students using VWD. With the help of previous posts I have been able to make the database insert query work properly. In my form I have a radio list that has the user select if they are entering information for 1, 2, 3,4, or 5 children. Depending on how many children are selected on the radio list, I am displaying the proper number of textboxes and validating the data using the handy RequiredFieldValidator. Now I am at the point where I want to perform the instert to the database depending on the selected number of children in the family. What is the general rule for best practices. Please keep in mind that it is my understanding that ALL fileds in a SQL insert statment must have data. Should I ...1) create alternative SQL statements depending on the textboxes displayed OR2) is it more common to insert a standard string or integer, depending on the datatype, into the unused textboxes to populate the unused fields? Sincerely,Mike
I want 'sa' to own all the user databases. Currently the database properties screen shows the owner as myself, 'al', but the list from the Users tab in EM for the database doesn't list me, but lists the dbo as login name 'sa'. DB_changedbowner 'sa' says:
Server: Msg 15110, Level 16, State 1, Procedure sp_changedbowner, Line 46 The proposed new database owner is already a user in the database.
BUT, who really owns the database; if it's 'sa' then why am I showing up on the properties page as the owner???
Hello,I'm using tableadapters in VWD 2005 Express to link our ASP.NET application to a SQL Server 2000 database. Initially, I used Database Explorer to drop tables into the DataSet object, which picks up the owner of the tables from the database.Recently, we had to change the owner of all objects in the database, including tables and stored procedures. When we run our application it chokes on stored procedures because the owner of the SP's has changed. My question is: how can I update tables and tableadapters in the DataSet to reflect the change in owner, without having to recreate everything in DataSet?
Hi,I just transferred my website and database (SQL 2000) to a new host who's SQL Manager doesn't support the previous username I had for the database.The previous owner of database tables etc was Database_master and now I want to change it to just Master.Please advise! Someone else designed the website for me, and honestly I have just some basic knowledge of databases and such.I would appreciate help and if possible with detailed steps.Many thanks in advance,Isje
I've got a GridView on my webform bound to a SQLDataSource (called sqlZKEWILL). Works fine as long as I hard-code the "dbo" database owner in the Select statement, as in: select EXIDV, Carton_Count, Carton_Total, dbo.ZINSPECTION where EXIDV = @CartonID The problem is that I need the database owner name to be dynamic. This will be a parameter that I read from another SQL table. For example, I'm doing this: Select USERID, DatabaseOwner from tblUsers where UserID = 'Kimm' I need to take the DatabaseOwner from this second Select statement, and use it as part of that first select statement. On the CodeBehind page, I tried replacing "dbo" with the Database Owner field (which I saved in a session variable) with the following code: Private Sub gvLineItems_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvLineItems.DataBinding sqlZKEWILL.SelectCommand = sqlZKEWILL.SelectCommand.Replace("dbo", Session("DatabaseOwner").ToString.Trim) End Sub
But I am still getting the error message: "Invalid object name: dbo.ZINSPECTION". It doesn't seem to recognize that I've replaced "dbo" with a different value.
Any thoughts on getting this to work would be appreciated.
Hello, I'm trying to access the Database Diagram of a sql database I created but am getting the error:
"The database does not have a valid dbo user" I also noticed that my NT group user was incorrect and this is the name being used as the owner of the database. How do i change this?
Hello,Does anyone know what procedure to run to show information such as theowner of a specific database for MSSQL2000? I want to make a script toloop through all the databases on a server and display owner and otherhelpful information.Best regards,Andreas
Our web application requires that when a new Organization is created,aseparate Database is to be created for the corresponding organization,so that each organization remains a separate entity with theircorresponding employees(This is our clients requirement, so that theycan later provide the backup of the database if the organizationdecides to move out). And for that what we intend to do is restore thebackup of database which already has the objects created in it.So weintend to restore a database for the new organization from the webpage.We are using SQL Server 2005 Enterprise Edition and theauthentication is SQL Server authentication, and the 'xy' login hasbeen assigned to the 'dbcreator' fixed server role only(This may benot relevant but just in case, the 'xy' login has been assigned'db_owner' fixed db rolein the main db. The web application uses this login to connect to thedatabase). When a new Organization is created, the database owner ofthe new DB should be xy, and the user mapping for the login to the'NewOrg' database should be 'dbo'. But in this case after restoringthe databasetemplate using the SQLSMO from the application(same thing happensafter restoring the database from query analyzer using the xy login)there is no user mapping to be seen and we are not able to connect tothe 'NewOrg' database using the xy login.I think most will suggest to use 'exec sp_changedbowner' to updatethe dbo, but for this we need sysadmin privileges, which we do nothave for the xy login.Please suggest the best way to go about this particularscenario(currently we are running the object creation script aftercreating the database but this is time consuming, so pls suggest onlydatabase restore method) and the also please suggest if any otherfixed server roles can be used without compromising security. Seemsthis is a design issue, pls also suggest if this post is to be made insome other appropriate groups.Thanks,MPL
I get this error when I try to view the database diagram. This is strange because it was about two weeks ago that I created and edited the database diagram. What is wrong with my login now as compared to when I did those edits?
The error suggests to use the ALTER AUTHORIZATION to change to a valid login. I am using windows authentication. If my login (the database ownere) is not the valid login then who is?
And what are the database diagram support objects that it suggests I install. I never heard of them, and where are they? Why didn't I need to install anything special when I worked on the diagrams two weeks ago?
Error message:
TITLE: Microsoft SQL Server Management Studio Express ------------------------------ Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects. ------------------------------ BUTTONS: OK ------------------------------
I restored and renamed a client database from a backup file to my laptop (both SQL Express 2005) and noticed that no owner had been assigned. I set the db-owner to SA. This database will replace a local version of the same database that was created on my laptop. (The customer has entered data...)
When I start the dataset configuration wizard in VS2005 all tables appear twice in the list. Once with the original name and once with the prefix dbo. For example: Customer and dbo.Customer.
The tables with the dbo. prefix are marked with a Red Cross in the checkbox. Hovering over them display the error message: "Element .. in the dataset references an object missing from the database. "
The tables without the dbo. prefix are not marked. When I mark these tables VS2005 indicates that the table will be renamed to Customer1. The same issue applies to all the views in the database.
Is there a way to solve this problem without having to recreate the entire dataset? I'd rather not do that cause I added some queries to the dataset and they will be lost and have to be recreated.
on 1 of my servers (actually, the dev. server I have setup up here at home), I must included the database owner everytime I select something or make a db call.
for example
select T.foo from K inner join T on T.id = K.id
must actualy be written like:
select dbo.T.foo from dbo.K inner join dbo.T on dbo.T.id = dbo.K.id
or else it wont work
what did I do wrong for this database owner thing to be a "must" when writing queries on this server.
I am getting this error while selecting the properties of one database. Property Owner is not available for Database '[TEST]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)
Hi, I use Sql server express 2005.I have two databases: db1 and db2.I use Studio Management. I connect with my administrator account 'admin'. 1) When i rightclick on db1 (and also on db2) and i take the properties / general, i see for both db: owner = servernameadmin .When i take properties / Files, i see for db1: owner = servernameadmin , but for db2, it remains empty.why and does it mean that db2 has no owner? But then, why do i see in properties / general : owner = servernameadmin? 2) i want to make 'admin' owner of db2 (for creating a database diagram), so in properties / Files, i click on the button with three dots.A windows "select database owner" appears, i click on button 'browse', but then all i see is:built-in administartorsbuilt-in userssa... Whatever i choose (e.g; built-in administrators), i get the message: an entity of database cannot be owned by a role, group ... error 15353). Why do i not get the account 'admin' in the browse windows and how to make 'admin' owner of db2? Thanks for helpT.
Hi, it has to do with my unfamiliarity with creating users and dbo privileges. I'm trying to grant access to an outside vendor to import their latest version of a database. I set them up with a user account that had db_owner privileges, however when they ran the dts process it copied all the data as new tables rather than overwriting the existing tables and the new tables were all associated with the user is created instead of dbo user. What do I need to do to facilitate this process?
I am in the process of cleaning up the security on one of our production databases. SA is already the owner of the database.
On this SQL server, there is a login that has access to this database that needs to be removed. When I uncheck this users access to this database I receive the following error message: "Error 15183. The user owns objects in the database and cannot be dropped".
How can i find out what objects this logins has ownership of and how can I change the ownership of these objects to SA?
I am using SQL Server 2005 and I was having a problem with the owner of a particular database. When I go into Database Diagrams for the database I get:
"Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects."
So I tried some different things (assigning different users as the owner) I was only able to assign one user as the owner (someone that is no longer working here), then I deleted that user (oops.). Now I still don't have an owner assigned AND I can't get into the database properties because I don't have permissions.
We have a situation where somehow several of the system databases are owned by an ID of a person no longer with the organization. This triggers a few questions: If I disable the user (it's a SQL account, not domain), will that cause any issue? What is the correct way to change the user of a system database?
I can't change the database owner..I noticed this when I went to create a database diagram and the error said the database does not have a valid owner.
So for that database I went to Properties > Files and sure enough, the owner is wrong. Why? I had changed the name of the PC recently, actually a couple of times. When I finally got the name right, I ran the following commands in the query window:
SELECT @@SERVERNAME to get the current server name and then sp_dropserver <old name>
[code]....
to change the server name.The owner in the Properties > Files is for a pc name that doesn't exist. But when I click on the '...' button to the right to select a new Database Owner I can't select the primary account on the PC.If I create a new database, it puts that old name in as the database owner.
I went down to <server>SecurityLogins and the old <pcname><username> is still listed, and I can't add the <newpcname><username> because it says that principle already exists . I'm afraid to make any other change without knowing for certain what to do.how to get a new database owner name on all the databases on this server.Do I delete that old Login and then try to add in the new name?