Distinguish User from web or from SQL Plus
Just wondering if there is a way to tell the difference that record update was done from the web or from database editor like Oracle sql Developer or SQL Plus.
I am trying to identified the user who updating data record but could not get where. I use Session USER or OSUSER, does not help, session Terminal gives me "unknown" or "". Please advice.
Thanks.
Hopefully every user logs in with their own userid. The typical web technique of logging on as a generic web user is not a good idea.
Then the question is: do the modules set the system context info properly? (See DBMS_APPLICATION_INFO package and SYS_CONTEXT function.)
Similar Messages
-
Restricting the user to operate DML's from SQL PLUS Environment
how to Restrict the user to operate DML statements from SQL PLUS Environment.
Once you restrict SCOTT user to not be able to do an INSERT command, the SQL*Plus returns an error for user SCOTT when he tries to execute an INSERT statement.
Note however, that this is enforced by SQL*Plus, not the database!
Look into the use of product_user_profile from Oracle documentation for more information.
SQL> insert into product_user_profile values('SQL*Plus', 'SCOTT', 'INSERT', NULL, NULL, 'DISABLED', NULL, NULL) ;
1 row created.
SQL> commit ;
Commit complete.
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.3.0 - Production
SQL>
SQL> connect scott
Enter password:
Connected.
SQL>
SQL> insert into emp select * from emp ;
SP2-0544: invalid command: insert
SQL>
SQL> -
HI,I came to know that direct exit from SQL Plus without Oracle shutdown causes future issues of ORA-0600 kind of errors. Is it true? If yes could u pls suggest me how to shutdown from user "SYSTEM/manager". Bcoz with this am warned that I dont have previleges.
Hello,
HI,I came to know that direct exit from SQL Plus without Oracle shutdown causes future issues of ORA-0600 kind of errors. Is it true?The ORA-00600 is an internal error it can be caused for instance by a Bug, a corruption, ... , and if someday you experience this kind of error, you should open a Service Request to My Oracle Support.
However, I've never heard that exiting sqlplus could cause this kind of error. Where did you get such information ?
how to shutdown from user "SYSTEM/manager". To shutdown the database you should be connected with the User SYS (as SYSDBA). You may use the following statement:
sqlplus /nolog
connect / as sysdba
shutdown immediate;
exitHope this help.
Best regards,
Jean-Valentin -
How to use 10g's SQL tuning support from SQL*Plus
Hi,
I am having problems with my application's SQL queries execution time. I am not tuning guru, I know pretty little about tuning. As I read 10g has a SQL Tuning Advisor. Can I use it from SQL*Plus? I didn't say, but do not have the possibility to access the database, by no other means only SQL*Plus.
TIA
Regards,
Tamas SzecsyIf you have granted the ADVISOR privilege you may use it from SQL*PLUS
Look for examples on the web
(using DBMS_SQLTUNE package) -
How to pass table type variable into function from SQL*PLUS ?
How to pass a table type variable from sql*plus prompt into a function ?
Thanx in advance.Krishna,
Do you mean like this?SQL> DECLARE
2 TYPE t_tbl IS TABLE OF VARCHAR2(20);
3 l_sample_tbl t_tbl;
4
5 FUNCTION print_contents ( p_tbl IN t_tbl )
6 RETURN VARCHAR2
7 IS
8 l_string VARCHAR2(1000);
9 BEGIN
10 FOR i IN 1..p_tbl.COUNT LOOP
11 IF (i = 1) THEN
12 l_string := p_tbl(i);
13 ELSE
14 l_string := l_string || ', ' || p_tbl(i);
15 END IF;
16 END LOOP;
17 RETURN (l_string);
18 END print_contents;
19
20 BEGIN
21 l_sample_tbl := t_tbl();
22 l_sample_tbl.EXTEND;
23 l_sample_tbl(1) := 'one';
24 l_sample_tbl.EXTEND;
25 l_sample_tbl(2) := 'two';
26 l_sample_tbl.EXTEND;
27 l_sample_tbl(3) := 'three';
28 l_sample_tbl.EXTEND;
29 l_sample_tbl(4) := 'four';
30 l_sample_tbl.EXTEND;
31 l_sample_tbl(5) := 'five';
32 DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
33 END;
34 /
one, two, three, four, five
PL/SQL procedure successfully completed.
SQL> HTH,
T. -
How to connect from sql*plus to Sql Server
Dear Profs.
How I can connect from sql*plus v8 on my local pc(Win XP) to Sql Server Express 2005 light weight installed in same local pc ?
Thanks,
Ahmed.You'll need to setup heterogeneous services. This is done by creating an init file for the SQL Server db with %ORACLE_HOME%\hs\admin that refers to a DSN for the Sql Server Database. The listener would also need an entry for the SQL Server DB DSN. After that you would create a dblink to SQL Server in your Oracle instance and then could query across the dblink.
-
How to exit from SQL*Plus based on the return value of a SQL select stment?
Hi
I have a SQL script executed from SQL*Plus. I would like to know if SQL*Plus
supports any kind of branching or exiting from script execution based on a
returned value of a SQL select statement. I am on 9i.
Regards,
Tamas Szecsyin sqlplus, you have whenever
ex:
whenever sqlerror exit failure
insert into ...
-- if this fails, then you will be out
insert into ...
-- if this fails, then you will be out
whenever sqlerror continue
insert into ...
-- if this fails, this continues
insert into ...and you have PL/SQL
declare x number;
begin
select count(*) into x from emp;
if (x=14) then null; end if;
end;
/note that you can mix those in some case
-- exit if there is no row in emp
whenever sqlerror exit 1
var dummy number
exec select count(*) into :dummy from emp having count(*)!=0 -
How execute this stored procedure from SQL PLUS???
Hello folks....
Help me please...
I have this procedure....
CREATE OR REPLACE PROCEDURE TEST(COD OUT VARCHAR2, NUM OUT
VARCHAR2, ID OUT VARCHAR2)
AS
BEGIN
END;
SO, I4D LIKE TO EXECUTE IT FROM SQL PLUS::
BUT, I DONT KNOW HOW TO DO..PLEASE SEND ME A SAMPLE..
THANK UThank u man!!!
look, my error before was :
SQL> set serveroutput on
SQL> declare
SQL> cod varchar2(100);
SQL> num varchar2(100);
SQL> id varchar2(100);
SQL> begin
SQL> TEST( cod, num, id );
SQL> EXEC DBMS_OUTPUT.put_line( cod || ' ' || num || ' ' ||
id );
SQL> end;
SQL> /
i put the EXEC....
thank u!!! -
Calling stored proc (with 2 IN and 3 OUT) - from SQL Plus
This is the signature of my stored proc:
CREATE OR REPLACE PROCEDURE myschema.myproc
p_usr_name IN VARCHAR2,
p_send_tmstmp IN DATE,
p_ret_value OUT NUMBER,
p_err_code OUT VARCHAR2
)If I need to call it from sql plus, how do I need to pass the arg?
This is what I am doing
execute myschema.myproc('abc123','02-MAY-2008');
What is wrong here? If someone could help. Thx!Try something like this
var usr_name varchar2(30)
var send_tmstmp varchar2(11)
var ret_value number
var err_code varchar2(10)
begin
:usr_name := 'abc123';
:usr_name := '02-MAY-2008';
myschema.myproc ( p_usr_name => :usr_name,
p_send_tmstmp => TO_DATE( :usr_name, 'DD-MON-YYYY' ),
p_ret_value => :ret_value,
p_err_code => :err_code);
end;
print ret_value;
print err_code; -
How to login as DBA in oracle 9i from sql plus .
how to login as DBA in oracle 9i from sql plus . ???
First you need to check whether your HR schema is still unlocked or not? If it is locked - then you have to unlock it. And, then you can connect the Hr schema.
But, i'm not sure - why you need system to log into the HR schema?
Regards.
Satyaki De. -
How to start/stop process flow from sql*plus?
Hi,
i know how to start a process flow via sqlplus_exec_template.sql, but i cannot find any information on how to stop (and rollback) a working flow from sql*plus. Any help would be appreciated.
Greetings
Christoph
Message was edited by:
ctrierweilerHi,
I've had a go.
How should I interpret the results of list_requests:
owner_owr@ORKDEV01> @list_requests
====================
DEPLOYMENTS
====================
Audit ID Status Name Date Owner
2706 READY Deployment Fri Nov 11-NOV-05 10:49:59 OWNER_OWR
11 10:46:37 CET 2
005
====================
DEPLOYMENT UNITS
====================
Audit ID Status Name Date Owner
2707 READY Unit0 11-NOV-05 10:49:59 OWNER_OWR
====================
EXECUTIONS
====================
Er zijn geen rijen geselecteerd.
owner_owr@ORKDEV01>
Whilst a process flow is executing the last query will list executions, all of which have status BUSY:
owner_owr@ORKDEV01> @list_requests
====================
DEPLOYMENTS
====================
Audit ID Status Name Date Owner
2706 READY Deployment Fri Nov 11-NOV-05 10:49:59 OWNER_OWR
11 10:46:37 CET 2
005
====================
DEPLOYMENT UNITS
====================
Audit ID Status Name Date Owner
2707 READY Unit0 11-NOV-05 10:49:59 OWNER_OWR
====================
EXECUTIONS
====================
Audit ID Status Name Date Owner
394512 BUSY PF_ONB01 04-MEI-06 09:11:12 OWNER_OWX
395328 BUSY ONB:FULL_PREPARE 04-MEI-06 09:11:55 OWNER_OWR
395324 BUSY PF_ONB01:ONB 04-MEI-06 09:11:55 OWNER_OWR
owner_owr@ORKDEV01>
As an aside, I will attempt to get rid of the READY deployment and deployment unit using deactive_deployment.sql
Now, if I attempt to use deactivate_execution.sql on any of the executions with status BUSY I get:
owner_owr@ORKDEV01> @deactivate_execution
Voer waarde voor 1 in: 396136
declare
FOUT in regel 1:
.ORA-20003: The object is not in a valid state for the requested operation
ORA-06512: at "OWNER_OWR.WB_RTI_EXCEPTIONS", line 94
ORA-06512: at "OWNER_OWR.WB_RTI_EXECUTION", line 774
ORA-06512: at "OWNER_OWR.WB_RT_EXECUTION", line 90
ORA-06512: at line 4
owner_owr@ORKDEV01>
So all the seems to remain is to use abort_exec_request.sql
This does the job, but the script itself hangs.
I think it has to do with the l_stream_id not being checked again after the initial IF. I think it should probably be part of the loop condition as it is again reset in the do_acks inside the loop.
Cheers & thanks,
Colin -
Calling a function from sql*plus
I can call my procedure from sql *plus
by doing
sql>call Proc_name(x,y);
How do you call a function?
nullJohn,
I think moifying the statement
CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
TO
CREATE OR REPLACE FUNCTION "OGUSER"."OGX1" (user_county in integer, user_permit in integer ) return NUMBER is
AND before end you will have to add a return statement
(Probably
return 0;
exception
when others then
return 1;
end;
This will change your procedure to a function but I am not sure you'll be able to see your dbms_output's, if you call the function using select ...
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by john saucer ([email protected]):
I want to turn my procedure into a function.
So I can call it with a select statement.
I'm kind of having problems with the return statement at the top and bottom.
I don't quite understand how to declare the type in the return. My procedure calculates 2 pl/sql tables....
My procedure looks like.
CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
as
i integer :=0;
j integer :=0;
type dept_table_type is table of ogxtest%rowtype
index by binary_integer;
type dept2_table_type is table of ogxtest%rowtype
index by binary_integer;
my_dept_table dept_table_type;
my_dept2_table dept2_table_type;
v_cotemp number := user_county;
v_permittemp number := user_permit;
v_origcotemp number := user_county;
v_origpermittemp number := user_permit;
v_count number(2) :=1;
v_count2 number(2) := 1;
v_oldcount number(2) :=1;
v_oldcount2 number(2) := 1;
begin
select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
select count(*) into v_oldcount from ogxtest where nco=v_cotemp and npermit=v_permittemp;
while v_count >= 1 LOOP
i := i+1;
v_count2 := v_count2 +1;
select *
into my_dept_table(i)
from ogxtest where oco=v_cotemp and opermit=v_permittemp;
v_cotemp := my_dept_table(i).nco;
v_permittemp := my_dept_table(i).npermit;
select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
end loop;
while v_oldcount >= 1 LOOP
j := j+1;
v_oldcount2 := v_oldcount2 +1;
select *
into my_dept2_table(j)
from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
v_origcotemp := my_dept2_table(j).oco;
v_origpermittemp := my_dept2_table(j).opermit;
select count(*) into v_oldcount from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
end loop;
for i in 1..v_count2-1
loop
dbms_output.put_line(' reassigned to - orig county ' | |my_dept_table(i).oco | | ' orig permit ' | |my_dept_table(i).opermit| | ' new county ' | |
my_dept_table(i).nco | | ' new permit ' | |my_dept_table(i).npermit );
end loop;
for j in 1..v_oldcount2-1
loop
dbms_output.put_line(' reassigned from - orig county ' | |my_dept2_table(j).oco | | ' orig permit ' | |my_dept2_table(j).opermit| | ' new county ' | |
my_dept2_table(j).nco | | ' new permit ' | |my_dept2_table(j).npermit );
end loop;
end;
<HR></BLOCKQUOTE>
null -
Windows service does not stop when DB is shutdown from SQL*Plus
I have a 11g XE DB in a Windows 7 machine.
The installation has created a Windows service called OracleServiceXE. It's status is STARTED.
I then login to SQLPLUS as sysdba and do a shutdown immediate;
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Problem is, when I refresh the services, the OracleServiceXE is still showing as STARTED.
If I use the listener control to stop the listener the Windows service OracleXETNSListener changes status to BLANK.
Why is this?tvCa-Oracle wrote:
That service is a prerequisite Windows service to be able to start the database, but it is not the status of the database itself.
When you do start the database, he may or may not start the service automatically (not sure there), but it is a needed service, for each database SID, on Windows.
If you want to know what it is, open Task Manager or Process Explorer, only start the service (not the database), and see which OS process is launched.
AFAIK, this is only on Windows, there's no comparable component on Linux/Unix for this.
The Windows service OracleServiceXE has c:\app\oracle\product\11.2.0\server\bin\ORACLE.EXE XE as the Parth to executable.
If I click on the Services tab in Task manager, then right-click the OracleServiceXE and click Go to process, it show the oracle.exe in the processes tab.
If stop it, the service, from the Windows service control, the oracle.exe disappears and we cannot login to the DB.
If we start the service from the windows service control, the oradim.exe appears, then a second later the oracle.exe appears. Once the DB status of the Windows service is STARTED, the oradim.exe disappears.
So, I can start and stop the oracle DB with the Windows service. But If I stop the DB from sql*plus the the service is not stopped.... -
Execute a mapping deployed with OWB 9.0.4 from SQL*Plus
Hello,
I could execute a mapping designed with OWB 9.0.3 from SQL*Plus with the next sentence:
SQL> exec my_mapping.main;
But now, with OWB 9.0.4, mappings are deployed as functions (in 9.0.3 were deployed as procedures) and they need parameters.
Somebody know how I can execute deployed mappings with OWB 9.0.4 from SQL*Plus? I don't know the parameters I need to call a mapping.
Thanks in advance,
Pedro.Well, I've solved the problem with roles but
I've executed the script called sqlplus_exec_template.sql and it fails at Stage 2 because the next sentence
l_audit_execution_id := wb_rt_api_exec.open(l_task_type, l_task_name, l_location_name);
returns me NULL.
It is not clear the value that the variable called l_location_name have to stored. The script explain that this variable store the physical name of the
location to which the task was deployed. I understand that this variable have to store the schema where the mapping was deployed. That's right?
So I called the script in this manner:
SQL> @sqlplus_exec_template OWBRUN904I OJBHT PLSQL MY_MAPPING "," "," ;
where OWBRUN904I is the name of the Runtime Repository Schema, OJBHT is the
schema where MY_MAPPING is deployed, PLSQL is the task type and MY_MAPPING is
the name of the mapping I've designed.
Can you tell me why the scripts fails?
Regards,
Pedro -
How to run O/S command from SQL * Plus.
Hi,
Can i run O/S commands, say copy or move, from SQL * Plus prompt? If yes, what is the command.
Thanks.hi,
or you can try the following
slq > !
and then your command
rgds
Alan -
How to insert data which contains '&' from SQL*Plus without asking prompt
Hi,
I want to insert data in table from SQL*Plus but data value contains '&' as given in below example(insert script).
There are 10000 rows. When I load from SQL*Plus it is asking for 'value for :P'.
I dont want to replace '&' with 'and' also there should not be prompt for asking value for :P.
Example
Insert into CS_Tracker (TrackId,FeedBack) values ('ARARGE034678','S&P');
Insert into CS_Tracker (TrackId,FeedBack) values ('ARARGE034676','S&F');
Insert into CS_Tracker (TrackId,FeedBack) values ('ARARGE034677','A&P');
Can anyone help me in above issue.
Thanking in Advance
Sanjeevuse
set define offbeforehand
Maybe you are looking for
-
Form Menu fields in FIrefox browsers vs IE
I have a membership registration form with a number of drop-down Menus. No problem with IE, but with Firefox, on some of the menus, the menu items do not stay visable after you hit the down arrow UNLESS you click on the down arrrow and hold the mouse
-
Publishing error (failed to connect to server)
Using X5, I am trying to publish to our help server (web help pro), but getting a message in the output window "Warining: Failed to publish to 'yourserver'. reason: Failed to connect to server. All my permissions are set up as described here: http://
-
Cannot sync apps because installed apps cannot be determined
Ever since I downloaded IOS 6.0.1, I cannot sync my apps. It comes up with the below message: "iTunes cannot sync apps to the iPhone because the apps installed on the iPhone could not be determined." Anyone know how to resolve this?
-
Variant Pricing - Passing a Z* condition to a quote
Wondering if anyone knows how to pass a z condition to a quote from the configuration. We have variant pricing working for the VA00 pricing conditions, but would like to pass across a Z condition. Any ideas?
-
Hello! I have a question regarding architecute of SMP3 applications. We have a project - creation iPad native mobile applications for reporting and we are participating in Rump-Up of SMP 3.0. We are using BI 7.4, Netweaver Gateway for OData interface