Tracing an Oracle user query as sys user

Hi,
i need to trace a particular user in Oracle database 11g as a sysuser. i want to know what all statements currently run by that user by generating trace file. How to do that?
Regards,
007

Or else use
execute DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION (sid=>507, serial#=>4957,sql_trace=>TRUE);
To disable:
execute DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION (sid=>507, serial#=>4957,sql_trace=>FALSE);
Or create trigger: whenever schemas login into db, trigger will be enablesd and trace all its activity in trace file and stop tracing when it logged off:
CREATE OR REPLACE TRIGGER SYS.set_trace
  AFTER LOGON ON DATABASE
  WHEN (USER like  '&USERNAME')
  DECLARE
      lcommand varchar(200);
  BEGIN
      EXECUTE IMMEDIATE 'alter session set statistics_level=ALL';
      EXECUTE IMMEDIATE 'alter session set max_dump_file_size=UNLIMITED';
      EXECUTE IMMEDIATE 'alter session set events ''10046 trace name context forever, level 12''';
  END set_trace;
  /

Similar Messages

  • Query execution is faster - as SYS user vs. application user in 11.1.07

    In +11.1.0.7+ database, we have noticed execution of an application process as SYS user is faster than the application user. To quantify this execution time was 2 hours as application user and same process when executed as SYS user completed in 1 hour.
    We ran tracing for this process and tkprof output showed follwoing:
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS:
    _call          count      cpu       elapsed disk query current rows_
    Execute 3705586 2440.49 *4294.54* 293602 21835223 23300886 3801288 <<< ==== SYS
    Execute 3703285 6356.69 *8576.50* 303175 21785419 23378086 3801291 <<< ==== Application user
    We have SR open with Oracle, but thought if some one knows about this issue would be great.
    Edited by: dhyani on Aug 17, 2010 3:16 PM

    What about the "Predicate Information" section of the execution plans - were those exactly the same? Did you use AUTOTRACE, EXPLAIN PLAN FOR, or the method that I showed to retrieve the execution plans? Where the SQL_ID and CHILD_NUMBERS displayed exactly the same? Is the STATISTIC_LEVEL set to TYPICAL for both sessions? You can check the setting in SQL*Plus like this:
    SQL> SHOW PARAMETER STATISTICS_LEVEL
    NAME                                 TYPE        VALUE
    statistics_level                     string      typicalAs a demonstration, I will change the value at the session level and then change the setting back:
    SQL> ALTER SESSION SET STATISTICS_LEVEL='ALL';
    SQL> SHOW PARAMETER STATISTICS_LEVEL
    NAME                                 TYPE        VALUE
    statistics_level                     string      ALL
    SQL> ALTER SESSION SET STATISTICS_LEVEL='TYPICAL';If the above does not show a difference, you will need to capture a 10046 trace at either level 8 or level 12 for both sessions and compare the wait events and the STAT lines in the 10046 trace to see where the additional time is being spent. Reference these two blog articles for the 10046 trace:
    http://hoopercharles.wordpress.com/2009/12/01/10046-extended-sql-trace-interpretation/
    http://hoopercharles.wordpress.com/2010/01/26/10046-extended-sql-trace-interpretation-2/
    Keep in mind that the goal is to not change anything until we understand the problem better. Maybe, just maybe, someone created a table (or view) or two in the SYS schema (or used a table/view name that matched a SYS owned object), in a normal user's schema, or there are synonyms pointing to different tables. So, it probably would be a good idea to verify that the results are exactly the same when the SYS user executes the SQL statement and a normal user executes the SQL statement.
    Charles Hooper
    Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    In oracle rac, If user query a select query and in processing data is fetched but in the duration of fetching the particular node is evicted then how failover to another node internally?

    The query is re-issued as a flashback query and the client process can continue to fetch from the cursor. This is described in the Net Services Administrators Guide, the section on Transparent Application Failover.

  • Access of oracle database through sys user

    Hi All,
    Can any one suggest me what are the possibility to access database through SYS user...I install oracle database 10.2.0.4 on Win-2003 SE.
    Now I want to make restrict that no one can be able to logged in database as a sys user so I do one thing that in sqlnet.ora file at server side make none in sql authentication line. What are the other possible way that user can access through sys user?
    Please suggest me...
    Thanks...

    user505 wrote:
    Hi All,
    Can any one suggest me what are the possibility to access database through SYS user...I install oracle database 10.2.0.4 on Win-2003 SE.
    Now I want to make restrict that no one can be able to logged in database as a sys user so I do one thing that in sqlnet.ora file at server side make none in sql authentication line. What are the other possible way that user can access through sys user?One other possibility can be to come from the remote system as the Sys user. So you can set remote_loginpasswordfile to shared. This will ensure that without knowing the password, person won't be able to connect.
    That said, there is no stopping for the person who would be knowing the credentials of your o/s or sys user.
    HTH
    Aman....

  • Connect to oracle sys user

    Hi folks
    when i try to connect to oracle sys user from the unixbox its opening an idle instance .
    [u01/appl/ora817]$ set ORACLE_SID=fclaie1
    [u01/appl/ora817]$ sqlplus
    SQL*Plus: Release 8.1.7.0.0 - Production on Thu Feb 28 09:37:55 2008
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Enter user-name: / as sysdba
    Connected to an idle instance.
    SQL>
    can someone suggest me why an idle instance is starting rather then the normal instance .
    Your expert suggestion is highly appriciated
    Thanks

    Connected to an idle instance.Idle Instance means the instance has not started.
    You can issue
    c) Copyright 2000 Oracle Corporation. All rights reserved.
    Enter user-name: / as sysdba
    Connected to an idle instance.
    SQL> startup <-- (Here)
    After which your instance will be started. By the way what you mean by normal instance?
    Adith

  • SYS user connects at database level, is it correct?

    My senior colleague has given me following information about the sys user. I want to know, is it correct?
    Since SYS user connects at the database level, therefore, on killing the active session of the SYS user,only the current statement is cancelled. The database session does not disconnect. Instead it continues to run the remaining statements in the script file in case we are running a script file containing a lot of SQL statements.
    Moazzam

    Moazzam wrote:
    My senior colleague has given me following information about the sys user. I want to know, is it correct?
    Since SYS user connects at the database level, therefore, on killing the active session of the SYS user,only the current statement is cancelled. The database session does not disconnect. Instead it continues to run the remaining statements in the script file in case we are running a script file containing a lot of SQL statements.Running a SQL script very likely means SQL*Plus is used. One of two types of Oracle sessions will be created via sqlplus. A dedicated session. Or a shared server session.
    A dedicated session can also be local (sqlplus connects "directly" to the dedicated server process), or remote (sqlplus connects via tcp/ip to the dedicated server process).
    A server session is usually "killed" using the alter system kill session command. Despite the differences between shared and dedicated server connections, the end result is the same. The session terminates abnormally (session UGA will be released, session will be cleaned up, rolled back, etc) - and the session ceases to exist.
    So irrespective of how that sqlplus session runs that script - the session, when killed, will cause a sqlplus failure. And no subsequent script commands would be executed by that Oracle session.
    What can happen is that sqlplus continues running, continues reading the script, and continues submitting commands to be executed. However, with the server session killed, there is no server process to service the commands submitted by the sqlplus client. In this case, sqlplus will throw the error "+SP2-0640: Not connected+" after each of the commands it tries to execute after the server session was killed.
    The only time when sqlplus will be able to continue is when the session is not killed, but interrupted. The Oracle Call Interface (OCI) supports a OCIBreak() call - allowing the client to interrupt-and-abort the request that its server session is currently executing.
    For example, sqlplus sends a OCIBreak() while it waits for a server response (e.g. waiting for the answer to a SQL select query), when the user presses Ctrl-Break to abort that request.
    In this case, the session still exists - and the client can issue a new request that the session will service. But an OCIBreak() cannot be triggered (to my knowledge) externally from another Oracle session. You need to send the client process a "break request" (like a Ctrl-Break keystroke) in order to trigger that client process to make an OCIBreak() call to Oracle and interrupt its server process.

  • How to install apex 4.2 in sys user.

    Hi All,
    We have apex 3.2 installed on 11.2.3 database. But I could see that when I query DBA_REGISTRY apex is installed in sys user. Normally it should be like APEX_030200..
    Can anyone help us to know how it can be installed in sys.
    COMP_ID
    COMP_NAME
    VERSION
    STATUS
    MODIFIED
    NAMESPACE
    CONTROL
    SCHEMA
    PROCEDURE
    APEX
    Oracle Application Express
    3.2.1.00.12
    VALID
    29-MAR-2013 08:56:09
    SERVER
    SYS
    SYS
    VALIDATE_APEX
    Thanks in advance.

    If you look deeper you will find that 4.2 is not released yet.
    You will also find the 4.2 Early Adopter has been released where you can review and play with 4.2 features.
    To sign up for the APEX 4.2 EA1 please go to: https://apexea.oracle.com.

  • Running query as diffrent user

    Hi,
    My qestion is, is there a substitiute for linux "su" in oracle. I.E when im loged in as DBA i whant to run query as XXX user with lower privileges. The problem is i whant to use connectionpool and Ora Lable Security.
    Thanks in advice,
    MT

    Perhaps what you want is to run a query connected as a user that has privileges on another user. If it is what you want to do you can do it putting the name of the schema in front of the object name.
    for example connected as sys but I want to query
    emp table from scott:
    select * from scott.emp;
    if that is not what you want , reply and explain your
    case again.
    Joel P�rez

  • Sys user unable to do anything

    Hi,
    the setup is oracle 10g running on solaris 10.
    Recently, we faced a issue where no user was able to establish connection to the database, this we found to be due to a parameter processes=150, however even sys user was not able to perform any operations like 'select', 'shutdown of the database', etc etc. Finally i did kill the pmon process and then restarted the db and set processes=200.
    My Query is if there was a better way to handle the above situation, where there sys user can just login, but cannot perform any query/actions.

    the setup is oracle 10g running on solaris 10.
    Recently, we faced a issue where no user was able to establish connection to the database, this we found to be due to a parameter processes=150, however even sys user was not able to perform any operations like 'select', 'shutdown of the database', etc etc. Finally i did kill the pmon process and then restarted the db and set processes=200.
    My Query is if there was a better way to handle the above situation, where there sys user can just login, but cannot perform any query/actions.I think it is possible to start a new session and do such operation using sys user using a BEQUETH session. Login to your host server. Set the oracle_sid and connect as sysdba provided the user through which you logged in should be a member of dba group.
    Regdards.

  • On Enabling TDE Column Encryption for 11g 11.2.0.4 , will SYS user able to decrypt, encrypted column !

    Hi ,
    we are planning to implement Transparent Data Encryption  for 11.2.0.4 11g DB .
    My Query is Whether SYS  DB user will be able to Decrypt all encrypted Columns.
    we have tested for Virtual Private Database Policy, and found out that it applies Policy for all DB Users except SYS.
    so now we have a query whether encryption will be applied for all DB users except for SYS.?
    regards
    Abdulrahman
    (P.S: attached is document how we tested for Virtual Private Database , if we can somehow disable SYS access to specific tables also our compliance requirement will be met  thanks )

    http://docs.oracle.com/cd/E11882_01/network.112/e40393/asotrans.htm#ASOAG600
    "Transparent Data Encryption(TDE) enables you to encrypt sensitive data, such as credit card numbers, stored in tables and tablespaces. Encrypted data is transparently decrypted for a database user or application that has access to data. TDE helps protect data stored on media in the event that the storage media or data file gets stolen."
    TDE encrypts data blocks.
    Users are not aware that the objects they query are encrypted - this is the reason it is called 'transparent'.

  • Security about SYSTEM and SYS users

    Guys,
    Just curiosity,
    1) What happens if I logged with a user that have DBA role or DROP USER privilege and to drop the SYSTEM or SYS user ? This is possible ? If yes, how can protect them ?
    2) I know that the SYS is owner of the dictionary and catalog, but what is the objective of the SYSTEM user to exists ?
    Tank you.

    Hi,
    As you say, SYS is the owner of the database and the owner of the data dictionary.
    But SYS has the SYSDBA privilege which SYSTEM doesn't. This makes it possible for SYS to become a very very powerful user. In addition, never ever create objects in the SYS schema. SYSTEM is a privileged administration user, and typically owns Oracle provided tables other than the dictionary.
    Making a test.
    oracle@linux:~> sqlplus
    SQL*Plus: Release 9.2.0.4.0 - Production on Thu Dec 7 08:55:51 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Enter user-name: / as sysdba
    Connected to an idle instance.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 126948772 bytes
    Fixed Size 452004 bytes
    Variable Size 104857600 bytes
    Database Buffers 20971520 bytes
    Redo Buffers 667648 bytes
    Database mounted.
    Database opened.
    As Frederic showed
    SQL> drop user sys cascade;
    drop user sys cascade
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL> drop user system cascade;
    User dropped.
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup
    ORACLE instance started.
    Total System Global Area 126948772 bytes
    Fixed Size 452004 bytes
    Variable Size 104857600 bytes
    Database Buffers 20971520 bytes
    Redo Buffers 667648 bytes
    Database mounted.
    Database opened.
    SQL>
    If you like to protect it, you can do this below:
    eg:
    create table secured_objects(object_name varchar2(30));
    Table created.
    SQL> insert into secured_objects values ('SYSTEM');
    1 row created.
    SQL> select * from secured_objects;
    OBJECT_NAME
    SYSTEM
    1 rows selected.
    create or replace trigger check_beforedrop
    before drop on database
    declare
    oname char(30);
    begin
    select object_name into oname from secured_objects
    where upper(object_name)=ora_dict_obj_name;
    if sql%found then
    RAISE_APPLICATION_ERROR(-20001,'You have not permission to drop this object.');
    end if;
    exception
    when no_data_found
    then dbms_output.put_line('This object was dropped.');
    end;
    SQL> drop user system cascade;
    drop user system
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20001: You have not permission to drop this object.
    ORA-06512: at line 7
    Reference: http://www.adp-gmbh.ch/ora/misc/sys_system_internal.html
    Cheers

  • Reg: Error while connecting to a remote database as SYS user.

    Hello all,
    When i try to connect to a database as SYS user i'm getting the error as
    ora-01017 invalid username/password logon denied
    But it is logging from the local system where the oracle is installed.
    I created the password file and checked the contents in v$pwfile_users.
    The result is " no rows selected".
    so when i try to grant sysdba to sys user
    grant sysdba to sys;
    i'm getting error as,
    ORA-01994: GRANT failed: password file missing or disabled
    Please help me in resolving this.
    Regards,
    Konda

    I created the passwordfile using the command below,
    orapwd.exe file=E:\app\Administrator\product\11.2.0\dbhome_1\database\PWDfile.ora force=y entries=30 password=<sys_password>
    is this okay...??

  • Error in renaming the table from SYS user

    Hi
    I am in Schema by name jc
    and I have a table by name tab1
    now i logged as sys user
    then I give a command
    rename jc.tab1 to tab2 ;
    getting the following error
    rename jc.tab1 to tab2
    ERROR at line 1:
    ORA-01765: specifying table's owner name is not allowed
    Query is
    Is it notpossible to rename a table of other schema by logging as sys user ?
    is there any other alternate method of doing so??
    Thanks and Regards
    JC

    Sorry Guido,
    I have not stolen anything from anywhere :)
    All are mine ...I have created some normal users and some users with DBA privileges....
    I use this schemas for testing purpose....
    Also if I give command like from SYS user
    Alter table jc.tab1 rename to tab2 ;
    It will create tab2 in jc schema only and not in SYS schema.
    So there is no question of poluting the SYS schema.
    Also whatever I ask in this forum is a part of my application related,
    I never give the entire program, which may be useless for others and time taking in understanding.
    I just simulate whatever I require in as simplae format as I can
    The person who is very perfect in this forumn can find such queries rubbish. But in learning process no question is rubbish, but there can be a rubbish answer to every intelligent question too... :)
    Regards
    JC

  • Sql developer 1.2.1  failed sys user login

    Setting up a connection with the sys user in sql developer connections return invalid username/pw.
    I have the role set to sysdba.
    I can connect as non sys users with sql developer.
    I can connect via sqlplus with the sys user and pw.
    What would cause me not to be able to connect with the sys user with sql developer?
    Thanks

    This is the Oracle Designer forum. Not the SQL Developer forum.
    Please repost in the proper forum.

  • Login to SQL Developer as the SYS user for Getting Started tutorial

    I went to try and do the following tutorial to learn about SQL Developer 3.0, but I cannot get started because I'm unable to perform Prerequisite #3.
    How do I "Login to SQL Developer as the SYS user"?
    Dave
    Getting Started with Oracle SQL Developer 3.0
    Prerequisites
    Before starting this tutorial, you should:
    1 .
    Install Oracle SQL Developer 3.0 from OTN. Follow the readme instructions here.
    2 .
    Install Oracle Database 11g with the Sample schema.
    3.
    Unlock the HR user. Login to SQL Developer as the SYS user and execute the following command:
    alter user hr identified by hr account unlock;
    Note: This tutorial is developed using Oracle SQL Developer 3.0.
    4 .
    Download and unzip the files.zip to a local folder on your file system. In this tutorial, we use the C:\sqldev3.0 folder.

    I installed XE. It asked me to set up a username and password during the install.
    How do I login as the SYS user, though?
    There is a Connection Name, Username, and Password field when I try to set up a connection in SQL Developer, and I used the username and password I made during the install. I clicked the Test button to test the connection.
    I see "Status: Failure -Test failed: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER".
    How do I tell SQL Developer "as SYSDBA or SYSOPER"?
    Sorry, this is probably easy, and I'm just clueless about it.

Maybe you are looking for

  • Windows 7 and drivers question

    Like may people I have recently upgraded to Windows 7 64-bit from Vista 32-bit. When installing I used the optional update listed in Windows update?for Sound Blaster drivers, these were installed and the sound is working fine. After a few days gettin

  • New dv6 7014nr runs too loud doing nothing

    I recently purchased a dv6 7014nr a few days ago and have barely done anything on it. However, the fan noise is out of control. I've turned off hp coolsense but there is little difference. I don't even feel any air coming out of the vent on the side,

  • Importing csv with dates

    Hi all, I am importing csv files that contain (among others) two columns with dates into Numbers. The dates are all uniformly formatted by dd.mm.yyyy, which is in Germany the usual date format. However, the import changes them into numbers, e.g. 26.1

  • Images are not loading when composing and saving to drafts

    When I compose and add images and save to drafts. They are not loading to my drafts folder. It is just an empty square.

  • Worst service I've ever dealt with

    I ordered a msi gs70 stealth pro on July 1st eta was July 10th. I happen to receive a text saying my order was canceled on the 6th so I called customer service. I spoke to a lady who kept attempting to convince me that I canceled my order. Refusing t