473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Select privilage on all the tables in a schema.

Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1” and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .
Thanks
-Kamal.
Jun 27 '08 #1
3 3215
On Apr 25, 9:02 pm, Gladiator <vkamalnath1...@gmail.comwrote:
Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1” and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .

Thanks
-Kamal.
AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user

/Lennart
Jun 27 '08 #2
Lennart wrote:
On Apr 25, 9:02 pm, Gladiator <vkamalnath1...@gmail.comwrote:
>Any Suggestions on the below scenario will be helpful to us.

# There are 10 tables in a schema “S1” and I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.

# Initially I have given the required privileges to the user with
grant command on every table..

# But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.

# It is okay if we have less number of tables and the changes are not
frequent, But our case is the tables are changing and there are
hundreds of it.

# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .

AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user
Another alternative would be to implement an ACL-like table where each entry
in marks the access of a specific user or group to the table (or schema).
Then you create a view over each table and join with the ACL-table in the
view definition. You grant SELECT privileges to PUBLIC on each view and
the view definition takes care of the rest.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jun 27 '08 #3
On Apr 28, 11:04*pm, Knut Stolze <sto...@de.ibm.comwrote:
Lennart wrote:
On Apr 25, 9:02 pm, Gladiator <vkamalnath1...@gmail.comwrote:
Any Suggestions on the below scenario will be helpful to us.
# There are 10 tables in a schema “S1” and *I have to give select
privilege (Only read access) to a user on all the tables in the schema
“S1”.
# Initially I have given the required privileges to the user with
grant command on every table..
# *But the problem here is whenever there are new tables building in
the schema “S1”, We have to give the privilege Explicitly.
# It is okay if we have less number of tables and *the changes are not
frequent, But our case is the tables are changing and there are
hundreds *of it.
# Is there any way we to automate whenever a new table is created in
that schema the select privilege should go to user .
AFAIK it is not possible (but it would be great if someone proved me
wrong :-). I solved the problem with a script that loops over all the
tables in a given schema and grant select on each one to a user

Another alternative would be to implement an ACL-like table where each entry
in marks the access of a specific user or group to the table (or schema).
Then you create a view over each table and join with the ACL-table in the
view definition. *You grant SELECT privileges to PUBLIC on each view and
the view definition takes care of the rest.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany- Hide quoted text -

- Show quoted text -
Hi Knut,
Even i am facing the same scenarios .,, can you please explain the
solution in more details ..

Thanks,
Kanhaiya
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike | last post by:
Hello, I'm trying to understand how to map hierarchical XML data to relational database tables, but I seem to be missing something. I'm not a database expert, but I know the basics. XML seems...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
1
by: zeus | last post by:
Hi there, I am using Postgresql 7.3 and I want to grant select rights to a user on all tables in a schema, including those that may be created in the future but whose names are not yet known. I...
19
by: Shwetabh | last post by:
Hi, I have two tables: Code and Color. The create command for them is : create table Color( Partnum varchar(10), Eng_Color char(10), Span_Color char(20), Frch_Color char(20), CONSTRAINT...
11
by: MurdockSE | last post by:
Greetings. My Situation: // I have an .xml file that I am reading into a dataset in the following code - DataSet ds = new DataSet("MyDataset"); ds.ReadXml(@"c:\data\"+cmyxmlfilename);
2
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two...
4
by: Chris | last post by:
Can't seem to figure out how to do this and have been reading for some time now...... I want to select a row count from a table name in SYSTABLES. This statement does not return what I needed,...
4
by: tshad | last post by:
How do I tell DataAdapter that Column 2 and 3 are string and not integer? Following is the example data that comes from the .csv file FEDERAL TAX,1084,0000 COREHCR,1084,0000 CLIENT P,1084,0000...
4
by: dkirkdrei | last post by:
I am having a problem getting results back from a SELECT statement using the script below. The field names contain decimals and I am not sure wether or not this is causing the problem or not?? I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.