Why generate object-oriented database schema

Let me begin with an example:
public class Base
protected int id = 0;
protected String name = null;
public class Derived extends Base
protected int type = 0;
Derived class and Base class form an object-oriented inheritence. After
using SchemaToolTask, the following table definition is generated :
create table base
id INT NOT NULL,
name VARCHAR(255),
PRIMARY KEY (id)
create table derived
id INT NOT NULL,
type INT,
PRIMARY KEY (id)
Actually, RDBMS is ER-oriented. Every meaningful entity corresponds to a
database table. But in this example, maybe "Base" has no any meaning, just
for abstraction. So why we must generate this table ? Why cannot be
configurated to just generate
create table derived
id INT NOT NULL,
name VARCHAR(255),
type INT,
PRIMARY KEY (id)
This will not only avoid join operation in SELECT, but also reduce the table
size according to Base class.
Thanks
Liang Zhilong
EMail : [email protected]
Tel : (021)54235858-6650
Fax : (021)54235800
PhotonicBridges Co., Ltd.
12F, 900 Yi Shan Rd., Shanghai 200233

As I said, this is quite high on our project plans.
On Wed, 25 Jun 2003 14:41:29 +0800, Liang Zhilong wrote:
I believe your concern is reasonable. However, in our application, the
operation you assumed( to find all base instances owned by class C) is
rare, so it'll be useful if my suggested mapping is taken as an option.
Moreover, we should not get better performance at the cost of worse
database schema. Kodo should have enough capacity to optimize database
operations. For example, to find all base instances owned by class C, kodo
should issue a "SELECT col1, col2 FROM a UNION SELECT col1, col2 FROM b".
"Stephen kim" <[email protected]>
??????:[email protected]...
This sort of mapping is on our project plan but know that there a number
of severe performance penalties that can happen with the mapping you
describe. If you desire to lack the join, a flat-class mapping is the
most efficient table structure.
Take for example the multiple classes problem:
base
|_ A
|_ B
which would result in table a and table b. Now try to do an ordering
query. You would issue 2 selects and then have to merge in memory. To
do any relation join, again you multiply the number of SQL statements by
the number of subclasses (e.g. to find all base instances owned by class
C, you would have to query against a and b).
On Wed, 25 Jun 2003 12:39:39 +0800, Liang Zhilong wrote:
Let me begin with an example:
public class Base
protected int id = 0;
protected String name = null;
public class Derived extends Base
protected int type = 0;
Derived class and Base class form an object-oriented inheritence.
After using SchemaToolTask, the following table definition is
generated :
create
table base
id INT NOT NULL,
name VARCHAR(255),
PRIMARY KEY (id)
create table derived
id INT NOT NULL,
type INT,
PRIMARY KEY (id)
Actually, RDBMS is ER-oriented. Every meaningful entity corresponds to
a database table. But in this example, maybe "Base" has no any
meaning,just
for abstraction. So why we must generate this table ? Why cannot be
configurated to just generate
create table derived
id INT NOT NULL,
name VARCHAR(255),
type INT,
PRIMARY KEY (id)
This will not only avoid join operation in SELECT, but also reduce the
table size according to Base class.
Thanks
Liang Zhilong
EMail : [email protected]
Tel : (021)54235858-6650
Fax : (021)54235800
PhotonicBridges Co., Ltd.
12F, 900 Yi Shan Rd., Shanghai 200233--
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com

