Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Capture DDL Changes using Change Data Capture with SQL Server 2008 ...
Business Intelligence in Collaborative Planning, Forecasting and Replenishment
Inside SQL Server Cluster Setup and Troubleshooting Techniques - Part I ...
Configure and Manage Policy Based Management in SQL Server 2008 ...

More     
 
Latest FAQ's

Cannot Start SQL Server Service
Users are able to connect to report manager but not able ...
Errors when SQL Server Snapshot Replication is Running
How to Display Server Name or IP Address in a Reporting ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> general dba >> Security Enhancements in SQL Server 2005: Schema ...

Security Enhancements in SQL Server 2005: Schema

By : Dinesh Asanka
Apr 09, 2007

Page 2 / 2



Default Schema

Although the best practice is to access database objects by specifying the fully qualified name, most of the time users access objects by providing simple select statements. In addition, most of the time users may not access several schemas. For example, accounts people will use the accounts schema while human resources people will use the HR schema. Therefore, it would be useless to specify a schema all the time. To avoid having to do this, there is an attribute called default schema for each user.

As the screenshot above indicates, HumanResources is the default schema for user dinesh. This means that when dinesh accesses database objects in the above schema, he does not have to specify the schema explicitly. However, for better performances and for good practice it is advised to specify the schema explicitly.

The following T-SQL script will assign HumanResources as the default schema for user dinesh.

ALTER USER dinesh WITH DEFAULT_SCHEMA=HumanResources



Sys Schema

The schema that you'll use most frequently is the sys schema. All the system tables, views, and stored procedures belong to this schema. To access system objects, a particular user should have permission on sys schema. For example, just as you can get users from the sysusers system table in SQL Server, you can get schema details from the sys.schema catalog view.



Upgrading from SQL Server 2000

So what will happen when you upgrade databases from SQL Server 2000 to SQL Server 2005?

Let us assume that you have upgraded a database by means of a backup and restore. You have a SQL Server 2000 database with user User2000 and this user owns a few objects. After the upgrade, you'll see a schema named User2000 whose owner is User2000. All the objects that belonged to the user have been put into the schema User2000. Because of this, you do not have to change your previous codes if you have used fully qualified texts.

Another important factor you'll need to remember is that you will not be able to delete a user after upgrading to SQL Server 2005 because that particular user is now the owner of a schema. To delete the user, you will first have to delete that user's schema or change its owner.



Conclusion

Schema is the new security enhancement in SQL Server 2005. For developers and administrators, it also reduces the hassles associated with deleting users.


<< Prev Page         








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved