User Access to all tables of a database
Hi,
Is it possible to create a user that has access to all tables in a particular database? I know I can grant permissions on individual tables, but I would like to create a user that can add, delete, and insert data into any table in the database. This is easy in MSSQL, but not so easy with MaxDB
Thanks and Kind Regards,
Diana Hoppe
It's not so easy, because it's a nonsense requirement!
While it may be convenient to be able to just access data and db-objects during development, this becomes a nightmare on production.
It's far easier and usually better to create schemas to put the database objects in and roles that have the required permissions.
Then you can grant the roles to the users that need them.
This way you've cleanly separated the naming (schemas) from the permission (roles/users/grants) aspect.
A common approach for this is:
- SYSDBA user (e.g. SUPERDBA) owns the application schemas and can create/alter the objects in it
- SYDBA also owns the roles and users.
One step more secure would be to have a specific user own the application schemas - just like it is the case for NetWeaver databases.
With this, you can have your DBAs have their superuser access to the database and still not the super-easy option to look at the data.
regards,
Lars
Similar Messages
-
Give user Read-Only access to one table in a database.
Does anyone know how to give a user account Read-only access to 1 table within a SQL Server Database using SQL Server Management Studio? I don't want the account to be able to access any other tables in the database, just the one table. I'm not a sql programmer,
so if there is a way to do it in Sql Server Managment Studio settings that would be the best.Using Management Studio, I assume you already have a login and user for that person. If not,
How to: Create a SQL Server Login http://msdn.microsoft.com/en-us/library/aa337562.aspx
How to: Create a Database User
http://msdn.microsoft.com/en-us/library/aa337545.aspx
1. Then, in Object Explorer, expand the Database, expand
Tables, right-click the table you want, and then click
Properties.
2. On the Permissions page, under Users or Roles, click
Search, then Browse, etc, until you find the user. Click
OK until you are back to the Permissions page.
3. In the Permission for <user>section, find the
SELECT (that's the read permission) and click the Grant
box. Then click OK.
Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty -
How get all table name from database
hi master
sir
how get all table name from databaseThe big question is 'why'.
Selecting from view 'dba_tables' will indeed give the list of all tables in the database, but that includes the dictionary tables and the internal tables, and many others that are probably not of interet to a person who needs to ask this question. Besides, the dba_tables view requires access to a DBA account.
There are several other views: "user_tables" will list all the tables in this user's schema; and "all_tables" will list all the tables this user can access in some way.
The above do not, of course, include any information about synonyms, sequences, views, indexes and so on.
The correct answer and the meaningful answer may be two different things. -
hi Friends ,i need a suggestion from you on how to
insert data to all tables on a Database "A " on Test server
Select data from all tables on a Database "A" on Production Server
where id=123
Database A is same with Structures on Test and Production also all Tables will have Id column in common.
The purpose of this insert is ,as we all know Production has the latest data and i need to push to test server on request for particular ID only ( may be weekly once or twice a week )
I have a linked server setup name "LINQ"
Example for one table is below , like wise i need a script which does for 154 tables.
Insert into ABC( id, name)---insert to test server
Select Id, name from LINQ.ProdSerevrname.databasename.ABC where id = 123
Please help me ..
ThanksWhy not use export import wizard for this if you've read access to production?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Newbie ques : How to get the list of all tables in the database
Hi,
I'm very new to Oracle (using Oracle8i currently). I wanted to know if there is a way to get the list of all tables in the database. Like in mySQL you can use the command " show tables" to get the list of all the tables.
Any help will e greatly appreciated. Please "cc" any reply to [email protected] also.
thanks
DevenHi
Select table_name, owner from all_tables;
will give u all the tables in the database.
all_tables, dba_tables, user_tables
all_objects, dba_objects, dba_objects
there are many, more tables. login as system and query the tab and try to describe the tables.
Thanks
Malar -
How to search all columns of all tables in a database
i need to search all columns of all tables in a database , i already write the code below , but i've got the error message below when run this script
DECLARE
cnt number;
v_data VARCHAR2(20);
BEGIN
v_data :='5C4CA98EAC4C';
FOR t1 IN (SELECT table_name, column_name FROM all_tab_cols where owner='admin' and DATA_TYPE='VARCHAR2') LOOP
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' ||t1.table_name|| ' WHERE ' ||t1.column_name || ' = :1' INTO cnt USING v_data;
IF cnt > 0 THEN
dbms_output.put_line( t1.table_name ||' '||t1.column_name||' '||cnt );
END IF;
END LOOP;
END;
Error report:
ORA-00933: SQL command not properly ended
ORA-06512: at line 7
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
Any help pleaseSQL solutions by Michaels
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
11g upwards
SQL> select table_name,
column_name,
:search_string search_string,
result
from (select column_name,
table_name,
'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
from cols
where table_name in ('EMP', 'DEPT')),
xmltable (str columns result varchar2(10) path '.')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME es RESEARCH
EMP ENAME es JAMES
EMP JOB es SALESMAN
EMP JOB es SALESMAN
4 rows selected. -
How do I run sp_spaceused for all tables in a database?
Hi,
I am struggling to understand how to run the sp_spaceused sproc for all tables in a database.
I know how to use it for one table but how would I replicate it automatically for each table in a given database?
Regards,
Ian.I just managed to alter the code of VidyaSagar and have pulled out all the information including Schema name. Below is what it looks like:
set
nocount
on
select
'Database Name: ',
db_name
if
exists(select
name from tempdb..sysobjects
where name='##tmp'
drop
table ##tmp
create
table ##tmp(TABLE_SCHEMA
nvarchar(256),TABLE_NAME
nvarchar(256),
num_rows int,
reserved_KB varchar(15),data_KB
varchar(15),index_KB
varchar(15),unsed_KB
varchar(15
go
declare
@tbl_schema nvarchar(256
declare
@tbl_name nvarchar(256
declare
@schema_tbl_name nvarchar(256
declare
tblname CURSOR
for
select
TABLE_SCHEMA
TABLE_NAME
from
INFORMATION_SCHEMA.TABLES
where TABLE_TYPE='BASE
TABLE'
open
tblname
Fetch
next
from tblname
INTO @tbl_schema,@tbl_name
WHILE
@@FETCH_STATUS
= 0
BEGIN
set @schema_tbl_name=@tbl_schema+'.'+@tbl_name
insert
into ##tmp(TABLE_NAME
, num_rows
, reserved_KB
,data_KB
,index_KB
,unsed_KB
exec
sp_spaceused
@schema_tbl_name
update ##tmp
set TABLE_SCHEMA
=@tbl_schema
where TABLE_SCHEMA
is
NULL
and TABLE_NAME=@tbl_name
FETCH
NEXT
FROM tblname
INTO @tbl_schema,@tbl_name
END
CLOSE
tblname
deallocate
tblname
go
select
from
##tmp
drop
table ##tmp
Warm Regards, Ajay -
How to view all table of a database
How to view all table of a database created on a oracle 9.2/10g database management system.
How to view available tables of oracle dbms which comes by default with package.
Thank you so much in advance!
With Regards,
NiksYou posted the same question twice.
How to view all table of a database -
Finding all tables of a database
hi,
i want to find out all table of a database .
how could i.
thnxtry this
DatabaseMetaData dbmd=con.getMetaData();
ResultSet rsTable=dbmd.getTables(null,null,"%",null);
while (rsTable.next())
//String tableCatalog = rsTable.getString(1);
//String tableSchema = rsTable.getString(2);
System.out.println("Table Name - "+rsTable.getString(3)+" - catalog - "+rsTable.getString(1)+" - schema - "+rsTable.getString(2)+" - Type - "+rsTable.getString(4));
rsTable.close(); -
Create user with read access for all tables SAP SID .*
Hello all,
could you please help me ? I would like to grant select privilege on all tables SAP<SID>.* for newly created user.
I have created standard database user (not exclusive).
I`m able to grant select for individual tables, but I would like to grant select for this user on all SAP<SID>
schema in simplier way
But as far as I know, the schema`s owner name must be different then schema name.
Any idea please ?
Thank you.
Pavolcreate user <user_name> identified by <password> <options>;
grant read on all tables:-
CREATE OR REPLACE PROCEDURE GRANT_SELECT AS
CURSOR ut_cur IS
SELECT table_name
FROM user_tables;
RetVal NUMBER;
sCursor INT;
sqlstr VARCHAR2(250);
BEGIN
FOR ut_rec IN user_tabs_cur;
LOOP
sqlstr := 'GRANT SELECT ON '|| ut_rec.table_name
|| ' TO <user_name>';
sCursor := dbms_sql.open_cursor;
dbms_sql.parse(sCursor,sqlstr, dbms_sql.native);
RetVal := dbms_sql.execute(sCursor);
dbms_sql.close_cursor(sCursor);
END LOOP;
END grant_select;
Edited by: varun4dba on Jan 18, 2011 4:13 PM -
How to search all columns of all tables in a database for a keyword?
Dear Team,
i have an requirement that : i want to search all the columns of all the tables in the particular database based on the specific key word or an free text.
example :
table 1: columns data
empname sam
empid 01
table 2 columns data
deptname sam
departmentid 10
table 3 columns data
organization name sam
organization id 1
when i search for text " SAM"
it should search me from the entire database, all tables and columns of it and display the result
output : tablename cloumn value
table1 empname sam
table2 deptname sam
table3 organizationame sam
the example is just an sample not the real data .
please help me with sample code or any link related to it .
thanks in advanceHi justin , thanx for the reply
the basic requirement that we required is ,
the user will just type the keyword( value in the coumn) he required and it should search all the tables and columns of the table in the database and i have to show this in the front ent in the table format. here the user will analyse the information based on the search .
it is just like the google search we does( type the keyword in free text) it will display the result.
so for that i have to search entire table and columns in the whole database.
please if any one provides me the solution it will be help full for me.
thanx in advance -
Accessing large partitioned tables over a database link - any gotchas?
Hi,
We are in the middle of a corporate acquisition and I have a question about using database links to efficiently access large tables. There are two geographically distinct database instances, both on Oracle 10.2.0.5 sitting on Linux boxes.
The primary instance (PSHR) contains a PeopleSoft HR and Payroll system and sits in our data centre.
The secondary instance (HGPAY) runs a home grown payroll application and sits in a different data centre to PSHR.
The requirement is to allow PeopleSoft (PSHR) to display targeted (one employee at a time) payroll data from the secondary instance.
For example in HGPAY
CREATE TABLE MY_PAY_DATA AS
SELECT TO_CHAR(A.RN, '00000000') "EMP" -- This is an 8 digit leading 0 unique identifier
, '20110' || to_char(B.RN) "PAY_PRD" -- This is a format of fiscal year plus fortnight in year (01-27)
, C.SOME_KEY -- This is the pay element being considered - effectively random
, 'XXXXXXXXXXXXXXXXX' "FILLER1"
, 'XXXXXXXXXXXXXXXXX' "FILLER2"
, 'XXXXXXXXXXXXXXXXX' "FILLER3"
FROM ( SELECT ROWNUM "RN" FROM DUAL CONNECT BY LEVEL <= 300) A
, (SELECT ROWNUM "RN" FROM DUAL CONNECT BY LEVEL <= 3) B
, (SELECT TRUNC(ABS(DBMS_RANDOM.RANDOM())) "SOME_KEY" FROM DUAL CONNECT BY LEVEL <= 300) C
ORDER BY PAY_PRD, EMP
HGPAY.MY_PAY_DATA is Range Partitioned on EMP (approx 300 employees per partition) and List Sub-Partitioned on PAY_PRD (3 pay periods per sub-partition). I have limited the create statement above to represent one sub-paritition of data.
On average each employee generates 300 rows in this table each pay period. The table has approx 180 million rows and growing every fortnight.
In PSHR
CREATE VIEW PS_HG_PAY_DATA (EMP, PAY_PRD, SOME_KEY, FILLER1, FILLER2, FILLER3)
AS SELECT EMP, PAY_PRD, SOME_KEY, FILLER1, FILLER2, FILLER3 FROM MY_PAY_DATA@HGPAY
PeopleSoft would then generate SQL along the lines of
SELECT * FROM PS_HG_PAY_DATA WHERE EMP = ‘00002561’ AND PAY_PRD = ‘201025’
The link between the data centres where PSHR and HGPAY sit is not the best in the world, but I am expecting tens of access requests per day rather than thousands, so I believe the link should have sufficient bandwidth to meet the requirements.
I have tried a quick test on two production sized test instances and it works in that it presents the data, when I look at the explain plan I can see that the remote database is only presenting the relevant sub-partition over to PSHR rather than the whole table. Before I pat myself on the back with a "job well done" - is there a gotcha that I am missing in using dblink to access partitioned big tables?Yes, that's about right. A lot of this depends on exactly what happens in various "oops" scenarios-- are you, for example, just burning some extra CPU until someone comes to the DBA and says "my query is slow" or does saturating the network have some knock-on effect on critical apps or random long-running queries prevent some partition maintenance operations.
In my mind, the simplest possible solution (assuming you are using a fixed username in the database link) would be to create a profile on HGPAY for the user that is defined for the database link that set a LOGICAL_READS_PER_CALL value that was large enough to handle any "reasonable" request and low enough to quickly kill any session that tried to do something "stupid". Obviously, you'd need to define "stupid" in your environment particularly where the scope of a "simple reconciliation report" is undefined. If there are no political issues and you can adjust the profile values over time as you encounter new reports that slowly increase what is deemed "reasonable" this is likely the simplest approach. If you've got to put in a change request to change the setting that has to be reviewed by the change control board at its next quarterly meeting with the outsourced DBA vendor, on the other hand, you could turn a 30 minute report into 30 hours of work spread over 30 days. In the ideal world, though, that's where I'd start.
Getting more complex, you can use Resource Manager to kill queries that run too long on the wall clock. Since the network is almost certainly going to be the bottleneck, it's probably unlikely that the CPU throttling is going to do much good-- you can probably saturate the network with a very small amount of CPU. Network throttling in my mind is an extra step up in complexity again depending on the specifics of your particular situation and what you're competing with.
Justin -
How to delete duplicate records in all tables of the database
I would like to be able to delete all duplicate records in all the tables of the database. Many of the tables have LONG columns.
Thanks.Hello
To delete duplicates from an individual table you can use a construct like:
DELETE FROM
table_a del_tab
WHERE
del_tab.ROWID <> (SELECT
MAX(dups_tab.ROWID)
FROM
table_a dups_tab
WHERE
dups_tab.col1 = del_tab.col1
AND
dups_tab.col2 = del_tab.col2
)You can then apply this to any table you want. The only differences will be the columns that you join on in the sub query. If you want to look for duplicated data in the long columns themselves, I'm pretty sure you're going to need to do some PL/SQL coding or maybe convert them to blobs or something.
HTH
David -
Creating sequences for all tables in the database at a time
Hi ,
I need to create sequences for all the tables in my database.
i can create individually ,using toad and sqlplus.
Can any one give me a code for creating the sequences dynamically at a time for all the tables.
it is urgent ..
Regards.I need to create sequences for majority of the tables that are having ID column
which is sequences."The majority" is not the same as all. So you probably want to drive your generation script off the ALL_TAB_COLUMNS view...
where column_name = 'ID'You need to think about this carefully. You might want different CACHE sizes or different INCREMENT BY clauses for certain tables. You might even (whisper it) want a sequence to be shared by more than one table.
Code generation is a useful technique, but it is a rare application where one case fits all.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
How to see all tables in a database
I need to view all the tables in a database.
What is the statement query to do that?
Please help..http://www.praetoriate.com/t_garmany_easysql_the_data_dictionary.htm
select * from all_tables;
select * from user_tables;
select * from dba_tables;
Maybe you are looking for
-
Blackberry Bold 9700 won't turn on and keeps rebooting!
My blackberry is loading, but doesn't work. I continue loading to the halpf of bar, then start loading again, and again start. But It never turn on or isn't opened screen. There has only a loading screen. How can I solve this problem? I tried to remo
-
Need help : for changing the flv movie size
i am loading my flv thogh xml link if load my flv the same size what i kept in my folder using script shall i change the movie size because lot of movies is loads dynmicaly i cannot go and change each and evry movie so some body can help me to change
-
Astronomy picture of day website won't open the picture but will with explorer
site opens, but no pic...never had a prob before. i have mcafee installed.
-
Why does my mac Shuts down intermittently
Why does my mac intel Shuts down intermittently?
-
On my ideapad s10-3t I am using windows 7 starter at the moment but I would like to upgrade because of the better tablet support. I am in posession of a windows 7 32 bit retail version. What exactly do I have to do during the upgrade if I 1. don't wa