Unix Technical Forum

(newbie) How to get around table name qualification?

This is a discussion on (newbie) How to get around table name qualification? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> An apology in advance: I'm only sideways involved in Oracle databases and know very little about them. If it ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 12:19 PM
Jeroen ter Hofstede
 
Posts: n/a
Default (newbie) How to get around table name qualification?

An apology in advance: I'm only sideways involved in Oracle databases
and know very little about them. If it seems that I'm not knowing what
I'm talking about, that may very well be true.

I'm writing an application that uses a database, via ODBC, for its own
private storage. It itself creates the necessary tables, columns and
indices, as it knows best what it needs to store and does not want to
bother the users with it. This table-creating is part of a separate
step in set-up, afterwards the application only needs to write and
read data.

Some of our customers want to run the application on their Oracle
database (ranging from 8i to 10i, currently). I don't have any DBA
skill worth mentioning, let alone Oracle DBA skills, and I'm stuck on
the following.

Due to security concerns, it is mandatory that the Oracle user account
that is used to access the database during normal operation has no
more than read and write rights. Another, much more privileged, user
account is to be used during set-up to create the tables.

It appears however that tables created by this more privileged account
cannot be "seen" by the normal account. If I create tables with a user
called "creator", table names appear to be prefixed with this name,
e.g. table "T100" becomes "creator.T100". If the account "user"
attempts to access "T100" it gets the error message that no such table
exists. (As an interesting side note: the table /does/ show up if user
"user" performs a SQLTables() call in ODBC, however it is not found
when executing SQL statements.)

Of course, I could add an option to prefix each table name with a
configurable name; or I could require that the user account to create
the tables has a specific known name so I can hard-code it - these
"solutions" are very ugly however, and I suspect that there are much
better ways to handle this.
With MS SQL Server it is sufficient to map the user account doing the
creation to 'dbo,' all tables created by this account seem to be
accessible from all other users with no need to prefix the table
names. Does Oracle has a comparable feature, or perhaps an
incomparable one that solves the issue?

Thanks in advance,
Jeroen

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 12:20 PM
Frank van Bortel
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On 19 feb, 14:35, "Jeroen ter Hofstede"
<jeroen.ter.hofst...@wanadoo.nl> wrote:
> An apology in advance: I'm only sideways involved in Oracle databases
> and know very little about them. If it seems that I'm not knowing what
> I'm talking about, that may very well be true.
>
> I'm writing an application that uses a database, via ODBC, for its own
> private storage. It itself creates the necessary tables, columns and
> indices, as it knows best what it needs to store and does not want to
> bother the users with it. This table-creating is part of a separate
> step in set-up, afterwards the application only needs to write and
> read data.
>
> Some of our customers want to run the application on their Oracle
> database (ranging from 8i to 10i, currently). I don't have any DBA
> skill worth mentioning, let alone Oracle DBA skills, and I'm stuck on
> the following.
>
> Due to security concerns, it is mandatory that the Oracle user account
> that is used to access the database during normal operation has no
> more than read and write rights. Another, much more privileged, user
> account is to be used during set-up to create the tables.
>
> It appears however that tables created by this more privileged account
> cannot be "seen" by the normal account. If I create tables with a user
> called "creator", table names appear to be prefixed with this name,
> e.g. table "T100" becomes "creator.T100". If the account "user"
> attempts to access "T100" it gets the error message that no such table
> exists. (As an interesting side note: the table /does/ show up if user
> "user" performs a SQLTables() call in ODBC, however it is not found
> when executing SQL statements.)
>
> Of course, I could add an option to prefix each table name with a
> configurable name; or I could require that the user account to create
> the tables has a specific known name so I can hard-code it - these
> "solutions" are very ugly however, and I suspect that there are much
> better ways to handle this.
> With MS SQL Server it is sufficient to map the user account doing the
> creation to 'dbo,' all tables created by this account seem to be
> accessible from all other users with no need to prefix the table
> names. Does Oracle has a comparable feature, or perhaps an
> incomparable one that solves the issue?
>
> Thanks in advance,
> Jeroen



as lesser privileged user: "create synonym t100 for creator.t100;",
but only after you granted the privileges as creator:
grant select, insert, delete, update on t100 to <lesser_user>.
Of course, you could create public synonyms.

Don't forget to lock the creator account.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 12:20 PM
Jeroen ter Hofstede
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On 19 feb, 14:54, "Frank van Bortel" <frank.van.bor...@gmail.com>
wrote:
> On 19 feb, 14:35, "Jeroen ter Hofstede"


> <jeroen.ter.hofst...@wanadoo.nl> wrote:

