PL/SQL :: Last Ran Query In The Database?
Jul 17, 2012I need to know the last executed sql query in the data base.
I tried desc v_$sql , etc.. but it says 'table or view doesnot exist'..
I need to know the last executed sql query in the data base.
I tried desc v_$sql , etc.. but it says 'table or view doesnot exist'..
When I try to store the xml as clob with element:
<revisedDate version="1">2013-06-10T11:00:00+11:00</revisedDate>
It is throwing �ORA-01830: date format picture ends before converting entire input string�
But when I insert with
<revisedDate version="1">2013-06-10T11:00:00+05:30</revisedDate>,
it is getting inserted successfully.
PS: my db timezone is +00:00
At my Workplace we have a large Orcle 11g Database with 30 different tables for production control issues.I try to get a couple of different information from the database, so i started with SQL Query's, but for this problem i was not able to write an working query.
In this case i have 2 tables:
Table 1:
ID ;ORDER_NR ;DESCRIPTION ;CREATE_DATE
1 ;A500236 ;CLEAN HOUSE ;02/20/2012
2 ;A623555 ;REPAIR CAR ;01/10/2012
3 ;A866944 ;MAINTAIN EQUIPMENT ;02/11/2012
Table 2:
ID;ORDER_NR;WO_STEP;STEP_DATE;EMPLOYEE
1;A500236 ;A;02/21/2012;W0010
2;A500239 ;F;02/21/2012;W0010
3;A500239 ;S;02/22/2012;W0027
[code]....
And the result of my Query should look like this:
ORDER_NR;DESCRIPTION ;CREATE_DATE;A_STAT_AGE;R_STAT_AGE;U_STAT_AGE
A500236;CLEAN HOUSE ;02/20/2012 ;5 ;3 ;1
A623555;REPAIR CAR ;01/10/2012 ;42 ;39 ;38
A866944;MAINTAIN EQUIPMENT ;02/11/2012 ;15 ;4 ;3
The age of my query result should be calculated from the Create date of the Order.I want to know 2 things, one is how old was the Order when they reached that status A, R and U.The second this ist, how long did the order remain on the stat A,R and U (and if possible all other status also)It could happend that not each order reaches each status, so it ca go directly from A to you in this case i want display a wildcard in this row/column
I am New to Oracle and PL/SQL. How to import ACCESS database to Oracle(10g) using PL/SQL.
View 1 Replies View Relatedi have a single form three database field
i want when i open a form in exceute mode then only a single field it does not show any data from database
means query not allowed in that particular field
how it is posible
I have created a table using a CTAS
E.g. :
CREATE TABLE temp1 AS
SELECT * FROM table1;
Now after the table got created, is there any place in the data base where the select query is stored using which the table got created? In brief, I would like to get the select query through which the table got created.
How to get a port number in database with a sql query.
View 10 Replies View RelatedFor setting multilingual database which will have application data in Japanese I am preparing as follows....The database server is Linux and database is 10g (10.2.0.4) For storing Japanese characters in the database I am creating a database with AL32UTF8 character set
1) Do I need to change any settings on the Linux server just for handling Japanese characters? (In case it would have been windows database server would I need to change regional settings and/or any other OS settings to Japan etc?)
2) Assuming that a Japanese character will not fit in a single byte and default for semantic for char and varchar being byte, do...I need to change nls_length_sementic to char?
3) Apart from some more space requirement and performance impact on string functions will it cause any other adverse effect?
4)I would select Japanese character set -say JA16SJIS, instead of super UTF compliant AL32UTF8? What would be advantage of using AL32UTF8 over using Japanese specific character set?
5) Do I need to set nls_lang on the Linux server?
6) Users will be connecting to Linux server using putty or sqlplusw from windows Which operations will need the client to set nls_lang? To what value?
7) Apart from setting nls_lang on the client (if needed) as in question 6), are any settings needed on the client for inserting and displaying Japanese characters? e.g. regional setting, font setup, codepage setup.
I have the scenario where I have a table(table 1) which stores the car code and the meaning of that code. I then have another table (table 2)which just stores the code. My datablock is based on the table which just contains the code(table 2). On my form if the user wishes to populate this field in the record I have a Lov which goes to the table 1 and retrieves the code and the meaning of it.
The code is then returned to the corresponding field in the datablock for table 2. this works fine in adding and editing. the user sees the meaning and whilst selecting from the lov populates the code field behind the scenes and everything works fine. However, my problem is when the user does a query only the code field is populated from table 2 (the code field is hidden to the user) therefore the meaning field is left blank as if there is no data there when in fact this is not the case.
can we query this without login to the oracle database from linux os?database is up and running . /apps/oracle/product/11.2.0/dbhome/bin/sqlplus system/passwd select name from v$database;
View 5 Replies View RelatedMy problem is I have 3 tables (TEST_TBL1, TEST_TBL2, TEST_TBL3). TEST_TBL2 and TEST_TBL3 are in remote database and I use database link to join them. The following query returns incorrect result (I seems that it ignore the where clause)
SELECT * FROM TEST_TBL1 JOIN TEST_TBL2@db_remote USING (KEY1) JOIN TEST_TBL3@db_remote USING (KEY2) WHERE KEY1=XXX OR KEY2=YYY;
I am on 11R1 (11.1.0.7)
FOR EXAMPLE:
Local database:
CREATE TABLE TEST_TBL1
(
KEY1 NUMBER(5) NOT NULL,
[Code].....
I am trying to write a proper query to fetch data from database. Scenario:
I need to retrieve employees who are not working in multiple departments. scott@TESTCRM> select * from emp1;
EMPNO DEPTNO
---------- ----------
7654 30 7698 30 7788 20 7788 30 7876 20 7900 10 7900 30 7902 20 7934 10
scott@TESTCRM>
Ouput Expected is
EMPNO DEPTNO
---------- ----------
7654 30 7698 30 7876 20 7902 20 7934 10
I would like to know 2 days back lock conflicts session information which user held the lock,sql text,when the lock released. any sql query or view in oracle 11g db.
View 1 Replies View RelatedI am facing a weird situation wherein the explain plan of same sql in SIT and PROD is different.In fact the explain plan is very costly in Prod.Also the DB version of both SIT and PROD is same.
Below is the sql and corresponding explain plan in Prod and SIT respectively.
Query:
SELECT seq,CCN,ProcessorPart,root_item,comp_path,Item,comp_item,comp_item_type,
lag(comp_item_type,1,'PART') over(PARTITION BY seq ORDER BY lvl)Nxt_comp_item_type,lvl,bom_qty,
ROUND(CASE min(abs(bom_qty)) OVER (PARTITION BY seq ORDER BY lvl)
WHEN 0 THEN 0 ELSE 1 END * EXP (SUM (LN (nullif(abs(bom_qty),0))) OVER (PARTITION BY seq ORDER BY lvl))) Ulti_qty,
'AMER'
[code]...
The tables referred in above query is small tables containing arnd 10k records.The above tables are partitioned on Region and not indexed.
Explain Plan in Prod: COST CARDINALITY BYTES
SELECT STATEMENT, GOAL = ALL_ROWS165173613539322883634804
SORT UNIQUE236360
UNION-ALL
PARTITION LIST SINGLE117240
[code]...
Explain Plan in SIT: COST CARDINALITY BYTES
SELECT STATEMENT, GOAL = ALL_ROWS3211689
SORT UNIQUE347240
UNION-ALL
PARTITION LIST SINGLE172120
[code]...
I am not able to attribute why there is a huge change in Cost between SIT and Prod.Apparently the Job is going for 3-5 hours which used to get completed within 20mins in SIT.
suggest on the dependenecy between the database service and the database instance?
srvctl start instance -i db1
will this start service as well for which the above instance is either preferred or available instance?
will it start the listener as well?
srvctl stop instance -i db1
will this stop service as well for which the above instance is either preferred or available instance?
will it stop the listener as well?
srvctl start service -d db -s dbserve
will this start service as well for which the above instance is either preferred or available instance?
srvctl stop servive -d db -s dbserve
will this stop service as well for which the above instance is either preferred or available instance?
srvctl start database -d db
will it start instance, listener and service as well?
srvctl stop database -d db
will it stop instance, listener and service as well?
Our Team is planning to find a new architecture for our new project. In which we have to fire query to multiple database and then we have to collect all responses from them.(Suppose there are 10databases on which we have to fire query)
I searched a lot,the only thing I got is...It could be possible only through Database link(DbLink),Is there any other way to fire query on distributed databases...?
As I understand we can't clone database across platform using Rman, as Rman backup taken on say Unix is useless to be recovered on Windows. Though I think of Export and Import, will copying the datafiles, logfiles, controlfile will serve purpose for cloning across platform?
Note that I do not mean Transportable tablespace here. Only copying cold backup across platform
I have a function declared as PRAGMA AUTONOMOUS_TRANSACTION.
If i execute this function everything is fine.
If I call this function from a remote database, I have this error message:
"ORA-14551: cannot perform a DML operation inside a query".
select function('parameter') from dual;
Result: "OK"
select function@dblink1('parameter') from dual;
Result: "ORA-14551: cannot perform a DML operation inside a query"
provide me the query to check our database is running using spfile or running using pfile.
View 2 Replies View RelatedI have 10 users in my database, I need to find the time at which a query is fired by any of the users in the database. provide the query for this? I think i have to use V$sql,v$sqlarea or v$sql.
View 1 Replies View RelatedI need to get a way to find, The client fired the SQL Query is still connected to the database or not. For e.g.
I fire an SQL query using SQL Developer, Query approximately takes 5 mins to complete. As soon as I fire the query SQL devloper hangs and I close it using task manager.
Is there any way I can identify such session where SQL developer fired the query is terminated but the query fired is still running.
I have to identify such Orphan session and terminate it.
I am trying to search a word which starts with 'FRA' in any columns and any tables.
I am unable to find what is generating a join datasets in the webservice from teh database as it is not apparent within the 100 tables.
I ahve looked into
Re: How to search in all rows and all columns?
Re: SQL Search Query?
but none of these queries is working out for me as I am a user with no tables on its own but rather a user quering other tables.I think its a tweak on which dat a dictionary I can view
select distinct substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from all_cons_columns,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || 'fra'
|| '%'')'
).extract ('ROWSET/ROW/*')
)
) t
order by "Table";
running teh above query got me thsi error:
ORA-19202: Error occurred in XML processing
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
19202. 00000 - "Error occurred in XML processing%s"
*Cause: An error occurred when processing the XML function
*Action: Check the given error message and fix the appropriate problem
Its a simple query to retrieve data with the Order_ID.If the record is there its fine and can retrieve the data. But my query is to retrieve the list of order_id which has no records in database.
View 12 Replies View RelatedI need a job to get executed for every 1hour.Like i need a query to identify invalid objects in database per schema ,invalid type and this is a job to run every hour.How to schedule it.I only know that dba_jobs have the info.
View 3 Replies View Relatedwhy this query is not raising an error:
select memberid, mi.typeid, emailaddress
from memberdata@prod_db m
join memberitems@prod_db mi on m.memberid = mi.memberid;
These are the tables:
SQL> desc memberdata@prod_db
Name Null? Type
----------------------------------------- -------- ----------------------------
MEMBERID NUMBER
EMAILADDRESS VARCHAR2(50)
ADDRESS1 VARCHAR2(50)
SQL> desc memberitems
Name Null? Type
----------------------------------------- -------- ----------------------------
MEMBERID NUMBER
ITEMID NUMBER
Shouldn't we raise an 'ambiguous column' error on memberid?
Version information:
Forms [32 Bit] Version 10.1.2.3.0 (Production)
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
When an user enters a value in a field of a Screen, I want to query up the next screen records based on that user input value in the previous screen.The previous screen is based on a control block i.e.
Q_EMP
items- Q_EMP.emp_id, Q_EMP.FY, Q_EMP.hire_flag.
I want to know if there is any reflection on the standby database states when it's primary is down or not reachable? I want to use this information from standby node to determine if I can programmatically execute (dgmgrl) failover operation or not? This is considering that the broker configuration has no fast-start failover and no observer enabled/configured.
View 4 Replies View RelatedI am using Pro*C/C++ Release 10.2.0.2 in HP-UX. But Pro*C/C++ application was written long back during oracle release 8. Now we are facing a problem like EXEC SELECT query is not fetching the records even though record is present in DATABASE.
This is not happening every time. This problem starts happening only after heavy use of the unix process.
For every request, unix process will fetch the record and updates the same at the end and process goes to wait mode to get the request again. Let say after 50 request, process is returned with no rows found error.
It started working fine only after restarting the process and problem starts again after 50th or 60th request. This problem we are facing only after upgrade to 10g.
does parallel hint in query can create bottleneck/Slowdown/crash database..??
View 4 Replies View RelatedI am having issue with Oracle reserved words, one of the application is using table which has NUMBER as column. I am not able to query that table matching database with NUMBER column.
HERE
select a.*
from DOC a , FOLDER B
where a.NUMBER= B.INCIDENT_ID
and b.open = 'Closed'; I tried double quotes (“”) and sigle quotes too, none of them worked.