How to find SQL Statements for BW queries ?
Experts,
Is there a way, we can see what SQL statement BW queries creates ?
please Help.
Hi,
use sql trace: transaction ST05.
ask your database admin. He can control the database session.
=> for oracle: you can see the session also in the sap gui.
Sven
Similar Messages
-
How to find sql statement with Unix process pid
Hi
how to find sql statement with Unix process pid
is there any view to find that.
please if so let me know
Thanks in advancethis is how I am doing this:
oracle 7352340 7459066 0 07:47:10 - 0:00 oracleJDERED (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle 7459066 5386396 2 07:47:10 pts/1 0:01 sqlplus
select sid,serial# from v$session where process='7459066';
SID SERIAL#
2178 6067
select sql_text
from
v$sqlarea a,
v$session b
where a.hash_value = b.sql_hash_value
and b.sid = 2178
; -
How to find SQL Statement fired using SYS.AUD$ - Database Auditing
Dear Friends
I am having Oracle 9i Database and have configured it with database auditing option by setting the following parameter in init.ora file
AUDIT_TRAIL = "DB"
I want to audit SELECT, INSERT , UPDATE and DELETE operations on PRACTICE.EMP table for which I did :
1) Logged in as SYS
2) SQL> AUDIT SELECT, INSERT, UPDATE, DELETE
ON PRACTICE.EMP
BY ACCESS
WHENEVER SUCCESSFUL;
Audit Succedded
Now how should I find out the SQL statement that does the insert, update or delete operation on the EMP table using SYS.AUD$ table
ThanksHi,
It's contents can be viewed directly or via the following views:
* DBA_AUDIT_EXISTS
* DBA_AUDIT_OBJECT
* DBA_AUDIT_SESSION
* DBA_AUDIT_STATEMENT
* DBA_AUDIT_TRAIL
* DBA_OBJ_AUDIT_OPTS
* DBA_PRIV_AUDIT_OPTS
* DBA_STMT_AUDIT_OPTS
The audit trail contains a lot of data, but the following are most likely to be of interest:
* Username : Oracle Username.
* Terminal : Machine that the user performed the action from.
* Timestamp : When the action occured.
* Object Owner : The owner of the object that was interacted with.
* Object Name : The name of the object that was interacted with.
* Action Name : The action that occured against the object. (INSERT, UPDATE, DELETE, SELECT, EXECUTE)
So, take a look at action_name column from DBA_AUDIT_TRAIL view.
Cheers
Legatti -
How to find SQL statement = Database Auditing
Dear All
I have configured Database Auditing on Oracle 9i Enterprise Edition Server
parameter init.ora file:
AUDIT_TRAIL = "DB"
I want to audit INSERT,UPDATE, DELETE STATEMENT on PRACTICE.EMP table
for which i did :
1) Logged in as SYS
SQL> AUDIT INSERT,UPDATE,DELETE
ON PRACTICE.EMP
BY ACCESS
WHENEVER SUCCESSFUL
Audit Succedded
2) Now I have to check the SQL statement that did insert update or delete operation using SYS.AUD$
3) There is SQLTEXT field , datatype is CLOB.
How should I check the SQL Statements that were fired on PRACTICE.EMP table
Kindly helpSQL> show user
USER is "SYS"
SQL> alter system set audit_trail = db,extended scope=spfile;
alter system set audit_trail = db,extended scope=spfile
ERROR at line 1:
ORA-32001: write to SPFILE requested but no SPFILE specified at startup
I have init.ora but no spifle so should I create SPFILE based on INIT.ORA and then give the command ?
As of now I am using V$SQL view to find all the commands executed on my database.
I found one good book "Oracle Security" OREILY PUBLICATION in which Auditing Database is discussed in good details.
Thank you so much for all your efforts -
How to find sql statement which generates LOCK
Hello,
In my plsql procedure i have used SELECT FOR UPDATE NO WAIT statement to avoid the current record used by another user.
Actually i want to find which sqlquery is locking the Object other than my procedure.
I can find the session id which is locking the object but i can not able to find sql text.
How to find the SQL text from particular LOCKING Session id as v$sql or v$sqltext or v$sqlarea dont have session id?
Any help can be appreciated.
Thanks in advance.It's not necessarily that easy to find the statement that was responsible for the lock.
It depends.
First of all, it depends on version.
If you're >= 10g and you're lucky and you're licensed for Diagnostic Pack, you might find it in ASH.
If the statement that's responsible for the lock is also waiting on something else or runs for long enough, then ASH will almost certainly have it.
Doug Burns has a 10-part series on the subject.
http://oracledoug.com/serendipity/index.php?/archives/1477-Diagnosing-Locking-Problems-using-ASH-Part-1.html -
How to find export statement for Import statement ?
hi experts,
I am having an IMPORT....from memory ID statement in my program.
how could i find the location of EXPORT ...to memory ID statement for the IMPORT statement.
Pls help
saravanan.Not possible if you are just trying to find it without knowing the links between your program and the other programs. You have to know all the objects that relate to the process that your program is automating and then you can probably dig into those related programs to see if there is an EXPORT statement there. But it is not as simple as double clicking on the IMPORT statement or doing a WHERE-USED on the memory ID.
-
How to write Sql statement for M:M relationship set?
If theres two Entity sets "Department" and "Employee".....
Department Entity contains this attribute dno,dname,address etc and
"Employee" entity contain attribute like Empno,Empname,date,time etc
and theres Many to Many relationship between Employee and Deapartment Entity set,i.e.each employee can work in any department, and each department has at least one employee (Many to Many relationship)
What should be the SQL statement to create table for Many to Many relationship sets for Employee and Department set..
Any helps will be appreciated.
Femicreate 3 tables: employee, department and empdept
in the empdept table you reference foreign keys from the 2 other tables. so if my employee id was 42 and I work for departments 1,2 and 3, this table would look like this:
emp_fk | dept_fk
42 1
42 2
42 3 -
Nested SQL statements for complex, detailed queries.
Is it possible to write nested SQL statements for complex, detailed queries. A nested query
has a WHERE clause that includes a SELECT statement ? Is it true or false ?Hi wahid,
Here are pretty good examples:
http://www.databasejournal.com/features/mssql/article.php/3464481/Using-a-Subquery-in-a-T-SQL-Statement.htm
http://technet.microsoft.com/en-us/library/aa213252(v=sql.80).aspx
Regards Harsh -
How to monitor/capture SQL statement for an event?
I want to capture all sql statements for 10 minutes that ran against the database. How should i do that?
Thanks,
DaveThe following document will give u the requred know how.
http://www.oracle.com/technology/products/manageability/database/pdf/ow05/PS_S001_274001_106-1_FIN_v1.pdf -
Need help on SQL Statement for UDF
Hi,
as I am not so familiar with SQL statements on currently selected values, I urgently need help.
The scenario looks as follows:
I have defined two UDFs named Subgroup1 and Subgroup2 which represent the subgroups dependent on my article groups. So for example: When the user selects article group "pianos", he only sees the specific subgroups like "new pianos" and "used pianos" in field "Subgroup1". After he has selected one of these specific values, he sees only the specific sub-subgroups in field "Subgroup2", like "used grand pianos".
I have defined UDTs for both UDFs. The UDT for field "Subgroup1" has a UDF called "ArticleGroup" which represents the relation to the article group codes. The UDT for field "Subgroup2" has a UDF called "Subgroup1" which represents the relation to the subgroups one level higher.
The SQL statement for the formatted search in field "Subgroup1" looks as follows:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP1] T0 WHERE T0.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod])
It works fine.
However, I cannot find the right statement for the formatted search in field "Subgroup2".
Unfortunately this does NOT WORK:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT $[OITM.U_Subgroup1])
I tried a lot of others that didn't work either.
Then I tried the following one:
SELECT T0.[Name] FROM [dbo].[@B_SUBGROUP2] T0 WHERE T0.[U_Subgroup1] = (SELECT T1.[Code] FROM [dbo].[@B_SUBGROUP1] T1 WHERE T1.[U_ArticleGroup] = (SELECT $[OITM.ItmsGrpCod]))
Unfortunately that only works as long as there is only one specific subgroup1 for the selected article group.
I would be sooooo happy if there is anyone who can tell me the correct statement for my second UDF!
Thanks so much in advance!!!!
Edited by: Corinna Hochheim on Jan 18, 2010 10:16 PM
Please ignore the "http://" in the above statements - it is certainly not part of my SQL.
Please also ignore the strikes.Hello Dear,
Use the below queries to get the values:
Item Sub Group on the basis of Item Group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[U_GroupCod] =$[OITM.ItmsGrpCod]
Item Sub Group 1 on the basis of item sub group
SELECT T0.[Name] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[U_SubGrpCod]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp])
Sub group 2 on the basis of sub group 1
SELECT T0.[Name] FROM [dbo].[@SUBGROUP2] T0 WHERE T0.[U_SubGrpCod1]=(SELECT T0.[Code] FROM [dbo].[@SUBGROUP1] T0 WHERE T0.[Name] =$[OITM.U_ItmsSubgrp1])
this will help you.
regards,
Neetu -
How to use SQL functions in the queries
hey guys i wanna know how to use SQL functions in the queries is it possible or not .
Hi,
Wat exactly that set values are?
those from sql query?
How to use count():
The COUNT() function returns the number of rows that matches a specified criteria.
SQL COUNT(column_name) Syntax
The COUNT(column_name) function returns the number of values (NULL values will not be counted) of the specified column:
SELECT COUNT(column_name) FROM table_name
SQL COUNT(*) Syntax
The COUNT(*) function returns the number of records in a table:
SELECT COUNT(*) FROM table_name
SQL COUNT(DISTINCT column_name) Syntax
The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column:
SELECT COUNT(DISTINCT column_name) FROM table_name
The IN function helps reduce the need to use multiple OR conditions.
The syntax for the IN function is:
SELECT columns
FROM tables
WHERE column1 in (value1, value2, .... value_n); -
Preparing Dynamic SQL statement for inserting in Pro*C
Hi Friends,
From quite some time i am struggling writing Dynamic SQL statement for dynamic insert and update in Pro*C.
Can somebody go through my code and suggest me the rigth way of doing.
Right now it throws an error saying " Error while updating ORA-00904: invalid column name "
Please help me.
Girish.
int main()
EXEC SQL BEGIN DECLARE SECTION;
char *uid ="scott/tiger";
static char sqlstmt[129];
struct /* DEPT record */
int dept_num;
char dept_name[15];
char location[14];
} dept_rec;
EXEC SQL END DECLARE SECTION;
EXEC SQL WHENEVER SQLERROR DO sql_error();
EXEC SQL CONNECT :uid;
dept_rec.dept_num = 50;
strcpy(dept_rec.dept_name,"ADMIN");
strcpy(dept_rec.location,"IN");
strcpy(sqlstmt,"UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num");
EXEC SQL EXECUTE IMMEDIATE:sqlstmt;
EXEC SQL COMMIT;
exit(0);
void sql_error()
printf("\nError while updating %s",sqlca.sqlerrm.sqlerrmc);
EXEC SQL ROLLBACK;
}A bit rusty here but this is how I see it.
Think of it this way ..
all Oracle is going to see is:
UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num
Its NOT going to know what dept_rec.dept_name is or dept_rec.dept_num is ..
it doesnt go back and fill in those values.
You need something like
strcpy(sqlstmt,"UPDATE dept set DNAME = \"");
strcat(sqlstmt,dept_rec.dept_name);
strcat(sqlstmt,"\" where DEPTNO = ");
strcat(sqlstmt,dept_rec.dept_num);
printf(sqlsmt); # Just to be sure the update statement look right during testing. -
How to find sql server backup was taken under compression mode
Hello,
How to find SQL server backup was taken under compression mode ? I have disabled the Compress Mode backup setting but I want to make sure the backup is taken without compression.
Is there a script for that?
Thanks
JKI have disabled the Compress Mode backup
That is only a default setting, in backup command you can always overwrite it to a different value.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Problem with SQL Statement for Result Filtering
Dear Visual Composer Experts,
Here is another Question from me: I have a SQL Query that is working as the data service
Select AB.AgingBandID, AB.AgingBand,
Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],
Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,
Sum(Case when priority='High' then '1' Else 0 End) as High,
Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,
Sum(Case when priority='Low' then '1' Else 0 End) as Low
from DimAgingBand AB left outer join
(Select AgingBandID , priority , yeardesc
from vNotifications where YearDesc = (select year(getdate())-1)) as vN
on AB.AgingBandID=vN.AgingBandID
where AB.AgingBandID<>'1'
Group by AB.AgingBandID, AB.AgingBand
Order by AB.AgingBandID
That would return me a table as in the following:
Agingband E U H M L
< 1week 0 0 0 0 1
1 - 2 weeks 0 0 0 0 0
2 - 4weeks 0 0 0 0 1
> 1month 8 2 1 1 6
Now that I would like to add some parameters to filter the result, so I modify the query and put it in the SQL Statement input port of the same data service. The query is like this:
"Select AB.AgingBandID, AB.AgingBand,Sum(Case when priority='Emergency' then '1' Else 0 End) as [Emergency],Sum(Case when priority='Ugent' then '1' Else 0 End) as Ugent,Sum(Case when priority='High' then '1' Else 0 End) as High,Sum(Case when priority='Medium' then '1' Else 0 End) as Medium,Sum(Case when priority='Low' then '1' Else 0 End) as Low from DimAgingBand AB left outer join (Select AgingBandID , priority , yeardesc from vNotifications where YearDesc like '2009%' and Branch like '" & if(STORE@selectedBranch=='ALL', '%', STORE@selectedBranch) & "' and MainWorkCentre like '%') as vN on AB.AgingBandID=vN.AgingBandID where AB.AgingBandID<>'1' Group by AB.AgingBandID, AB.AgingBand Order by AB.AgingBandID"
However this input port query keeps giving me error as NullPointerException. I have actually specified a condition where the query will run if only STORE@selectedBranch != u2018u2019.
I have other filtering queries working but they are not as complicated query as this one. Could it be possible that query in the input port cannot handle left outer join?
Could it be anything else?
Help is very much appreciated.
Thanks & Regard,
SarahHi,
Thank you very much for your replys. I've tested if the dynamic value of the condition is integer, it's OK
But if the ClassID type is not integer, it's string, I write a SQL Statement like:
"Select DBADMIN.Class.ClassName from DBADMIN.Class where DBADMIN.Class.ClassID = '1' "
or with dynamic condition:
"Select DBADMIN.Class.ClassName from DBADMIN.Class where DBADMIN.Class.ClassID = '"&@ClassID&"'"
or I write the SQL Statement for insert/update/delete data,
I always have errors.
I've tested if the dynamic value of the condition is integer, it's OK
Do you know this problem ?
Thank you very much & kindly regards,
Tweety -
SQL statement for calculating performance targets
Hi
I have taken of the admin of a database which stores project goals and scores. I have to develop a way to calculate how well all projects meet these scores. The table concerned is called goal and looks like this:
goal
goal_name
project_code
current_value
good_value
bad_value
This can be for many different goals, for example if a project wants to get up a goal of having no more than 5 bugs in the project. I can also set a bad value, say 20, so if any projects have 20 or more bugs, triggers or alerts can be sent So I can enter into this table. The reason for putting 5 for good not 20 is because these scores are to be realistic.
project_code = foo
goal_name = software bugs
good_value = 5
bad_value = 20
However, some goals may have the values switched and be in a much higher range, or may even be a percentage. For example one for number of sales could be
project_code = foo
goal_name = software sales
good_value = 200
bad_value = 50
or project delay
project_code = foo
goal_name = sproject delay
good_value = 0%
bad_value = 50%
i am trying to develop a SQL statement so I can get a % score of how well a goal is performing, so I can see
What is the goal % for all foo goals
Or what is the goal % for goal 'software sales'
And also more importantly, how well are the goals doing globally.
The requirement for doing this is using a single SQL statement, well, one SQL statement for the requirements I listed above, so for example the semantics are
SELECT average(goal perforance) WHERE .... project = foo .... or goal = software sales... etc
I am having trouble doing this, I have been banging my head against mydesk all day. the biggest thing is thowing me off is that the good value can be higher or lower than the bad value, and I am having trouble visualizing how to but this conditional statement in SQL
One more thing, the percentage returned should never be more than 0% or 100%.
If anyone has any ideas or pointers, please help me out,
Thanks for your time,
Message was edited by:
user473327I am having trouble doing this, I have been banging
my head against mydesk all day. the biggest thing is
thowing me off is that the good value can be higher
or lower than the bad value, and I am having trouble
visualizing how to but this conditional statement in
SQLI haven't looked at your requirements in detail cos I don't have time for such cumbersome tasks. However, you could have two UNION'd select statements, one which caters for the good > bad and one which caters for the good < bad. Also and alternative would be the use of DECODE or CASE statements in your select which are good for switching things around based on conditions.
;)
Maybe you are looking for
-
Can't Eject iPod Classic in iTunes 10
After syncing my 160G iPod Classic with iTunes 10, I could not eject the iPod Classic in iTunes 10. It says the iPod is being used by another Application (when there is NONE except iTunes 10). I had to quit iTunes 10, and eject the iPod Classic via F
-
Hello good samaritans.. I need help.. The jump menu in my web page is not working. I already tried inserting a Go button but it still didnt work. I have a website and I created a template, in this template I created dummy jumpmenu first just to see h
-
Spliting a string based on Non Printable character
Hi, i have a requirement where i have to split a String based in non printable character " MYU(ascii: 230); es: ""This is to test æ raaaaaaaaaaaaaaaaa æ AAA010224544 æ 7118288888 æ æ is a not printable character and its ascci is 230.. iam getting tha
-
Merged help projects and context sensitiviy
I am using RoboHelp x5 and have created a master project and I have 3 .chm files merging into the master project. I've gotten TOC, Indexing, and Searchable help to work. But what about context sensitivity?\ Thanks!
-
Does the IPad camera connection kit work with the Ipad 4 and /or is the an adapter ?