[...]

> > Due to security concerns, it is mandatory that the Oracle user account
> > that is used to access the database during normal operation has no
> > more than read and write rights. Another, much more privileged, user
> > account is to be used during set-up to create the tables.

>
> > It appears however that tables created by this more privileged account
> > cannot be "seen" by the normal account. If I create tables with a user
> > called "creator", table names appear to be prefixed with this name,
> > e.g. table "T100" becomes "creator.T100". If the account "user"
> > attempts to access "T100" it gets the error message that no such table
> > exists. (As an interesting side note: the table /does/ show up if user
> > "user" performs a SQLTables() call in ODBC, however it is not found
> > when executing SQL statements.)

>
> > Of course, I could add an option to prefix each table name with a
> > configurable name; or I could require that the user account to create
> > the tables has a specific known name so I can hard-code it - these
> > "solutions" are very ugly however, and I suspect that there are much
> > better ways to handle this.
> > With MS SQL Server it is sufficient to map the user account doing the
> > creation to 'dbo,' all tables created by this account seem to be
> > accessible from all other users with no need to prefix the table
> > names. Does Oracle has a comparable feature, or perhaps an
> > incomparable one that solves the issue?

>
> > Thanks in advance,
> > Jeroen

>
> as lesser privileged user: "create synonym t100 for creator.t100;",


Yes, but that would
- either require that the code knows the user account name for the
creator account (I used "creator" as an example, actually I'd like to
leave the customer free in it). This is doable, but I was wondering
whether a more elegant solution existed;
- or that the user/dba performs these steps himself, which is a bit
painful for some seventy tables.

> but only after you granted the privileges as creator:
> grant select, insert, delete, update on t100 to <lesser_user>.
> Of course, you could create public synonyms.


II have looked into synonyms. What would solve my problem is if there
is a single command or configuration option that would map everything
from "creator" into the "user" name space; however, it looks it can
only be done per table, right?

> Don't forget to lock the creator account.


Probably, I'll leave that to the customer's DBA.


Thanks for your help.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 12:20 PM
Mark D Powell
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On Feb 19, 9:25 am, "Jeroen ter Hofstede"
<jeroen.ter.hofst...@wanadoo.nl> wrote:
> On 19 feb, 14:54, "Frank van Bortel" <frank.van.bor...@gmail.com>
> wrote:
>
> > On 19 feb, 14:35, "Jeroen ter Hofstede"
> > <jeroen.ter.hofst...@wanadoo.nl> wrote:

>
> [...]
>
>
>
>
>
> > > Due to security concerns, it is mandatory that the Oracle user account
> > > that is used to access the database during normal operation has no
> > > more than read and write rights. Another, much more privileged, user
> > > account is to be used during set-up to create the tables.

>
> > > It appears however that tables created by this more privileged account
> > > cannot be "seen" by the normal account. If I create tables with a user
> > > called "creator", table names appear to be prefixed with this name,
> > > e.g. table "T100" becomes "creator.T100". If the account "user"
> > > attempts to access "T100" it gets the error message that no such table
> > > exists. (As an interesting side note: the table /does/ show up if user
> > > "user" performs a SQLTables() call in ODBC, however it is not found
> > > when executing SQL statements.)

>
> > > Of course, I could add an option to prefix each table name with a
> > > configurable name; or I could require that the user account to create
> > > the tables has a specific known name so I can hard-code it - these
> > > "solutions" are very ugly however, and I suspect that there are much
> > > better ways to handle this.
> > > With MS SQL Server it is sufficient to map the user account doing the
> > > creation to 'dbo,' all tables created by this account seem to be
> > > accessible from all other users with no need to prefix the table
> > > names. Does Oracle has a comparable feature, or perhaps an
> > > incomparable one that solves the issue?

>
> > > Thanks in advance,
> > > Jeroen

>
> > as lesser privileged user: "create synonym t100 for creator.t100;",

>
> Yes, but that would
> - either require that the code knows the user account name for the
> creator account (I used "creator" as an example, actually I'd like to
> leave the customer free in it). This is doable, but I was wondering
> whether a more elegant solution existed;
> - or that the user/dba performs these steps himself, which is a bit
> painful for some seventy tables.
>
> > but only after you granted the privileges as creator:
> > grant select, insert, delete, update on t100 to <lesser_user>.
> > Of course, you could create public synonyms.

>
> II have looked into synonyms. What would solve my problem is if there
> is a single command or configuration option that would map everything
> from "creator" into the "user" name space; however, it looks it can
> only be done per table, right?
>
> > Don't forget to lock the creator account.

