How to see history in Oracle SQL
how to see history in Oracle SQL
i.e
create table.....
select * from tablename....
delete tablename;
Now i want to see how many command run after login.......please tell me the command...
user12261139 wrote:
how to see history in Oracle SQL
i.e
create table.....
select * from tablename....
delete tablename;
Now i want to see how many command run after login.......please tell me the command...I'm not aware of an easy way to see how many commands were run after logging on. Different tools have different capabilities, though.
The ms-dos version of SQL*PLUS offers a Doskey option to use the up and down arrows to recover recently executed commands.
The SQL Workshop in Apex has a command history. Some of the GUI tools might offer similar functionality.
Similar Messages
-
How to see dbms_output on oracle sql developer
ned immediate help
how to see dbms_output on oracle sql developerHi,
In sql developer u have a tab named DBMS Output in your result sheet. In that the first Icon is Enable DBMS Output. turn it on (After on it will give the message set serveroutput on in the sheet) and then run your code.
In the code u have to use the dbms_output.put_line package.after running the code u have to see the result in DBMS Output tab.
Regards,
NTR -
How to update column in Oracle SQL Developer?
Hi everybody,
How can I update table in Oracle SQL Developer like in PL/SQL Developer use:
Select * from table for update;
Thank you~Do you mean you want to edit the result grid?
You can't edit the result grid of a query, but you can edit the data tab of a table.
Click on the table in the object browser
Click on the data tab
Optionally filter the results using the filter field at the top
Type into the data cells.
Click on the commit button -
How to connect database using oracle SQL developer
Hello
I am newbie in EBS R12
I downloaded Oracle SQL Developer
and create new database conenction
Connection name: ebs demo db connection
username:
password:
Role: Default
Connection type: Basic
Hostname: ebstailin.demo.com
Port: 1521
SID: clone
when i try this there is an error
Status: Failure-Test failed: lo exception: The Network Adapter could not establish the connection
no idea about this
but i used the apps/apps as username and password
please help
thanks
Edited by: cheesewizz on Jul 16, 2010 11:35 PMHello
Thanks for your reply
I tried to connect and here is the result: see below
[oracle@ebstailin 11.1.0]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Sat Jul 17 15:35:31 2010
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> CONNECT apps/apps
Connected.
SQL>
But still cannot connect using ORACLE SQL Developer
thanks -
How to create databse in oracle sql developer
Hi am using oracle sql developer but while connecting to the database i am getting error of network adapter
if any buddy has a solution then fill free to post
Thanx and Regards
UmeshCan you be a little more specific with the error? The "network adapter" errors I've seen myself have been because SqlDeveloper can't connect to the database, either because the wrong host/port was given, or because a firewall was blocking the port.
-
How to use parameters in oracle SQL script????
Right now I am writing a SQL script to create a schema and build the objects of this schema....
I use a .net winform program to run sqlplus to parse this sql script ...
The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
So, how to use parameter in SQL script ...........
Are there some example scripts in oracle home directory for me to refer to????Hi,
UNISTD wrote:
thanks .....
what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
CREATE USER &1 ...a bind variable won't work.
"DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
"DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
ACCEPT sets a substitution variable with user interaction.
And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
The foloowing works, but, as you can see, it's ugly.
"DEFINE 1" display a message like
DEFINE 1 = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
So you can use a script like this:
-- This is DEFINE_DEFAULT.SQL
SPOOL got_define_txt.sql
DEFINE &dd_old
SPOOL OFF
COLUMN dd_new_col NEW_VALUE &dd_new
WITH got_define_txt AS
SELECT q'[
@got_define_txt
]' AS define_txt
FROM dual
SELECT CASE
WHEN define_txt LIKE '%=%'
THEN REGEXP_REPLACE ( define_txt
, '.+"
([^"]*)
, '\1'
ELSE '&dd_default'
END AS dd_new_col
FROM got_define_txt
{code}
and start your real script, ssss.sql, something like this:
{code}
DEFINE dd_new = sv1
DEFINE dd_old = 1
DEFINE dd_default = FOO
@DEFINE_DEFAULT
DEFINE dd_new = sv2
DEFINE dd_old = 2
DEFINE dd_default = "Testing spaces in value"
@DEFINE_DEFAULT
{code}
when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
Here's how it works:
Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query. That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default. The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
Notice that the paramerters to define_default.sql must be passed as global varibales.
Why didn't I just use arguments, so that we could simply say:
{code}
@DEFINE_DEFAULT sv1 1 FOO
{code}
? Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
I repeat: there must be a better way, but I'm sorry, I don't know what it is.
I usually don't do the method above. Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
{code}
@ssss ? par2 ?
{code}
and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value. The use has to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change. -
hi,
i m working on an application made in oracle 10g developer, & database is oracle 10g on aix ,
some times i get some problem when user save any data through forms it gets hanged ,
so tell me how to get rid of it , when i try to do it from sql navigator i see massges session is busy .
so y this eror i m getting & how to resolve it.
thxsHere you have some scripts:
rem
rem FUNCTION: Report all DB locks
rem
column osuser format a15 heading 'User'
column session_id heading 'SID'
column mode_held format a20 heading 'Mode|Held'
column mode_requested format a20 heading 'Mode|Requested'
column lock_id1 format a10 heading 'Lock|ID1'
column lock_id2 format a10 heading 'Lock|ID2'
column type heading 'Type|Lock'
set feedback off echo off pages 59 lines 131
start title132 'Report on All Locks'
spool rep_out\&db\locks
select nvl(a.osuser,'SYS') osuser,b.session_id,type,
mode_held,mode_requested,
lock_id1,lock_id2
from sys.v_$session a, sys.dba_locks b
where
a.sid=b.session_id
order by 2
spool off
pause press enter/return to continue
clear columns
set feedback on echo on pages 22 lines 80
set headingsep ='|'
set lines 160
set pagesize 20
ttitle 'Database Locking Conflict Report'
btitle 'Mode Held = indicates the user holding the lock|Mode Request = indicates the user waiting on the later to finish to establish lock||** End of Locking Conflict Report **'
column username format a10 heading 'User'
column terminal format a15 heading 'Application|PC'
column object format a15 heading 'Table'
column sql format a15 heading 'SQL'
column sid format 999 heading 'SID'
column lock_type format a15 heading 'Lock|Type'
column mode_held format a11 heading 'Mode|Held'
column mode_requested format a10 heading 'Mode|Request'
column lock_id1 format a8 heading 'Lock ID1'
column lock_id2 format a8 heading 'Lock ID2'
column first_load_time format a19 heading 'Requested'
break on lock_id1
select a.sid,
username,
terminal,
decode(a.type,'MR', 'Media Recovery',
'RT', 'Redo Thread',
'UN', 'User Name',
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
'DX', 'Distributed Xaction',
'CF', 'Control File',
'IS', 'Instance State',
'FS', 'File Set',
'IR', 'Instance Recovery',
'ST', 'Disk Space Transaction',
'IR', 'Instance Recovery',
'ST', 'Disk Space Transaction',
'TS', 'Temp Segment',
'IV', 'Library Cache Invalidation',
'LS', 'Log Start or Switch',
'RW', 'Row Wait',
'SQ', 'Sequence Number',
'TE', 'Extend Table',
'TT', 'Temp Table', a.type) lock_type,
decode(a.lmode,0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
to_char(a.lmode)) mode_held,
decode(a.request,
0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
to_char(a.request)) mode_requested,
to_char(a.id1) lock_id1, to_char(a.id2) lock_id2,
c.object object,
d.sql_text sql,
e.first_load_time
from v$lock a, v$session, v$access c, v$sqltext d, v$sqlarea e
where (id1,id2) in
(select b.id1, b.id2 from v$lock b where b.id1=a.id1 and
b.id2=a.id2 and b.request>0) and
a.sid = v$session.sid and
a.sid = c.sid and
d.address = v$session.sql_address and
d.hash_value = v$session.sql_hash_value and
d.address = e.address
order by a.id1, a.lmode desc
set headingsep ='|'
set lines 160
set pagesize 20
ttitle 'Database Locking Conflict Report'
btitle 'Mode Held = indicates the user holding the lock|Mode Request = indicates the user waiting on the later to finish to establish lock||** End of Locking Conflict Report **'
column username format a10 heading 'User'
column terminal format a15 heading 'Application|PC'
column object format a15 heading 'Table'
column sql format a15 heading 'SQL'
column sid format 999 heading 'SID'
column lock_type format a15 heading 'Lock|Type'
column mode_held format a11 heading 'Mode|Held'
column mode_requested format a10 heading 'Mode|Request'
column lock_id1 format a8 heading 'Lock ID1'
column lock_id2 format a8 heading 'Lock ID2'
column first_load_time format a19 heading 'Requested'
break on lock_id1
select a.sid,
username,
terminal,
decode(a.type,'MR', 'Media Recovery',
'RT', 'Redo Thread',
'UN', 'User Name',
'TX', 'Transaction',
'TM', 'DML',
'UL', 'PL/SQL User Lock',
'DX', 'Distributed Xaction',
'CF', 'Control File',
'IS', 'Instance State',
'FS', 'File Set',
'IR', 'Instance Recovery',
'ST', 'Disk Space Transaction',
'IR', 'Instance Recovery',
'ST', 'Disk Space Transaction',
'TS', 'Temp Segment',
'IV', 'Library Cache Invalidation',
'LS', 'Log Start or Switch',
'RW', 'Row Wait',
'SQ', 'Sequence Number',
'TE', 'Extend Table',
'TT', 'Temp Table', a.type) lock_type,
decode(a.lmode,0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
to_char(a.lmode)) mode_held,
decode(a.request,
0, 'None', /* Mon Lock equivalent */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
to_char(a.request)) mode_requested,
to_char(a.id1) lock_id1, to_char(a.id2) lock_id2,
c.object object,
d.sql_text sql,
e.first_load_time
from v$lock a, v$session, v$access c, v$sqltext d, v$sqlarea e
where (id1,id2) in
(select b.id1, b.id2 from v$lock b where b.id1=a.id1 and
b.id2=a.id2 and b.request>0) and
a.sid = v$session.sid and
a.sid = c.sid and
d.address = v$session.sql_address and
d.hash_value = v$session.sql_hash_value and
d.address = e.address
order by a.id1, a.lmode descCheers,
Francisco Munoz Alvarez
http://www.oraclenz.com -
How to see objects in Oracle 9i
i wrote :
CREATE TYPE A as OBJECT(
aa varchar2(10);
Warning: Type created with compilation errors.
the question are :
1. was the report normal? what's the meaning of compilation errors?
2. how i know if there's an object A stored in my login user.
3 . is there any code to see objects stored in my login user (maybe : desc objects ? or something like that)
thanxwas the report normal?Normal in the sense that this is the correct behaviour when our doesn't compile.
what's the meaning of compilation errors?The code is syntactically incorrect, the computer does not understand our input. In SQL*Plus we can use SHOW ERROR to see the compilation errors. In this case, it is the rogue semicolon in the attribute declaration. try this...
SQL> CREATE TYPE A as OBJECT(
2 aa varchar2(10)
3 );
4 /
Type created.
SQL>
how i know if there's an object A stored in my login user.
SELECT object_type, last_ddl_time
FROM user_objects
WHERE object_name = 'A'
is there any code to see objects stored in my login user SELECT object_name
FROM user_objects
WHERE object_type = 'TYPE'
Notice that Oracle has been using the term object to refer to things inside the database (e.g. table, index, procedure) look before object-oriented stuff was introduced. So it's good to be clear about whether you mean OBJECT or TYPE.
Cheers, APC -
How can I access the oracle/sql server jdbc driver class files from my cust
I have a war file in which I have custom DataSource i.e mypackage.Datasource class. Its basically the need of my application. In this class we connect to datasource and link some of our programming artifacts .
I have deployed the oracle jdbc driver and deploy my application as ear with datasources.xml in the meta inf file. Inspite of that my code fails to load the jdbc driver classes.
Here is the extract of the code :
Class.forName("oracle.jdbc.OracleDriver").newInstance();
String url = "jdbc:oracle:thin:@dataserver:1521:orcl";
Connection conn = DriverManager.getConnection(url, "weblims3", "labware");
if(conn != null){
out.println("the connection to the database have been achieved");
out.println("conn object achived= " + conn);
Class.forname fails in this case. I can see the ojdbc5.jar the driver jar in usr\sap\CE1\J00\j2ee\cluster\bin\ext\ojdbc5 . I even put the ojdbc.jar in web-inf/lib and application lib but does not help at all. Hope I have explained my problem clearly.
I deployed the jdbc driver in the name of ojdbc5 .
I am stuck here. It will be great help if anyone can help me in this. Thanks in advance.Bent,
You can access the database from your Java portlet, just like from any other Java/JSP environment. Yes, you can use JDBC, as well as BC4J.
The Discussion Forum portlet was built using BC4J, take a look at it's source to see how it was done.
Also, check out Re: BC4J Java portlet anyone?, it contains a lot of useful information too.
Peter -
How to connect sqlserver use oracle sql developer?
I created a non-oracle location connection in owb and can load data from sqlserver to warehouse. Now, I want to use sqlplus or sqldeveloper to connect sqlserver directly, But I got this error message"ora-03135:connection lost contact".
How can I connect sqlserver in sqldeveloper or sqlplus?
ThanksHi Napo,
SQLDeveloper can migrate to oracle, browse sqlserver and run and display results from single statements.
I have not seen "ora-03135:connection lost contact" have you set up sqlserver for tcp/ip connection, checked the port is open (and not blocked by, for example, firewalls) and used the jtds driver to connect SQLDeveloper to sqlserver?
Note that "ora-03135:connection lost contact" is an oracle error and does not seem related to sqlserver.
Oracle also has heterogenous gateway products which may be useful
Oracle® Database Gateway for SQL Server User's Guide
http://download.oracle.com/docs/cd/B28359_01/gateways.111/b31049/toc.htm
-Turloch -
How to view history in oracle database?
hi..
is there any method to view history of sqlplus command in oracle database ?.
This is because i would like to know what my vendor done to the oracle..
Thank you,
baharinThis is because i would like to know what my vendor done to the oracle..Interesting enough.
There is no direct method to view the commands executed from SQL*Plus.
If that sqlplus session was launched on Windows platform AND the command window buffer was already set to a higher value AND you have not yet closed that command window then you can launch sqlplus again in the same window and go through the history of commands.
Else, you can try mining your archive logs (assuming your database is in archive log mode), find out the commands executed from that particular session and hope you get all of them (as some commands are/were not supported by log miner). -
How to see Chinese data using SQL Plus?
Hi,
Is it possible to see the Chinese character string saved in the database by using English version Sql Plus? The following data is set up in the table NLS_DATABASE_PARAMETERS in my oracle database. I'm really appreciated if anybody could help me.
Thanks,
Suwei Ma
[email protected]
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET UTF8
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
PARAMETER VALUE
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_NCHAR_CHARACTERSET UTF8
NLS_RDBMS_VERSION 8.1.7.4.1Thanks for your repley. I don't think I need to change NLS_CHARACTERSET setup because I can load Chinese data into the database and also can see the data by running Chinese tool like NJStar Communicator. Therefore, I probably need to change the session level parameters, but not sure.
-
How to estimated time for oracle sql query
i have query run every month on production server to collect some information
data size is difference every month
what i need to estimate the time before running
how can i do thatsorry this is what i get
when i caculate time column it give me 10 sec
but when i make this
SQL> set timing on;
SQL> select * from tab;
3658 rows selected.
Elapsed: 00:00:05.50
so whay in the first give me 10 sec and the secand give me 5.50 sec
SQL> explain plan for select * from tab;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 457676135
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1243 | 104K| 182 (4)| 00:00:03 |
| 1 | NESTED LOOPS OUTER | | 1243 | 104K| 182 (4)| 00:00:03 |
|* 2 | TABLE ACCESS FULL | OBJ$ | 1243 | 98197 | 142 (5)| 00:00:02 |
| 3 | TABLE ACCESS CLUSTER| TAB$ | 1 | 7 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | I_OBJ# | 1 | | 0 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter("O"."TYPE#"<=5 AND "O"."OWNER#"=USERENV('SCHEMAID') AND
"O"."TYPE#">=2 AND "O"."LINKNAME" IS NULL)
4 - access("O"."OBJ#"="T"."OBJ#"(+))
18 rows selected.
SQL>
Edited by: 862640 on Nov 27, 2011 1:43 AM
Edited by: 862640 on Nov 27, 2011 1:49 AM
Edited by: 862640 on Nov 27, 2011 1:53 AM -
How achive below result in Oracle SQL
Hi All,
How to get the below result:
base table:
COLA COLB
112 01-JAN-2012
113 02-FEB-2012
114 02-MAR-2013
115 01-APR-2013
Result table:
COLA COLB COLC
112 01-JAN-2012 01-FEB-2012
113 02-FEB-2012 01-MAR-2012
114 02-MAR-2013 31-MAR-2013
115 01-APR-2013 02-APR-2013
Thanks!How do I ask a question on the forums?
SQL and PL/SQL FAQ -
How to achive this in Oracle SQL
Hi All,
How to get the below result:
base table:
COLA COLB
112 01-JAN-2012
113 02-FEB-2012
114 02-MAR-2013
115 01-APR-2013
Result table:
COLA COLB COLC
112 01-JAN-2012 01-FEB-2012
113 02-FEB-2012 01-MAR-2012
114 02-MAR-2013 31-MAR-2013
Thanks!user505326 wrote:
Hi All,
How to get the below result:
base table:
COLA COLB
112 01-JAN-2012
113 02-FEB-2012
114 02-MAR-2013
115 01-APR-2013
Result table:
COLA COLB COLC
112 01-JAN-2012 01-FEB-2012
113 02-FEB-2012 01-MAR-2012
114 02-MAR-2013 31-MAR-2013
Wrong Forum !!! Post at {forum:id=75}. Before posting there close this thread marking as answered.
Maybe you are looking for
-
Questions on ATP Check, RLT & Planning
Hi, I have a couple of issues regarding ATP checks and Planning, and I was wondering if anyone could help. 1. We have a setup right now where we are using standard SAP availability check with Replenishment Lead time. In the Purchasing, we might have
-
G5 no longer recognizes firewire
Hi, I have an early 2009 G5 that I have recently upgraded to OS X 10.8.3. I have also installed an external eSATA drive. Now, I can't get any of my FireWire devices to work. They show up in the System Report under the FireWire Bus, but FCP and Gar
-
Having trouble updating Elements Organizer 11
Having trouble updating Elements Organizer 11. I started it using Administrator priveleges, disabled firewall but keep getting "The update server is not responding. The server might be offline". I am using Windows 8.1 x64. My current version is 11
-
PSE 7 - open 1 file, OK. Open another file, CRASH!
I'm running PSE 7 on a Windows XP Pro machine with 3GB RAM. I'd had no problems until recently - I just installed about 15 Windows updates (mostly Office and IE security fixes), a Java update and an Adobe Reader update. After all these updates, I'm
-
Due Date for Reminders app and iCal
Where is the option to add a due date for a reminder? There is an option to Remind Me but no Due Date. The only way that a Due Date shows up in the Reminder app on the iPhone is if the Reminder is created within iCal on the Mac and syncs back to iPho