Privilege for truncating a table of other schema
Hi friends
I need to truncate a table of other schema. What privilege the other user has to give to carry out it.
Thanks
Edited by: user12892846 on 01-abr-2010 15:59
DROP ANY TABLEWhile technically correct, above is somewhat dangerous because every schema could be impacted; even SYS.
Assume SCHEMA_A owns TABLE_A & procedure below.
CREATE & REPLACE PROCEDURE TRUNCATE_TABLE_A
AS
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE TABLE_A';
END TRUNCATE_TABLE_A;
GRANT EXECUTE ON TRUNCATE_TABLE_A TO SCHEMA_B;
By doing as above SCHEMA_A can control who & which table(s) can be impacted (in is own schema only).
Edited by: sb92075 on Apr 1, 2010 7:06 PM
Similar Messages
-
What privileges for GATHER_TABLE_STATS on table in other schema
Hi,
I'm trying to gather some histogram data for a table in another schema and run into the following error:
begin
DBMS_STATS.GATHER_TABLE_STATS('NGM101','NGG_BASISCOMPONENT', METHOD_OPT => 'FOR COLUMNS SIZE 75 tre_id_o');
end;
ORA-20000: Unable to analyze TABLE "NGM101"."NGG_BASISCOMPONENT", insufficient privileges or does not exist
ORA-06512: at "SYS.DBMS_STATS", line 13172
ORA-06512: at "SYS.DBMS_STATS", line 13202
ORA-06512: at line 2
Statement works fine for the SYSTEM user so I guess I need some privileges to do this. But what privileges do I need? (9i and 10G)
thanks ReneI am getting the same error.
USER sysadm has ANALYZE ANY privilege,infact user has got dba privliege. but still i am getting the same error. what could be the issue here.
SQL> select * from user_role_privs where username='SYSADM' ;
USERNAME GRANTED_ROLE ADM DEF OS_
SYSADM CONNECT NO YES NO
SYSADM DBA NO YES NO
SYSADM PSADMIN NO YES NO
SYSADM RESOURCE NO YES NO
SQL> connect sysadm/sysadm
Connected.
SQL> exec DBMS_STATS.GATHER_TABLE_STATS (ownname=>'sysadm', tabname => 'PS_SJT_PERSON');
BEGIN DBMS_STATS.GATHER_TABLE_STATS (ownname=>'sysadm', tabname => 'PS_SJT_PERSON'); END;
ERROR at line 1:
ORA-20000: Unable to analyze TABLE "SYSADM"."PS_SJT_PERSON", insufficient
privileges or does not exist
ORA-06512: at "SYS.DBMS_STATS", line 13046
ORA-06512: at "SYS.DBMS_STATS", line 13076
ORA-06512: at line 1 -
ORA-01031: insufficient privileges when creating a table in other schema
Dear all,
I appreciate your help please in this issue :
when i try to issue the below statement to create a table in an another schema than the user i am connected in
CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
SELECT *
FROM HST
WHERE 1 = 0;
I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
What other privileges should i grant also,
Please if you have any idea.user562674 wrote:
Dear all,
I appreciate your help please in this issue :
when i try to issue the below statement to create a table in an another schema than the user i am connected in
CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
SELECT *
FROM HST
WHERE 1 = 0;
I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
What other privileges should i grant also,
Can you show us a cut/paste from the sql*plus of session of yours which should show that you have given the privilege directly to this user and after that the command fails?
Aman.... -
How to grant privileges on all the tables in a schema
Hi All,
Can you tell me how to grant privileges on all the tables of a schema A
to schema B.
For Example:
There are 200 tables in schema A, I wanted to grant select privilege on all the tables of a scheme A to schema B.
Thanks in advance.note that USER is the user that will have the select priviledge
the procedure includes views as well
CREATE OR REPLACE PROCEDURE GRANT_ACCESS_ON_USER IS
CURSOR c1 is select table_name from user_tables;
CURSOR c2 is select view_name from user_views;
tablename user_tables.TABLE_NAME%TYPE;
viewname user_views.VIEW_NAME%TYPE;
BEGIN
tmpVar := 0;
OPEN c1;
loop
fetch c1 into tablename;
EXIT WHEN c1%NOTFOUND;
EXECUTE IMMEDIATE 'GRANT SELECT on '||tablename ||' to USER';
end loop ;
close c1;
OPEN c2;
loop
fetch c2 into viewname;
EXIT WHEN c2%NOTFOUND;
EXECUTE IMMEDIATE 'GRANT SELECT on '||viewname ||' to USER';
end loop ;
close c2;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END;
/ -
Can a procedure select data from tables on other schemas?
Can a procedure select data from tables on other schemas?
If it is posible, which syntax should I use to identify the tables and schemas on the SELECT query?Yes , it is possible..unless the current user has the right privileges on others' db objects schema.
Now , as regards the syntax....
1) The more descriptive way is to use the format ... <owner_schema>.<obj_name>.
2) If you have declared public synonyms of other schema's objects then you can refer to them as just <obj.name>.... but the <owner_schema>.<obj_name> is not wrong.
3) If the db objects reside on another database you must have declared a db link.... then the syntax is <owner_schema>.<obj_name>@<db_link_name>.
Regards,
Simon -
Grant access to all object/tables in other schemas to a user
Is there any and simple way to grant access to all object/tables in other schemas (more than one) to a scheme/user?
Thanks.
Tarman.HI.
grant SELECT ANY TABLE,delete any table, insert any table to user; Giving this delete,insert ANY TABLE privilege to a user can be dangerous and the use can mislead it. Its better to create a dynamic script and then grant it.
E.g Suppose you want to give select,inert,delete,update privileges to user A on user B's object.
sql> spool grants.sql
sql> select 'grant select,insert,update,delete on '||owner||'.'||table_name||' to A;' from dba_tables where owner='B';
sql>@grants.sqlHTH
Anand -
Select from a table from other schema
Hi,
I want to make a select from a table how is into other Schema and into other instance.
form example, if I have _2 schemas (in diferent instances)_:
SCHEMA1 =
*(DESCRIPTION =*
*(ADDRESS =*
*(PROTOCOL = TCP)*
*(HOST = XXX.XXX.XXX.XX1)*
*(PORT = 1560)*
*(CONNECT_DATA =*
*(SERVER = DEDICATED)*
*(SERVICE_NAME = SCHEMA1)*
SCHEMA2 =
*(DESCRIPTION =*
*(ADDRESS =*
*(PROTOCOL = TCP)*
*(HOST = XXX.XXX.XXX.XX2)*
*(PORT = 1560)*
*(CONNECT_DATA =*
*(SERVER = DEDICATED)*
*(SERVICE_NAME = SCHEMA2)*
and into SCHEMA2 there is a table TABLE_A.
If I`m connected into SCHEMA1:
how can I do to make a select from the TABLE_A?
thanks very much.1) Referring to an entry in the tnsnames.ora file as a "schema" as you have here with schema1 and schema2 is likely to be confusing. You have multiple schemas in the same database-- in this case, you appear to be trying to query tables in a different database. If we try to answer using your TNS aliases "schema1" and "schema2", there is likely to be a great deal of confusion between schemas/ databases/ and TNS aliases. So I will assume that your tnsnames.ora file actually reads
TNS_ALIAS1 =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = HOST1)
(PORT = 1560)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DB1)
TNS_ALIAS2 =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = HOST2)
(PORT = 1560)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DB2)
)2) Given the TNS aliases above, assuming that we are talking about the tnsnames.ora file on HOST1, you would need to create a database link from DB1 to DB2. You can either specify a fixed username and password for the database link or you can specify that the connection happens as the current user (which assumes that the passwords are synchronized between the databases).
CREATE DATABASE LINK to_db2
CONNECT TO username_on_db2
IDENTIFIED BY password_on_db2
USING 'TNS_ALIAS2'3) Assuming the database link is in place
SELECT *
FROM schema2.table_name@to_db2Justin -
How can I to rename Table in Other Scheme ?
I some tables area backup, but all are in other scheme , How can I to rename all ?
SQL> rename SYSADM.PS_LOC_CNTRCT_SN to SYSADM.PS_LOC_CNTRCT_SN_999;
rename SYSADM.PS_LOC_CNTRCT_SN to SYSADM.PS_LOC_CNTRCT_SN_999
ORA-01765: specifying table's owner name is not allowed@pmcda Look up prerequisites for RENAME
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9019.htm#i2064929
SQL> show user
USER is "SYSTEM"
SQL> alter table scott.dept rename to department;
Table altered.
SQL> select * from scott.department;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> alter table scott.department rename to dept;Best regards
Maxim -
How to move one table to other schema
Hi;
imagine i have one schema A and i create table in this schema as test. Now i have one other schema,name is B. I wanna move my A.test table to B.test2
How i can do it?
thanksFollowing discussion might help How to move the table to the another schema?
-
APEX How do I create a Form based on a Database Table from other schema
My APEX schema is WISEXP. I have a database table that resides in WISDW schema on the same database. I want to create Tabular form based on this table.
I am not able to create a FORM based on the table from WISDW schema. I am able to create a FORM based on SQL though from this table in WISDW schema - but it does not do any action on Update/Insert rows.
Appropriate Synonyms and grants are created. Is there a limitation or am I missing something? Please advise.
thanks
RupenIf Rupen is using 2.2 or 2.2.1, it is likely he is running into the bug described here: Re: Workspace to Schema Assignments
In that case, it may be a necessary and sufficient workaround to assign the foreign schema to the workspace.
Scott
Message was edited by:
sspadafo -
Insufficient privileges for creating a table in a procedure
Hello,
I have a problem with creating a table from within a procedure. The error is
-1031 : ORA-01031: insufficient privileges
All objects are owned by the same user, and the procedure is run under that user. This user has CREATE ANY TABLE with Admin Option rights.
I am working with Oracle 8i.
Can anybody tell me how I can fix this?
Thanks, WouterDoes the user have the CREATE ANY TABLE privilege granted directly to it, or through a role? Stored procedures by default don't know about any privileges granted through a role.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
ORA-12054:while trying to create mview based on table in other schema
HI all
show user
user is "NAAMA"
CREATE TABLE USERS
user_id NUMBER,
user_name VARCHAR2(15 CHAR),
user_password VARCHAR2(50 CHAR),
CONSTRAINT user_pk PRIMARY KEY (user_id));
TABLE created.
show user
user is "TEST"
create materialized view log on NAAMA.USERS WITH ROWID
create materialized view users_mv
build immediate
refresh fast on commit with rowid
as
select user_name ,
user_password
from naama.users;
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
I suspect this problem is all about priviliges .
please you help
Thanks In advanced
NaamaHi Ranit ,
thanks for your response , i disagree with you lets take a look at those scenarios :
scenario 1 :
show user
user is "NAAMA"
create materialized view log on users with primary key;
show user
user is "TEST"
CREATE MATERIALIZED VIEW users_mv
BUILD immediate
REFRESH FAST ON COMMIT
AS
SELECT
user_id,
user_name ,
user_password ,
naama.get_name(user_id) FIRST_name
FROM naama.users
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.
according to this there is nothing to do to the primary key,scenarion 2:
show user
user is "NAAMA"
create MATERIALIZED VIEW LOG ON USERS WITH rowid.
create or replace function get_name (user_name_in IN varchar2) return varchar2
is
begin
return 'NAAMA';
end get_name;
show user
user is "TEST"
CREATE MATERIALIZED VIEW users_mv
BUILD immediate
REFRESH FAST ON COMMIT with primary key
AS
SELECT
user_name ,
user_password ,
naama.get_name(user_name) FIRST_name
FROM naama.users;
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.scenarion 3:
show user
user is "NAAMA"
create MATERIALIZED VIEW LOG ON USERS WITH rowid.
show user
user is "TEST"
CREATE MATERIALIZED VIEW users_mv
BUILD immediate
REFRESH FAST ON COMMIT WITH rowid
AS
SELECT
user_name ,
user_password ,
SUBSTR(user_name,1,5)
FROM naama.USERS;
materialized view created.so we cannot say that the mview has problem using functions.
What seems to be the problem ?
Thanks In Advanced
Naama -
Create a table which has columns from another table in other schema
Hi All
I need to create a table which is table driven i.e., the columns of that table need to be inserted from another table in a different schema...Can any one help me with this??create table newtab (--column spec here--) as
Select --columns here-- from otherschema.tablename;max -
Grants needed for form on procedure in other schema
Hi,
I'm running Apex 4.1.0.00.32 and want to create a form on a procedure in a package.
My package is not in the parsing schema.
The wizard lets me select the schema of the package ("procedure owner") and lists package.procedure in the list.
When I click next I get
Error User APEXDEV has no privileges on the RIS schema.
Contact your application administrator.
A strange thing here is that APEXDEV is the Apex user I'm logged in as in Apex. There is no schema called that...
RIS is the schema owning the package, so that's correct.
I have granted execute on the package to APEXRUN (the parsing schema of the workspace).
I tried to granet execute to both APEX_PUBLIC_USER and PUBLIC but got the same error.
A public synonym had no effect either.
Does anyone know what grants are needed?
Kind regards
TomasWell, OOW is over by now...
-
Minimum privileges for creating table
I wanted to know of the minimum set of privileges for creating a table in Oracle 11g database. First I created a schema and granted the create table privilege to the schema. When I tried to create a table in the schema, it was giving a message of like privileges required on the tablespace. Granting the resource privilege grants the unlimited quota on all the tablespaces including SYSTEM and SYSAUX tablespace which may not be an ideal scenario. So, my query is that what are the minimum set of privileges for creating a table in Oracle 11g database.
I hope, my question is clear.
Please revert with the reply to my query.
RegardsHi,
If you are going to use the read only :
SQL> create user anar identified by anar;
User created.
SQL> grant create session, select any table, select any dictionary to anar;
Grant succeeded.
SQL> conn anar/anar
Connected.
SQL> create table test(id number);
create table test(id number)
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> desc test.test
Name Null? Type
ID NUMBER
SQL> insert into test.test values (1);
insert into test.test values (1)
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> update test.test set id = 15;
update test.t set id = 15
ERROR at line 1:
ORA-01031: insufficient privileges
Thank you
Maybe you are looking for
-
SAP B1 Crystal Reports Add On and Crystal Report 2008
Hi, I have posted the question at SAP Reporting Forum, but not much luck. The following reports is created in Crystal report 2008. From http://help.sap.com/businessobject/product_guides/cr2008V1/en/CR2008_SP2_Fixed_Issues_en.pdf, I tnocie there coul
-
Apps will not update ios7.0.6 don't want the new ios8.0.2 yet and that shouldn't matter. showing updates available but apps just open when pressing update update all is not highlighted as well.
-
HT4628 Still having issues with Lion os X and wi-fi
I am still havign issues with Lion os X and wi-fi. I have 3 domputers in my house including the new macbook pro that has lion os x installed. The wifi drops out all the time (every 2 minutes). I have followed all the instructions on how to fix
-
I have windows xp media and have pictures of family in a group. I want to send them all at once and it will not allow it. I can send one at a time and that would take all day. the total pictures in one group is 16 and the other 32 pictures. HELP == T
-
How do i change print settings in eprint to draft in this year 2013
How do I change my eprint on my iphone 5 so that it prints in draft or greyscale instead of high quality.