Grant truncate HR. EMP to SCOTT
Hi all
11.2.0.1
What specific privilege can grant truncate table to a user?
I'm confused:
Connect as SYS:
SQL > grant all on human resources. EMP to SCOTT;
Grant succeeded.
Connect as SCOTT:
SQL > truncate table HR. EMP;
Table truncated.
Connect as SYS:
SQL > revoke all on human resources. SCOTT EMP;
Revoke succeeded.
Connect as SCOTT:
SQL > truncate table HR. EMP;
Table truncated.
Why SCOTT might still truncate the table?
Thank you
I'm going to assume that these are not temporary tables in fact (that is, they are not global temporary tables)
CREATE PROCEDURE table_owner.truncate_table( p_table_name in varchar2 ) AS BEGIN IF( p_table_name IN (<>)) THEN EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || p_table_name; END IF; END;
Of course, you can add additional logging logic, or you can allow different users to truncate different tables...
Justin
Tags: Database
Similar Questions
-
I grant the emp table to the user scott to the criterion of the user, as follows:
SQL > grant select on scott.emp to test
Then I use the connection test and visit the table emp
SQL > select * from scott.emp
Now, I want to visit the table emp as follows, but he failed.
SQL > select * from EMP
I want to know how to change the grant statement and make above sql can work well?
Thank youEdwardKing wrote:
I tried following:
Under sys s/n,.
SQL > CREATE SYNONYM EMP ON scott.emp
SQL > ALTER SESSION SET current_schema = SCOTT
Then I connect with the test
SQL > select * from EMP
ORA-00942:Where's the harm? Thank you
1. you created a synonym private sys_dba. You must create to test.
2. connect with the current_schema return to test test changes. Change it if after you login as test.So, either:
connection test
create synonym emp for scott.emp;
Select * from emp;or:
connect [any user who created public synonym privileges]
create public synonym emp for scott.emp;
connection test
Select * from emp;or:
connection test
ALTER session set current_schema = SCOTT;
Select * from emp; -
grant to specifice column of the table
How I can give grants to specifice column of the tableHello
Use this
grant (empno, ename) update on emp to scott;
better compliance
skyniazi -
Import/export DataPump object grants given by another user
Hello
I searched through the forum and the documentation but couldn't find an answer. I have the following case:
(1) I have a USER1 user who did not receive subsidies on the tables belonging to the user SCOTT.
(2) user SCOTT gives the right to SELECT for his table EMP user1:
Grant select on emp for User1;
(3) I do exporting of the User1 schema (schema = User1). But in addition I also perform a full database export (full = y)
(4) I have let down the user User1 and then import back
After importation, the USER1 user has the right to SELECT on SCOTT. EMP more (no matter if I imported the schema of the schema or full dump of export file mode). Is it possible to import the user so that it has the same exact privileges that he had for the export (also the ones he was given to her by other users)? I know that the privileges granted to objects owned by SYS are not exported, but what about other non-system users?
Thanks in advance for any answers.
Kind regards
SwearSwear,
Subsidies are impoted when the objects to which they belong are imported, not when the schema that the grants were awarded to the is imported. So, given that scott made the concession on scott.emp to user1, this grant be imported when scott.emp is imported. They get also only exported when the object is exported. Because scott.emp was not exported, this grant will not be exported when only User1 schema is exported.
I don't know an import of the single step that you will get what you want. If it's just the grants that you are looking for, you could make, it is 2 steps and should be an export complete dumpfile. Export could be reduced down a bit so it would be a condensed dumpfile. Here's what you do:
1. from the source database:
a. do this if you want a digest dumpfile
Directory System/Manager expdp dumpfile = full_grant.dmp dpump_dir = include = grant
b. do that if you want a complete dumpfile
expdp System/Manager directory = dpump_dir dumpfile = full.dmp2 from the source or the target database:
a. If you have just the source grants follow these steps:
Directory System/Manager Impdp = dpump_dir dumpfile = full_grant.dmp sqlfile = grant_only.sql
b. If you don't have a full dump and only want to see grants, so that
Directory System/Manager Impdp dumpfile = full.dmp dpump_dir = include = grant sqlfile = grant_only.sql
c. If you hav only a complete dumpfile and you want to see everything then
Directory System/Manager Impdp = dpump_dir dumpfile = full.dmp sqlfile = full.sqlNow, you can edit one of these files, .sql to find the commands you want. Your best bet would be to look at grant_only.sql and search for "to user1. This will give you all the subsidies granted to User1. These could be run from sqlplus.
A shortcut if you have configured database links would be something like:
Directory System/Manager Impdp = network_link dpump_dir = link_from_target_to_source include grant sqlfile = grant_only.sql =
Then, edit the file as shown above.I hope this helps.
Dean
-
Granting of privileges through role does not not for PL/SQL
Version: 11.2.0.2
In our shop, we don't grant privileges directly to a user, give us it to a role, and grant this role to user scheduled grantee.
Granting of privileges through a role seems to be fine with the SQL engine. But it does not PL/SQL engine.
In the example below, the GLS_DEV user is granted access SELECT on SCOTT.pets table through a role called tstrole. GLS_DEV can select the SQL table. But does not seem to PL/SQL engine to find out.
Reproduce the problem:
Has anyone encountered the same problem?SQL> show user USER is "SCOTT" SQL> select * from pets; NAME ----------------------------------- PLUTO SQL> conn / as sysdba Connected. SQL> create user GLS_DEV identified by test1234 default tablespace TSTDATA; User created. SQL> alter user GLS_DEV quota 25m on TSTDATA; User altered. SQL> grant create session, resource to GLS_DEV; Grant succeeded. --- Granting SELECT privilege on scott.pets to tstrole and then grant this role to GLS_DEV. SQL> conn / as sysdba Connected. SQL> SQL> create role tstrole; Role created. SQL> grant select on scott.pets to tstrole; Grant succeeded. SQL> grant tstrole to GLS_DEV; Grant succeeded. SQL> conn GLS_DEV/test1234 Connected. SQL> SQL> select * From scott.pets; NAME ----------------------------------- PLUTO ---- All fine till here. From SQL engine , GLS_DEV user can SELECT scott.pets table. --- Now , I am going to create a PL/SQL object in GLS_DEV which tries to refer scott.pets SQL> show user USER is "GLS_DEV" create or replace procedure my_proc is myvariable varchar2(35); begin select name into myvariable from scott.pets ; dbms_output.put_line(myvariable); end my_proc; / Warning: Procedure created with compilation errors. SQL> show errors Errors for PROCEDURE MY_PROC: LINE/COL ERROR -------- ----------------------------------------------------------------- 6/2 PL/SQL: SQL Statement ignored 6/41 PL/SQL: ORA-01031: insufficient privileges SQL> SQL> 6 6* select name into myvariable from scott.pets ; --- PL/SQL Engine doesn't seem to know that GLS_DEV has select privilege on scott.pets indirectly granted through a role --- Fix --- Instead of granting privilege through a role, I am granting the SELECT privilege on scott.pets to GLS_DEV directly. --- The error goes away, I can compile and execute the procedure !! SQL> conn / as sysdba Connected. SQL> SQL> grant select on scott.pets to GLS_DEV; Grant succeeded. SQL> conn GLS_DEV/test1234 Connected. SQL> SQL> create or replace procedure my_proc is myvariable varchar2(35); begin select name into myvariable from scott.pets ; dbms_output.put_line(myvariable); end my_proc; 2 3 4 5 6 7 8 9 10 11 / Procedure created. SQL> set serveroutput on SQL> exec my_proc; PLUTO PL/SQL procedure successfully completed.
N.Page wrote:
Ok. Thank you all.
There is no work around for this like using the clause AUTHID or something?Yes. using AUTHID (Summoner vs rights define) can make a difference.
However it makes sense that pl/sql uses roles a little differently. Although at first glance, it is hard to see why. The reasoning is similar to the difference between a user and a schema.A user is a person who connects to a database. It has a role and this role defines what privileges he gets when you work with data.
A schema consists of several objects that reside in the database. A package is also such an object. This package is valid, it is necessary to have all privileges directly. A role can be enabled and is a sort of temporary right. A direct subsidy has a permanent status. A user will only get the right to run this package/procedure/function. The package is a type of user interface. It encapsulates the privileges necessary to do something about this user.The logical problem happens only when the user and packaging are in the same scheme. The best approach is to have the package in the normal pattern and have a separate "schema access" with which the user connects. Give then execute privs on the package for this second scheme.
-
Syntax of GRANT: grant SELECT on table privileges to a user on a remote database
Hello
I have two databases: DEV1 and DEV2. Dev1 is my source database and DEV2 is the target database. There is a table in the diagram A on Dev1. I created a DBLINK PUBLIC 'TESTDBLINK' in the diagram B on DEV2 that connects to figure A on DEV1.
Machine of Table for the database schema
DEV1 AN EMP 192.168.210.10
Database Machine Lik database schema
DEV2 B TESTDBLINK 192.168.210.11
How to SELECT on the schema Table EMP (DEV1) diagram b the DEV2 privileges? What is the syntax?
Sign up for example in the form of scheme A on DEV 1
SQL > GRANT SELECT ON EMP to? * *
Thanks for your contributions
HarryDo not give this table in diagram A diagram B.
Inside the diagram B, you can just issue a select statement as follows:
select * from table@db-link-to-A
Oracle connects to the remote instance by using the credentials of the scheme A, and since A is the owner of this table, Oracle can already access the table.
-
ORA-01031: insufficient privileges
Hi all;
U1 > grant u1.emp to scott references;
Grant succeeded.
SCOTT > alter table u1.emp change (emp_id number constraint emp_c1_pk_eid primary key);
ALTER table u1.emp change (emp_id number constraint emp_c1_pk_eid primary key)
*
ERROR on line 1:
ORA-01031: insufficient privileges
To create a primary key or foreign in the object on the other, what a privilege devrais I need?
Thank you
To create a primary key or foreign in the object on the other, what a privilege devrais I need?
This is generally NOT a good idea.
Why do you need a primary key in a different schema from the owner of the table. If you do this, you will ALWAYS have a dependency between these two patterns.
You must be able to alter the table and create indexes of the other schema...
For the ALTER statement:
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_3001.htm
Prerequisites
The table must be in your own schema or you must have
ALTER
privileges of objects on the table, or you must haveALTER
ANY
TABLE
system privilege.For indexes
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_5011.htm#i2062403
Prerequisites
To create an index in your own schema, one of the following conditions must be true:
- The table or cluster be indexed must be in your own schema.
- You must have the
INDEX
object privilege on the table to be indexed. - You must have the
CREATE
ANY
INDEX
system privilege.
To create an index in another schema, you must have the
CREATE
ANY
INDEX
system privilege. In addition, the owner of the schema to contain the index must have either theUNLIMITED
TABLESPACE
quota privilege or space of the system on the storage space to store the index or index partitions. -
Exception ORA when accepting SQL Tuning Set
Hello
RDBMS version: 11.2.0.1.0 & 11.2.0.4.0
OS: OEL 5 (64-bit)
I am creating a SQL tuning set and get both to do exception below. Tried to search on the forums also with the exception of the ORA, but unable to get any resolution for this exception ORA.
The following awards were made: -.
GRANT CREATE ANY SQL PROFILE TO SCOTT; GRANT DROP ANY SQL PROFILE TO SCOTT; GRANT ALTER ANY SQL PROFILE TO SCOTT; GRANT ADVISOR TO SCOTT; GRANT ADMINISTER SQL MANAGEMENT OBJECT TO SCOTT; grant execute on dbms_spm to SCOTT; grant administer sql management object to SCOTT;
DECLARE my_task_name VARCHAR2(30); my_sqltext CLOB; my_sqlprofile_name VARCHAR2(4000); BEGIN my_sqltext := 'SELECT * FROM emp'; my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(sql_text => my_sqltext, user_name => 'SCOTT', scope => 'COMPREHENSIVE', time_limit => 60, task_name => 'my_sql_tuning_task3', description => 'Demo Task to tune a query'); DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'my_sql_tuning_task3'); my_sqlprofile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE (task_name =>'my_sql_tuning_task3', name => 'my_sql_profile'); -- Culprit for the exception --dbms_output.put_line(my_sqlprofile_name); END; / Error report - ORA-13786: missing SQL text of statement object "1" for tuning task "my_sql_tuning_task3" ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95 ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16255 ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31 ORA-06512: at "SYS.DBMS_SQLTUNE", line 7133 ORA-06512: at line 4 13786. 00000 - "missing SQL text of statement object \"%s\" for tuning task \"%s\"" *Cause: The user attempted to accept SQL profile for an object that has not a SQL text associated to it. *Action: Check the identifier of the object and retry the operation.
Would be really grateful if someone could point me in the right direction here.
TIA...
Personally, I wouldn't bother with a task of setting.
If you are lucky who will recommend a sql profile based on adjustments of cardinality which may or may not be effective.
I would just use either the COE_XFR_SQL_PROFILE. SQL script SQLT ( doc-id 1487302.1Support) or use SQL Plan baseline to apply the previous execution plan. The latter has the advantage of being able to make an evolution controlled all plans potentially better which would otherwise be generated.
You can choose the older, better plan AWR in the same database or a different database, and then transport it.
-
create the user who can update another table schema
Hello
We have a system of prod in which we need to update the schema of the application running the declaration different update and create/run function, procedure, package bodies. It is very easy if you use the schema owner. But I need to run the activities of another user due to some restrictions. How can I do?
Can u suggested to update any table privilege... but this would give all access table dictionary also.
Is there any privilege that would allow any other user update another schema table without using the schema name before the name of the table?
PLSS suggest
John,
Can we use public synonym for that? I don't know if the risk of security for her:
SQL > connect h/h
Connected.
SQL > select * from scott.emp;
Select * from scott.emp
*
ERROR on line 1:
ORA-00942: table or view does not exist
SQL > connect scott/tiger
Connected.
SQL > create public synonym scotemp for scott.emp;
The synonym is created.
SQL > connect HR/hr;
Connected.
SQL > select * from scotemp;
Select * from scotemp
*
ERROR on line 1:
ORA-00942: table or view does not exist
SQL > connect scott/tiger
Connected.
SQL > grant select on emp to HR;
Grant succeeded.
SQL > connect h/h
Connected.
SQL > select * from scotemp;
..
..
14 selected lines.
SQL > show user;
The USER is 'hr '.
SQL > update of ename set scotemp = 'SMITHX"where empno = 7369;
setting a day of scotemp set ename = 'SMITHX"where empno = 7369
*
ERROR on line 1:
ORA-01031: insufficient privileges
SQL > connect scott/tiger
Connected.
SQL > grant update on HR emp;
Grant succeeded.
SQL > connect h/h
Connected.
SQL > update of ename set scotemp = 'SMITHX"where empno = 7369;
1 line update.
SQL > rollback;
Complete restoration.
SQL >
Concerning
Girish Sharma
-
DBMS_LOGSTDBY. SKIP_ERROR does not work
Hi guru,.
I have e a 11.2.0.3 sql - apply dataguard running (prd1 > prd2) and I want to jump grants and revokes on the scott schema. I did the following (based on the (http://oracledocs.shu.ac.uk/oracle/B28359_01/appdev.111/b28419/d_lsbydb.htm#i997288 document) )
ALTER DATABASE STOP LOGICAL STANDBY IS APPLIED;
CREATE OR REPLACE PROCEDURE OSCAR)
old_stmt IN VARCHAR2,
stmt_type IN VARCHAR2,
schema in VARCHAR2,
name in VARCHAR2,
XIDUSN in NUMBERS
xidslt in NUMBERS
xidsqn in NUMBERS
error in VARCHAR2,
new_stmt OUT VARCHAR2
) AS
BEGIN
-Defaults to what we have already
new_stmt: = old_stmt;
-Ignore errors of GRANT in the SYS or HR diagrams
IF INSTR (UPPER (old_stmt), 'GRANT') > 0
AND UPPER (schema) = "SCOTT".
THEN
new_stmt: = NULL;
END IF;
Oscar of the END;
/
RUN DBMS_LOGSTDBY. SKIP_ERROR (stmt = > 'NON_SCHEMA_DDL', schema_name = > NULL, object_name = > NULL, proc_name = > ' SYS.) OSCAR')
-EXECUTE DBMS_LOGSTDBY. UNSKIP_ERROR (stmt = > 'NON_SCHEMA_DDL')
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATELY;
But when even grants grant select on scott.emp to dbsnmp is applied on the prd2 database?
While I am wrong donign?
Thanks for any help.
What about oScar
Hello;
This:
RUN DBMS_LOGSTDBY. SKIP_ERROR (stmt => 'NON_SCHEMA_DDL', schema_name => NULL, object_name => NULL, proc_name => ' SYS.) OSCAR')
Seems to be OK.
Oscar seems incomplete for me:
What I'm going to try:
CREATE OR REPLACE PROCEDURE OSCAR)
old_stmt IN VARCHAR2,
stmt_type IN VARCHAR2,
schema in VARCHAR2,
name in VARCHAR2,
XIDUSN in NUMBERS
xidslt in NUMBERS
xidsqn in NUMBERS
error in VARCHAR2,
new_stmt OUT VARCHAR2) AS
BEGIN
-Defaults to what we have already
new_stmt: = old_stmt;
-Ignore errors of GRANT on SYS or SCOTT patterns
IF INSTR (UPPER (old_stmt), 'GRANT') > 0 THEN
IF schema IS NULL
OR (schema only IS NOT NULL AND (UPPER (schema) = "SYS"
OR UPPER (schema) = "SCOTT") THEN
new_stmt: = NULL;
-record the fact that a mistake has been ignored
NULL;
END IF;
END IF;
OSCAR OF THE END;
/
Best regards
mseberg
-
Can I use the data dictionary tables based on RLS policy?
Hello guys, I use the package level security line to limit certain lines to some users.
I created several roles, I want to just enable certain roles to see all the columns, but the other roles, I'm not that they see all the lines. I mean to do this I use the session_roles table data dictionary however it did not work.
What to do in order to not allow rows of user roles?
Can I use the data dictionary tables in RLS?
Thank you very much.Polat says:
What to do in order to not allow rows of user roles?
Can I use the data dictionary tables in RLS?Ensure that:
SQL> CREATE OR REPLACE 2 FUNCTION no_sal_access( 3 p_owner IN VARCHAR2, 4 p_name IN VARCHAR2 5 ) 6 RETURN VARCHAR2 AS 7 BEGIN 8 RETURN '''NO_SAL_ACCESS'' NOT IN (SELECT * FROM SESSION_ROLES)'; 9 END; 10 / Function created. SQL> BEGIN 2 DBMS_RLS.ADD_POLICY ( 3 object_schema => 'scott', 4 object_name => 'emp', 5 policy_name => 'no_sal_access', 6 function_schema => 'scott', 7 policy_function => 'no_sal_access', 8 policy_type => DBMS_RLS.STATIC, 9 sec_relevant_cols => 'sal', 10 sec_relevant_cols_opt => DBMS_RLS.ALL_ROWS); 11 END; 12 / PL/SQL procedure successfully completed. SQL> GRANT EXECUTE ON no_sal_access TO PUBLIC 2 / Grant succeeded. SQL> CREATE ROLE NO_SAL_ACCESS 2 / Role created. SQL> GRANT SELECT ON EMP TO U1 2 / Grant succeeded. SQL> CONNECT u1@orcl/u1 Connected. SQL> select ename,sal FROM scott.emp 2 / ENAME SAL ---------- ---------- SMITH 800 ALLEN 1600 WARD 1250 JONES 2975 MARTIN 1250 BLAKE 2850 CLARK 2450 SCOTT 3000 KING 5000 TURNER 1500 ADAMS 1100 ENAME SAL ---------- ---------- JAMES 950 FORD 3000 MILLER 1300 14 rows selected. SQL> connect scott@orcl Enter password: ***** Connected. SQL> GRANT NO_SAL_ACCESS TO U1 2 / Grant succeeded. SQL> connect u1@orcl/u1 Connected. SQL> select ename,sal FROM scott.emp 2 / ENAME SAL ---------- ---------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS ENAME SAL ---------- ---------- JAMES FORD MILLER 14 rows selected. SQL>
SY.
-
ORA-03123 during the use of formulas of UTL_FILE package in oracle 10g
Hi all
I have created a 'REPORTS' as 'E:\EXCEL_TESTING_FORM\' directory and to grant read, write to this directory at scott.
and also a given grant execute on UTL_FILE to scott;
I wrote this code in a trigger pressed the button and my file name is the file somename.xls
After printing the first line as 7369SMITH3000 in a single cell when it goes to print the second employee record is to show
ORA-03123 inside the loop.
CURSOR EMP_DATA IS
SELECT * FROM SCOTT. EMP;
C_REF EMP_DATA % ROWTYPE;
L_FILE UTL_FILE. TYPE_DE_FICHIER;
V_PATH VARCHAR2 (200): = ";
BEGIN
V_PATH: = "REPORTS";
L_FILE: = UTL_FILE. FOPEN (V_PATH, P_FILE_NAME, 'W');
EMP_DATA OPEN;
LOOP
EXTRACT THE EMP_DATA IN C_REF;
WHEN THE OUTPUT EMP_DATA % NOTFOUND;
UTL_FILE. PUT_LINE (L_FILE, TO_CHAR (C_REF. EMPNO));
UTL_FILE. PUT_LINE (L_FILE, C_REF. ENAME);
UTL_FILE. PUT_LINE (L_FILE, TO_CHAR (C_REF. SAL));
END LOOP;
CLOSE EMP_DATA;
UTL_FILE. FFLUSH (L_FILE);
UTL_FILE. FCLOSE (L_FILE);
Please guide me how to avoid this error and also how to print cell wise why because it's printed in a single cell.
Please answer...What is a network drive? If so, try if the same code is running on a local directory, maybe the network drive is smehow is not accessible.
-
Hello
I use this query to find the LIST OF THE LOCKED OBJECT
SELECT a.type,
Owner of substr (a.Owner, 1, 30),
a.SID,
Subject substr (a.Object, 1, 30)
ACCESS $ v one
WHERE a.owner NOT IN ('SYS', 'PUBLIC')
ORDER BY 1,2,3,4
It showing record 9475 is this straight becauze some slow EEG database time.
I have another problem in a different database that generates a lot of trc file, in the file dir udump
Thank you
MAANHello
Documentation says Oracle
«v$ ACCESS displays information about locks that are currently taxed on the library cache objects.» The locks are imposed to ensure that they are not aged in the cache of the library so that they are required for the execution of SQL".
It is provides information what objects are held level access will hide library in the special case of sessions. It does not provide the information that it possΦde a lock or not.
Session - 1 as a dba
SQL> select owner,type,count(*) 2 from v$access 3 where owner='SCOTT' 4 group by owner,type; no rows selected
Session - scott 2
SQL> desc emp Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) SQL> select * from emp where rownum < 2; EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- --------- ---------- ---------- DEPTNO ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20
Session - 1
SQL> col type for a20 SQL> / OWNER TYPE COUNT(*) -------------------- -------------------- ---------- SCOTT TABLE 1
If you check it has loaded in the library cache - as the object is accessed by the user. We will still continue with demo
SQL> grant all on emp to public; Grant succeeded. SQL> update emp 2 set sal=sal+1000 3 where empno=7369; 1 row updated. SQL>
I did not commit the session.
Session - 3 - one access s/n
C:\Windows\system32>sqlplus /@test as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 24 12:32:35 2011 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> update scott.emp set sal=sal-100 where empno=7369;
It is passed, we will check session - 1 What is happeing
SQL> col owner for a20 SQL> col object for a20 SQL> col type for a20 SQL> select * from v$access where object='EMP'; SID OWNER OBJECT TYPE ---------- -------------------- -------------------- --------- 25 SCOTT EMP TABLE 24 SCOTT EMP TABLE
It is only provides information session at which are currently access what are the objects of the library cache. If you check 25 SID and SId 24 both are perhaps to access the information, which is the trainer /waiter that we do not know. Now, if you check the v$ locked_object you can get the details.
If you check the base tables - it recovers since "x$ ktcxb"-information of transactions of the v kernel $ locked_object
When in access of $ v it retrieves information from x$ kglob and x$ kgldp - its generic kernel - object they access dependencies - architecture/logical point of view.There will be cases occurs when locking contention access $ v is questioned through - because high latch activity goes on access tables x $.
Note-in order to understand things that I provided table core information do not have to access the core production database tables.
It could be that useful...
-Pavan Kumar N
-
Create a db with a simple form application, based on a remote table
Hello
I have APEX 4.0 installed on my laptop and a distant DB (always in my local network) with EBS R12 on it.
I created a dblink with my HR schema and updated my tnsname.ora. Now I can connect and browse the remote db with schema APPS/APPS.
I can also browse table away from my local db user 'HR '.
for example: select * from emp@apex_dblink; recover data without problem even if I'm a developer sql or standard interface of APEX with my APEX user.
As a training, now I want to create an application database from scratch on a tabular presentation with the HR schema. When I browse for the table, I don't see my table 'emp' remote and when I push the "emp@apex_dblink" research, he said only: "emp@apex_dblink is not a valid table name.".
Some have said, it is because of the 'grant privilege' and 'create the synonym' but I don't know if like my dblink I should think to solve this problem...
In addition, I do not know much about the administration and do not know where to go...
Here is some information:
DB user: hr/hr@XE
APEX user: ulrich/ulrich-> name of the workspace: APEX_WORKSPACE
That's your time and your response.
ARO
UlrichApex gets his table & veiw your local database catalog definitions. Are two ways to do what you want:
(1) create copies of the tables/views you want and create your forms & reports based on these tables/views. Once you have your app work (at least the table/view definitions are now known to Apex), delete local tables and replace them with synonyms for remote tables.-- run in local Apex database drop table emp; -- I'd recommended naming your DB link after the remote DB name to keep easy track of where it's pointing -- create database link EBSPROD connect to HR using HR123 identified by 'EBSPROD.world'; -- or include the schema name if you need multiple DB links to that remote DB -- create database link EBSPROD@hr connect to HR using HR123 identified by 'EBSPROD.world'; -- create database link EBSPROD@scott connect to scott using tiger identified by 'EBSPROD.world'; -- select * from emp@EBSPROD@scott; create or replace synonym EMP for EMP@apex_dblink;
(2) create local views to remote objects. Apex point to these points of view the.
-- run in local Apex database create or replace view EMP as (select * from EMP@apex_dblink);
Published by: maceyah on March 3, 2011 09:04
-
Write to a file using UTIL_FILE
Hello
I have to write data to the file (s) by extracting data from table in the file using UTIL_FILE. are there precautions I need to take. I never tried before so the heads up on top of the process.
If you need more info please let me know.CONNECT sys/password@w2k1 AS SYSDBA
CREATE or REPLACE DIRECTORY EXTRACT_DIR AS 'c:\oracle\extract ';
GRANT READ, WRITE ON DIRECTORY EXTRACT_DIR TO SCOTT;
GRANT EXECUTE ON UTL_FILE TO SCOTT;CONNECT scott/tiger@w2k1
CREATE OR REPLACE PROCEDURE EMP_CSV AS
CURSOR c_data IS
SELECT EmpNo,
Ename,
employment,
Bishop.
To_char(HireDate,'DD-mon-YYYY') AS hiredate,
SAL,
Comm,
DEPTNO
WCP
ORDER BY ename;v_file UTL_FILE. TYPE_DE_FICHIER;
BEGIN
v_file: = UTL_FILE. FOPEN (location-online 'EXTRACT_DIR',
name of file-online "emp_csv.txt."
OPEN_MODE-online 'w ',.
max_linesize-online 32767);
FOR cur_rec IN c_data LOOP
UTL_FILE. Put_line (v_file,
cur_rec.EmpNo | ',' ||
cur_rec. Ename | ',' ||
cur_rec.job | ',' ||
cur_rec. Bishop | ',' ||
cur_rec. HireDate. ',' ||
cur_rec.EmpNo | ',' ||
cur_rec. SAL | ',' ||
cur_rec.comm | ',' ||
cur_rec. DEPTNO);
END LOOP;
UTL_FILE. FCLOSE (v_file);EXCEPTION
WHILE OTHERS THEN
UTL_FILE. FCLOSE (v_file);
END;EXEC csv.generate ('EXTRACT_DIR', 'emp.csv', p_query => ' SELECT * FROM emp');
EXCEPTION
WHEN UTL_FILE. INVALID_PATH THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20000, 'location of the file is invalid.');WHEN UTL_FILE. INVALID_MODE THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20001, 'the open_mode in FOPEN parameter is invalid.');WHEN UTL_FILE. INVALID_FILEHANDLE THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20002, 'the file handle is invalid.');WHEN UTL_FILE. INVALID_OPERATION THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20003, 'file could not be opened or operated on as requested.');WHEN UTL_FILE. READ_ERROR THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR ("-20004, ' operating system error has occurred during the read operation.");WHEN UTL_FILE. WRITE_ERROR THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20005, 'operating system error has occurred during the write operation.');WHEN UTL_FILE. INTERNAL_ERROR THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20006, ' PL/SQL unspecified error.');WHEN UTL_FILE. CHARSETMISMATCH THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20007, 'opening a file using FOPEN_NCHAR, but later I/O' |)
"operations using functions such as PUTF or GET_LINE nonchar.");WHEN UTL_FILE. FILE_OPEN THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20008, ' the requested operation failed because the file is opened.");WHEN UTL_FILE. INVALID_MAXLINESIZE THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20009, 'MAX_LINESIZE for FOPEN() value is not valid; it must' |)
"to be in the range 1 to 32767");WHEN UTL_FILE. INVALID_FILENAME THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20010, 'the file name parameter is invalid.');WHEN UTL_FILE. THEN ACCESS_DENIED
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR ("-20011, ' permission to access the location of the file is denied.");WHEN UTL_FILE. INVALID_OFFSET THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20012, ' ABSOLUTE_OFFSET the setting for the FSEEK() function is disabled;) ' ||
"it must be greater than 0 and less than total |
'number of bytes in the file.");WHEN UTL_FILE. DELETE_FAILED THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20013, "the requested file remove operation failed.");WHEN UTL_FILE. RENAME_FAILED THEN
UTL_FILE. FCLOSE (v_file);
RAISE_APPLICATION_ERROR (-20014, "the requested file rename operation failed.");WHILE OTHERS THEN
UTL_FILE. FCLOSE (v_file);
LIFT;
END;
Maybe you are looking for
-
Quiz2Win. Is it a scam?
HHave received several windows pop up supposed to come from a Quiz2Win sponsored by Apple and offering an Apple iPhone 6 in Exchange for answer 3 simple questions. Any ideas please? It also shows a number of "winners".
-
I'm pretty much a newbie to LavVIEW. I use LabVIEW complete edition on Windows 7 2012. I copied a project using Save As duplicate in the Project Explorer. He created an excessively long and complex directory structure. He made "too long" (probably
-
How can I backup my compaq persario windows me mellenium I've never done this before?
I need to know how to back up my compaq presario MV540 windows me mellenium 2000 computer and I've never done a back up so I don't lose all of my information and I don't think I have internet 7 I run the same as the day that I got the computer. Can y
-
When you try to start games, you are prompted to open it with another program
I try to go in one of my games (solitaire, hearts, etc.) a window pops up asking me what program I want to open with (microsoft word, adobe reader, internet Explorer software, etc.). original title: Please help. I try to go in one of my games (solita
-
Unable to update firmware DRAC6 past 1.10.13 on R610
Hello I have a number of R610s I need to upgrade the DRAC firmware, so you can talk to our new management system. Most of them updated correctly when I left versions gradually 1.10.13 (their version) to 1.97. About 7 of them, however, will not move p