Similar Messages

  • Only oracle object tables to create object oriented database

    Can we use only oracle object tables for a database and if it can be done, can we create pure object oriented database with oracle. How it can be done?
    help..
    thank you..

    PriyashanthaHP wrote:
    I have no my own definitions for OODB. There are lot in the internet. I'm asking, can't we use that OODB concept with oracle. And gave you an example with 'employee' and 'department' tables. I asked that can we create object tables for these two tables keeping their relationship
    thank you..
    There is no way to answer that without knowing what YOU mean by OODB.
    See the database concepts doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/schema.htm
    Nested Tables
    You can create a table with a column whose datatype is another table. That is, tables can be nested within other tables as values in a column. The Oracle database server stores nested table data out of line from the rows of the parent table, using a store table that is associated with the nested table column. The parent row contains a unique set identifier value associated with a nested table instance.
      Oracle Database Object-Relational Developer's Guidefor further information on nested tables
      Oracle Database Advanced Application Developer's Guide

  • Is oracle OODBMS (Object Oriented database management system)?

    Hello, All
    Is oracle OODBMS (Object Oriented database management system)? and if yes, please explain.
    I have query in my mind so, I just posted here.
    Regards,
    Rahul
    Edited by: Rahul K. Thakar on Nov 3, 2010 12:03 PM
    Edited by: Rahul K. Thakar on Nov 3, 2010 12:04 PM

    I believe the precise answer is that Oracle is ORDBMS (Object-Relational DBMS).For a brief period in time Oracle Corporation offered a product called Object Oriented Oracle (OOO).
    It was such a wonderous product that it was buried in the trash can of history when it did neither task very well.

  • Object Oriented Databases

    Has anyone had any experience with connecting Forte with an Object Oriented
    Database (such as ObjectStore)?
    Two things:
    1. Impact on application architecture
    2. Speed of database operations.
    Thanks
    Dan Parker
    Michelin North America (Canada) Inc
    902 753 1789
    This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
    the system manager.
    This footnote also confirms that this email message has been swept by
    MIMEsweeper for the presence of computer viruses.
    The E-Mail System is to be used for business purposes only.
    www.mimesweeper.com
    **********************************************************************

    Bump?

  • Is Berkeley an object-oriented database?

    As the subject described, please help me to understand if the Berkeley is an object-oriented, or a data structure based database.

    Hi Kevin,
    A Berkeley DB database is like a relational table. Data is stored as key/data pairs and a key/data pair (a record) is similar to an RDBMS row with a primary key.
    What Berkeley DB is not: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/intro/dbisnot.html
    What is Berkeley DB: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/intro/dbis.html
    Do you need Berkeley DB?: http://www.oracle.com/technology/documentation/berkeley-db/db/ref/intro/need.html
    Bogdan Coman

  • Sites on Object Oriented Databases??????

    Hi
    I want some help on OOD. Please recommend some sites on this topic.
    Thanks

    Amjad,
    Oracle database is an Object-Relational Database. In addition to relational functionality, Oracle8i and 9i also provide Objects features with user-defined types, type inheritance, as well as corresponding language APIs in Java, XML, C/C++, PL/SQL, and VB. You can check out the documentation at http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88878/toc.htm. You can also posted your questions to'Oracle Objects' forum.
    Regards,
    Geoff

  • Object Oriented Databases and entity beans?

    Does one of the authors care to comment on the benefits of using OODBMS models versus RDBMS models for entity beans? Any differences between BMP and CMP in this scenario?
    Thanks!
    Peter

    Bump?

  • Problem with database schema objects in the entity object wizard

    Hi All,
    When creating a new entity object, I am facing a problem with database schema objects in the entity object wizard, database schema objects (check boxes for tables,synonyms...) are disabled. Actually I am using a synonym but I am not able to select the synonym check box.
    Can any of you folks tell me how to enable the database schema objects (check boxes for tables,synonyms...).
    Thanks in Advance.
    Raja.M

    Make sure your using rite version of jdeveloper..
    Make sure your using apps schema and check whether your able perform DML operations in the schema vis sql developer.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • Generate database schema in XML from database structure

    hi
    I want to generate the entire database schema in XML from database structure. (Same feature is provided by Altova XMLSpy).
    It would be great if there was some API that does the process of parsing the database structure and generating the XML automatically. A similiar feature is provided by Apache DdlUtils' API, but a stable version is not yet available...
    Please help!
    Thanks in advance.

    Nikhil,
    There is a wealth of information available on the Internet regarding the XML capabilities of the Oracle database.
    Have you done an Internet search for "SQL XML Oracle"?
    Good Luck,
    Avi.

  • Object Oriented? Or Not?

    Perhaps the way I raised this question would be peculiar for you as I'm a newbie!
    I'm willing to use oracle object oriented programing for my applications, and some senior people(work in my organization) told me that Object oriented database concept is failed in the industry. As a reason they say that; even if Object oriented databases solved some problems people had with relational databases, still Object oriented databases are failed to facilitate most of the advantages of relational databases. It's somewhat chaotic for me, as I'm new to PL developments.
    They didn't mention any specific reason; but just told me that relational databases perform well and faster than object oriented databases, and for business logic, object oriented databases has some accuracy issues.
    But I'm not ready to accept that it will be useless to learn 'Oracle Object Oriented Programing' or 'Object Oriented Database Concept' would be failed.
    So I need to know,
    1. Will it be useless to learn & use 'OOP' techniques when learning PL/SQL programing?
    2. Is there any disadvantage of using 'OOP' with oracle? (If there is any, please let me know if you have time for that).
    Especially, (The most pleasing answer I would like to hear from you ;-) )
    3. If Object Oriented Databases concept is better and something that a "PL/SQL" developer must learn; please let me know that.
    Please provide me a link if you can, which would help me to learn why should we use 'OOP' with oracle (if Object oriented database is better than Relational database)

    Intruder wrote:
    So I need to know,
    1. Will it be useless to learn & use 'OOP' techniques when learning PL/SQL programing?No. OOP has very little do with relational database design. The two is not mutually exclusive and can co-exist easily.
    2. Is there any disadvantage of using 'OOP' with oracle? (If there is any, please let me know if you have time for that).That depends on how+ you use it. If OOP was truly horrible and bad, then why does Oracle spend money on the research and development on it for their RDBMS product?
    Especially, (The most pleasing answer I would like to hear from you ;-) )
    3. If Object Oriented Databases concept is better and something that a "PL/SQL" developer must learn; please let me know that.OOP is not Object Orientated Database. These are two very different concepts. OOP competes with procedural programming. Object Orientated Database design competes with Relational Database Design (and others of course).
    There are two primary issues with an Object Orientated Database design. Complexity. Performance.
    Do you for example store the subclasses of the same abstract class in the same physical object table? You can do that in Oracle.. but then the database need to resolve the class type at run-time.. every single time.. for every single object accessed... At what cost ito performance?
    How do you treat collection classes? A collection can be stored as a physical table. It can also be stored as an attribute (column) of an object (table) - in which case the physical implementation for that is a nested table. There are dire performance issues with nested tables when these are used and applied incorrectly.
    There are numerous such issues.
    Compare this with something as mature and robust as Relational Database Design. Easy to understand. Easy to use. And what the Oracle RDBMS product was specifically designed to support.
    Which one is "+better+" (especially in the Oracle RDBMS environment)? It should be obvious.
    I suggest that you read Codd's original paper on "+A Relation Model of Data for Large Shared Data Banks+", read "+The Third Manifesto+" from Chris Date, and papers from various other authors for insight.

  • Can I develop a 100% Object Oriented DB with Oracle 11?

    Hello!
    I want to know if I can develop a 100% object oriented data base in Oracle 10g or 11? I have reed the "Oracle Database 11g The Complete Reference" chapter 41 "Advanced Object-
    Oriented Concepts" and I still have the doubt if I can implement a database 100% object-oriented. I hope you can help me.
    Thanks!

    >
    I want to know if I can develop a 100% object oriented data base in Oracle 10g or 11?
    >
    The short answer is no.
    See this AskTom blog for the long answer.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1545206281987
    It starts off with Tom saying
    >
    First off, in Oracle you would be considering pure relational versus Object RELATIONAL,
    not OO. We have object relational extensions to the relational database. We do not have
    an object oriented database.
    >
    I think you will find a lot of infomation in there from Tom and other respondents about the differences between relational, object relational and object oriented.

  • Can I develop a 100% Object Oriented DB with Oracle 10g?

    Hello!
    I need to know if I can develop a pure Object Oriented Data Base? because I have been looking for this information, and I just found Oracle's arquitecture is oriented to relational object model.
    Thanks!
    Edited by: 925803 on 05-abr-2012 10:39

    Dear "925803",
    1) You're asking this question in the Oracle Application Express discussion forum - not really related to generic Database questions. This Database forum may be more suited: General Database Discussions
    2) The Oracle database is not an object-oriented database.
    Joel

  • Relational or Object-oriented

    Hi everyone,
    I'm just a novice in db design and have been given the task to design a db for our app. The app data consists of multiple Java node objects (as many as the user can think of, and needs to have) that, most of the time, have references to the parents and children (nodes). The main goal is to facilitate searching of objects (based on attributes) and object sharing. The objects are composite, meaning they contain links to others that contain links to many others.
    I'm confused of which, relation or object oriented, databse is a better fit for the design. So far, several questions have popped up like:
    1. To represent links (to other objects), which, an object id or a primary key, is better?
    2. How to represent Java vector and hashtable in db?
    3. If objects A and B link to C, after A and C are loaded, then if B is loaded, how do I know to share the copy of C (from A) instead of creating a new one?
    Any help from you db experts, or if i can be pointed to the right direction, is greatly appreciated. And forgive me if I ask stupid questions.
    Thanks,

    You can use either a relational or an object-oriented database to store this sort of information. An object-oriented design may well be easier to build an object-oriented database if the goal is basically to use a database as a persistent bitbucket of objects that you will instantiate in an application server.
    My preference, however, would be to use a relational database because that makes the data much more accessible to other applications. In most cases, if the data is valuable enough to want to write an application around, it is valuable enough to want to ensure that it survives any particular application. Relational databases are much better at this than are object databases, which necessarily enshrine a particular way of looking at the data.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Database schema SCM does not contain the associated database objects

    I am getting the following error when i am trying to migrate the form to apex using application migration.
    "*Database schema SCM does not contain the associated database objects for the project, aafs.*
    *Ensure the database schema associated with the project contains the database objects associated with the uploaded Forms Module .XML file(s).* ".
    Actully i am having one schema which i named as SCM, and i have defined one table TT.
    I created one form test.fmb in which i used TT table.its compiled successfully.
    Then i generated the xml file using frmf2xml from fmb file. After that, I created the project in appication migration wizard in SCM schema.
    Project creattion is working fine.but when i m trying to create application,it is showing me above error.
    can any one help in solving this problem.

    Hi Hilary,
    Thanks for your response/feedback.
    1. The schema associated with the project does not contain the necessary objects Can you please verify that the schema associated with your Forms conversion project does in fact contain the objects associated with the uploaded files. Could you also verify that the object names referenced in the error message do not exist within the schema associated with your workspace. Ensure that the schema associated with the project contains the necessary database objects before proceeding to the generation phase of the conversion process.
    Ans:
    Yes it does contain the objects (See results from SQL query Commands below):
    SELECT MWRA_CONTRACT_NO, OLD_CONTRACT_NO FROM PROJECTS@CONTRACT_LX19.MWRA.NET
    ORDER BY MWRA_CONTRACT_NO
    000000569 551TA
    000000570 553TA
    000000575 560TA
    000000576 561TA
    000107888 502TA
    000108498 500TA
    000108502 503TA
    2. The block being converted contains buttons, which may have been incorrectly identified as database columns, and included in the original or enhanced query associated with your block This is a known issue ,bug 9827853, and a fix will be available in our upcoming 4.0.1 patch release. Some possible solutions to this issue are:
    -> delete the buttons before generating the XML
    -> delete the button tags from the XML
    -> add "DatabaseItem=No" for the button in the XML file before importing it in Apex.The button is excluded when creating the Application.
    Ans
    yes it does contain push buttons to transfer to another forms and these are defined as Non data base items. Parial XML code provided below:
    - <Item Name="REPORTS" FontSize="900" DirtyInfo="true" Height="188" XPosition="4409" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3709" FontSpacing="Normal" Label="REPORTS" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    <Trigger Name="WHEN-BUTTON-PRESSED" TriggerText="GO_BLOCK('REPORT_1');" />
    </Item>
    - <Item Name="TRACKHDR" FontSize="900" DirtyInfo="true" Height="188" XPosition="3409" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3709" FontSpacing="Normal" Label="TRACK" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    <Trigger Name="WHEN-BUTTON-PRESSED" TriggerText="GO_BLOCK('TRACKHDRS');" />
    </Item>
    - <Item Name="SUBAWRD" FontSize="900" DirtyInfo="true" Height="188" XPosition="2429" FontName="Fixedsys" ForegroundColor="black" DatabaseItem="false" Width="948" CompressionQuality="None" YPosition="3719" FontSpacing="Normal" Label="SUBAWARDS" BackColor="canvas" FillPattern="transparent" ShowHorizontalScrollbar="false" FontWeight="Medium" ShowVerticalScrollbar="false" FontStyle="Plain" ItemType="Push Button">
    3. If you are still experiencing issues, then please create a testcase on apex.oracle.com and update this thread with the workspace details so I can take a look.
    Test case details are given below. It was created per ORACLE for open Service Request Number 3-1938902931 on ORACLE Metalink.
    Workspace: contract4
    username: [email protected] (my email)
    Password: contract4
    Comments:
    For my migration/testing purpose a dabatase link and synonyms have been setup by our ORACLE DBA. Could this be causing this problem?
    Do we know when the fix 4.0.1 patch release will be available?
    Thanks for your help.
    Indra

  • The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229

    I have a SQL Server connected intro a Windows Server 2003 Domain Active Directory, the server holds a default instance with a single Database, the SQL Server is 2005 Std Edition, and is using mix mode Authentification, then I able to create SQL Native Users
    and Invoque Windows Domain Users also.
    The Goal of this project is remove the sysadmin Server role for all the Windows Domain Users, to give then a more granular secure model but at the moment is this only way to connect at the Data Base Server.
    I already create Native SQL Servers users without any problem!, they respect Securable Setting, Server Roles, User Mapping, everything...Just when I create a Login Profile form a Domain Users and apply the same setting, I get this error...
    The SELECT permissions was denied on the object 'extended_properties', database 'mssqlsystemresource', schema 'sys'.(Microsoft SQL Server, Error:229)
    But if the user have sysadmin Server Rol he can sing over the server without any issue, I review the .sys view extended_properties and "Public" is the only Database Role placed.
    Any Idea if I need change any Setting in the Secure in SQL Master DataBase? or which is the issue witjh this matter?
    Thank in advance for your help!

    Since there are so many possibilities for what might be wrong.  Here's another possibility to look at.  I ran into something where I had set up my own roles on a database.  (For instance, "Administrator", "Manager", "DataEntry",
    "Customer", each with their own kinds of limitations)  The only ones who could use it were "Manager" role or above--because they were also set up as sysadmin because they were adding users to the database (and they were highly trusted). 
    Also, the users that were being added were Windows Domain users--using their domain credentials.  (Everyone with access to the database had to be on our domain, but not everyone on the domain had access to the database--and only a few of them had access
    to change it.)
    Anyway, this working system suddenly stopped working and I was getting error messages similar to the above.  What I ended up doing that solved it was to go through all the permissions for the "public" role in that database and add those permissions
    to all of the roles that I had created.  I know that everyone is supposed to be in the "public" role even though you can't add them (or rather, you can "add" them, but they won't "stay added").
    So, in "SQL Server Management Studio", I went into my application's database, in other words (my localized names are obscured within <> brackets): "<Computername> (SQL Server <version> - sa)"\Databases\<MyAppDB>\Security\Roles\Database
    Roles\public".  Right-click on "public" and select "Properties".  In the "Database Role Properties - public" dialog, select the "Securables" page.  Go through the list and for each element in the
    list, come up with an SQL "Grant" statement to grant exactly that permission to another role.  So, for instance, there is a scalar function "[dbo].[fn_diagramobjects]" on which the "public" role has "Execute" privilege. 
    So, I added the following line:   
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @RoleName + '];' )
    Once I had done this for all the elements in the "Securables" list, I wrapped that up in a while loop on a cursor selecting through all the roles in my roles table.  This explicitly granted all the permissions of the "public" role to
    my database roles.  At that point, all my users were working again (even after I removed their "sysadmin" access--done as a temporary measure while I figured out what happened.)
    I'm sure there's a better (more elegant) way to do this by doing some kind of a query on the database objects and selecting on the public role, but after about half and hour of investigating, I wasn't figuring it out, so I just did it the brute-force method. 
    In case it helps someone else, here's my code.
    CREATE PROCEDURE [dbo].[GrantAccess]
    AS
    DECLARE @AppRoleName AS sysname
    DECLARE AppRoleCursor CURSOR LOCAL SCROLL_LOCKS FOR
    SELECT AppRoleName FROM [dbo].[RoleList];
    OPEN AppRoleCursor
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    WHILE @@FETCH_STATUS = 0
    BEGIN
    EXEC ( 'GRANT EXECUTE ON [dbo].[fn_diagramobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[all_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[allocation_units] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assemblies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_references] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[assembly_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[asymmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[certificates] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[change_tracking_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[check_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[column_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[computed_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_endpoints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[conversation_priorities] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[crypt_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specification_details] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_audit_specifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_files] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_permissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principal_aliases] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_principals] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[database_role_members] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[default_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[destination_data_spaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[event_notifications] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[extended_properties] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[filegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_key_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[foreign_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_catalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_catalog_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_index_fragments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stoplists] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[fulltext_stopwords] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[function_order_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[identity_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[index_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[internal_tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_constraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[key_encryptions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[message_type_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[module_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedure_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[numbered_procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_type_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameter_xml_schema_collection_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_functions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_range_values] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partition_schemes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[partitions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[plan_guides] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[procedures] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[remote_service_bindings] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[routes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[schemas] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_message_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contract_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_contracts] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_message_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queue_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[service_queues] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[services] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_index_tessellations] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[spatial_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_dependencies] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[stats_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[symmetric_keys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[synonyms] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscolumns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syscomments] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysconstraints] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysdepends] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfilegroups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfiles] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysforeignkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysfulltextcatalogs] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysindexkeys] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysmembers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysobjects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[syspermissions] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysprotects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysreferences] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_columns] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_objects] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_parameters] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_sql_modules] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[system_views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[systypes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[sysusers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[table_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[tables] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[transmission_queue] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[trigger_events] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[triggers] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[type_assembly_usages] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[views] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_indexes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_attributes] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_collections] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_component_placements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_components] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_elements] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_facets] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_model_groups] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_types] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcard_namespaces] TO [' + @AppRoleName + '];' )
    EXEC ( 'GRANT SELECT ON [sys].[xml_schema_wildcards] TO [' + @AppRoleName + '];' )
    FETCH NEXT FROM AppRoleCursor INTO @AppRoleName
    END
    CLOSE AppRoleCursor
    RETURN 0
    GO
    Once that is in the system, I just needed to "Exec GrantAccess" to make it work.  (Of course, I have a table [RoleList] which contains a "AppRoleName" field that contains the names of the database roles.)
    So, the mystery remains: why did all my users lose their "public" role and why could I not give it back to them?  Was this part of an update to SQL Server 2008 R2?  Was it because I ran another script to delete each user and add them back
    so to refresh their connection with the domain?  Well, this solves the issue for now.
    One last warning: you probably should check the "public" role on your system before running this to make sure there isn't something missing or wrong, here.  It's always possible something is different about your system.
    Hope this helps someone else.

Maybe you are looking for

  • Annoying single page view in full screen mode

    I have checked the "Enable Scrolling" in the "View/Page Display" menu to have a continuous page flow (with gaps between pages) and avoid page bouncing when moving from the bottom of a page to the top of the next page. It works as expected when in win

  • How Can I download Aps in orker country?

    Hi! I want to download a ap that only exist in USA, so when i press the ad in the Internett I get a message from Apstore that the ap only exist in USA and if I would like to change country, but when i press download it said that my aple Akcount only

  • My iPod could not be restored

    The other day my iPod stopped working. I went to turn it on the screen flashed white several times and I ended up with it asking me to connect it to iTunes. I connected it to iTunes and it said that my iPod could not be restored (40) I've done all of

  • Color correcting globally

    Is there anyway I can color correct a 20 page doc, (booklet) in Indesign globally? If not is there a easy work around without opening all the images in photoshop?  Cheers Zac

  • How do I delete an album of pictures on my phone that won't delete when I click "Edit Albums?"

    So, my boyfriend gave me his old phone. There is an album with pictures of him and his ex girlfriend.. I want to delete them so bad, but cannot. Whenever I go to my albums and click edit, it won't let me delete the album. I've tried doing it on iTune