>
> Probably, I'll leave that to the customer's DBA.
>
> Thanks for your help.- Hide quoted text -
>
> - Show quoted text -


The use of Public synonyms would "map" the objects for all usernames
that connect to the database; however, only those users who have been
granted object privileges will be able to access the tables.

create table table_a
create public synonym table_a
grant select on table_a to rolename
grant rolename to userA, userB, userC.

would allow userA, userB, userC but not userD to select rows from
creator.table_a using the name table_a

For online documentation see http://tahiti.oracle.com

HTH -- Mark D Powell --

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 12:20 PM
Jeroen ter Hofstede
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On 19 feb, 16:28, "Mark D Powell" <Mark.Pow...@eds.com> wrote:

> The use of Public synonyms would "map" the objects for all usernames
> that connect to the database; however, only those users who have been
> granted object privileges will be able to access the tables.
>
> create table table_a
> create public synonym table_a
> grant select on table_a to rolename
> grant rolename to userA, userB, userC.
>
> would allow userA, userB, userC but not userD to select rows from
> creator.table_a using the name table_a


Okay, I think that would be a possible solution. The code (that knows
all the tables) could perform the
create table table_a
create public synonym table_a
grant select on table_a to rolename
and we could have the DBA perform the
grant rolename to userA, userB, userC.

In this way, the code would not have to know the user names. This
assumes that it can use a predefined role with standard access rights
(select, update, insert, delete); such a role does not seem to exist.

It starts to look like I'll have to write a batch of custom code to
address Oracle, and have the user provide a number of extra settings.
Well, so be it.

> For online documentation see http://tahiti.oracle.com


Unfortunately, one needs at least an idea for what one is looking to
be able to find anything in that enormous pile - I lack too much basic
Oracle knowledge for that, and I don't have the time to just start
reading from the beginning.


Anyway, thanks for your help.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 12:20 PM
Mark D Powell
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On Feb 20, 3:12 am, "Jeroen ter Hofstede"
<jeroen.ter.hofst...@wanadoo.nl> wrote:
> On 19 feb, 16:28, "Mark D Powell" <Mark.Pow...@eds.com> wrote:
>
> > The use of Public synonyms would "map" the objects for all usernames
> > that connect to the database; however, only those users who have been
> > granted object privileges will be able to access the tables.

>
> > create table table_a
> > create public synonym table_a
> > grant select on table_a to rolename
> > grant rolename to userA, userB, userC.

>
> > would allow userA, userB, userC but not userD to select rows from
> > creator.table_a using the name table_a

>
> Okay, I think that would be a possible solution. The code (that knows
> all the tables) could perform the
> create table table_a
> create public synonym table_a
> grant select on table_a to rolename
> and we could have the DBA perform the
> grant rolename to userA, userB, userC.
>
> In this way, the code would not have to know the user names. This
> assumes that it can use a predefined role with standard access rights
> (select, update, insert, delete); such a role does not seem to exist.
>
> It starts to look like I'll have to write a batch of custom code to
> address Oracle, and have the user provide a number of extra settings.
> Well, so be it.
>
> > For online documentation see http://tahiti.oracle.com

>
> Unfortunately, one needs at least an idea for what one is looking to
> be able to find anything in that enormous pile - I lack too much basic
> Oracle knowledge for that, and I don't have the time to just start
> reading from the beginning.
>
> Anyway, thanks for your help.


Scan the table of contents in the Concepts and DBA Administration
Guides.

Much of what a DBA needs to know is contained in these two manuals.

Then the SQL manual can provide the full options and information on
the use of DDL to create and manage objects.

The Oracle version# Reference manual provides a place to look up all
database parameters, rdbms dictionary view definitions, and basic info
on the dynamic performance views, v$.

If you are more of a developer then see the Application Developers
Guide - Fundamentals. This manual covers the topics in Concepts and
DBA Administration of most interest to a developer.

The most flexible way to manage security is via roles. CREATE ROLE
rolename [IDENTIFIED BY password]. Just have objects for specific
applications or even better job functions issue the appropriate grant
to the role. Then the role can be granted to users OR set by an
application at run time.

HTH -- Mark D Powell --



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-08-2008, 12:20 PM
Jeroen ter Hofstede
 
Posts: n/a
Default Re: (newbie) How to get around table name qualification?

On 20 feb, 15:16, "Mark D Powell" <Mark.Pow...@eds.com> wrote:

> Scan the table of contents in the Concepts and DBA Administration
> Guides.

[snip rest "reading guide"]


Thanks - that'll indeed help me find what I need.


Jeroen

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:59 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com