Find out schema

Hi,
I need to find out in DB Package where this Package is installed (in which schema). The problem is this DB Package can be installed in various schemas. This means that I can't use select user from dual or system environment SYS_CONTEXT('USERENV', 'OS_USER').
What I would need is something like $$PLSQL_UNIT
cheers,
Johannes

1008346 wrote:
Hi,
I need to find out in DB Package where this Package is installed (in which schema). The problem is this DB Package can be installed in various schemas. This means that I can't use select user from dual or system environment SYS_CONTEXT('USERENV', 'OS_USER').
What I would need is something like $$PLSQL_UNIT
cheers,
JohannesWell, select user from dual would not work unless it was the owner running the package, but you can certainly use sys_context, just not os_user since it is irrelevant anyway.
SQL> create package my_pack as
  2     procedure p;
  3  end;
  4  /
Package created.
SQL> create package body my_pack as
  2  procedure p is
  3     l_schema varchar2(2000);
  4  begin
  5     l_schema := sys_context('USERENV', 'CURRENT_SCHEMA');
  6     dbms_output.put_line('Current schema is: '||l_schema);
  7
  8     l_schema := sys_context('USERENV', 'SESSION_USER');
  9     dbms_output.put_line('Session user is: '||l_schema);
10  end;
11  end;
12  /
Package body created.
SQL> create user test identified by test;
User created.
SQL> grant create session to test;
Grant succeeded.
SQL> grant execute on my_pack to test;
Grant succeeded.
SQL> connect test/test
Connected.
SQL> set serveroutput on
SQL> exec ops$oracle.my_pack.p;
Current schema is: OPS$ORACLE
Session user is: TESTNote that this assumes that the package is created as the default definers rights.
John

Similar Messages

  • How to find out list of clob/blob tables in a schema

    Hi,
    I have tricky situation...i have 119 tables out of which 11 tables are clob/blob tables...is there any view where i can find out list of tables are clob/blob tables? (at schema level view means user_<>)
    -- Raman.

    USER_TAB_COLS includes the data type, column name, and table name for each column in each table in the system. You could query that looking for columns with a DATA_TYPE of CLOB or BLOB. If some tables have multiple LOB columns and you want them to appear only once, you'd have to throw a DISTINCT on the table name.
    Justin

  • How to find out which schema(time and payroll) is being used for which empl

    Hi,
      Can anyone tell me if there is any way we can find out which schema is relevant for which group of employees, for example in a system which has employees from different countries and for each country there is a diffrerent schema being used ?
    Is there any feature which defaults the schema names according to groups of employees ? If so what is the name of the feature?
    Regards
    QB

    hai
    generally  the schemas are named X000  which stands for common schema  nomination
    x replaced by respective country like for india it is IN00  for US  U000etc
    it is not given according to the group of emplyees but according to the country grouping for your org units
    time schemas are country independent they work for all the countries
    regards
    nalla

  • How do i find out the tables (data)effected in a schema after a particular time stamp

    how do i find out the tables (data not structure)effected in a schema after a particular time stamp?
    pls email in [email protected]

    You can't do that. That would be a real security risc.
    /KAj

  • How do i find out the tables effected in a schema after a particular time stamp

    how do i find out the tables effected in a schema after a particular time stamp?
    pls email in [email protected]

    If you are doing a reload every time then you can issue following commands to clear data from cube.
    lmt name to all
    allstat
    clear all from <cubename>prttopvar
    You can wrap above commands in pl sql procedure using dbms_aw.execute package and execute it before cube load starts. Instead of clearing it from whole cube you can clear only from one partition also. Just take a look at clear command in olap DML 10.2 reference.
    Thanks,
    Brijesh
    Edited by: Brijesh Gaur on Aug 10, 2010 6:47 AM

  • How to find out all the tables in a schema with a particular column

    Hi
    Is there a way to find out all the tables in schema1 that has col1 as one of the columns?

    select table_name from dba_tab_cols where owner='schema' and column_name='col1';

  • Finding out source database & schema

    Hi All ,
    I am logged on to Oracle thru PL/SQL. how can i actually find out which database & schema am i on ?
    appreciate ur advice
    tks & rdgs

    Well, a schema is essentially the set of database objects owned by a user, so in that sense they are identical. However, it is not always the case that because you are logged in as a user that you are actually referring to that user's schema.
    SQL> show user
    USER is "OPS$ORACLE"
    SQL> DESC xx
    ERROR:
    ORA-04043: object xx does not existI have no object named xx, but someone does, and I have at least select privileges on it:
    SQL> DESC finance_o.xx
    Name                                      Null?    Type
    ID                                                 NUMBERso, if I want to work with several objects in the finance_o schema without having to always use owner.name, I can either create a bunch of synonyms, or do:
    SQL> ALTER SESSION SET CURRENT_SCHEMA=finance_o;
    Session altered.
    SQL> desc xx
    Name                                      Null?    Type
    ID                                                 NUMBERNow, any unqualified object names are looked for first in the finance_o schema. I still cannot see any of finance_o's objects that I do not have permissions on.
    John

  • To find out which user is schema

    Hi
    All,
    Do you have any idea to find out which user is schema ? (example : any sql query)
    Thanks,
    Vishal

    It's quite unlikely that I would consider an ID that can not connect as being a user. Therefore:
    Schema has objects
    User has CREATE SESSION priv
    Schema & User has objects & CREATE SESSION priv
    Both take use sys.user$.user# so one could view them as different aspects of the same beast. For DBA_USERS the whole key is from sys.user$.user#, whereas for DBA_OBJECTS the sys.user$.user# is a reference for part of the key.
    A schema is simply a collection of objects with a specific namespace. Oracle, for some reason, decided to make the namespace for schemas match the namespace for userids. (I suspect it was to allow us an opportunity to have this kind of discussion.)
    Howard has a discussion that is far superior to the above. I hope we can cajole him to post it.

  • How to find out object / schema / database level replication is active

    Hi,
    I am an experienced DBA but new to streams and I am asked to support an existing streams configuration between two Oracle 10g databases. I was told it is bi-directional but one database is standby and it never took traffic. My questions are
    1. How will I find out whether it is a database or schema level replication? Any queries that I can run to find it out?
    2. How do I find out it is bi-directional and it iis current. What queries I can run to confirm?
    3. How will I find out the excluded objects? Any queries please...
    Thanks for the help
    Regards
    Rama

    http://www.morganslibrary.org/reference/dyn_perf_view.html#dyst
    SELECT name FROM dba_dependencies
    WHERE referenced_name = 'DBMS_STREAMS_ADM' AND name LIKE 'DBA%'
    UNION
    SELECT referenced_name FROM dba_dependencies
    WHERE name = 'DBMS_STREAMS_ADM' AND referenced_name LIKE 'DBA%';

  • How to find out all users accessing a schema

    Hi,
    How can I find out all the users which has accessed a schema for the last 30 days? Auditing is not enabled in the database.
    DB:10.2.0.4
    OS:AIX

    user13364377 wrote:
    Thanks Antonio.
    Is it possible to find all the users which have access to the schema?Do you mean OS users access .. ?
    Because from v$session we can find users sessions information, if thats what you mean.

  • How to find out which was the last Function Fired in a given schema ..?

    Hi All ,
    Suppose there is a function called track_account (Accnt_id, bank_name ...)
    I have a requirement wherein I need to find out when was the last date when this function was called , by which user and what was the parameter list that was passed .For example i this case - what accountid and bank_name combinations were passed .
    I know the information is stored in one of the V$ tables but am not able to locate the exact table and column that would give me this information .
    Please suggest .
    Edited by: user3481493 on Mar 8, 2010 10:58 PM

    amol_dev wrote:
    Thank you for your reply Brynjar.
    However, I was trying to figure out a way to do this without having to change the calling command line, because due to legacy reasons, it is not possible to change the command line calling the parent applications of this common code.You cannot change the command line, but you can change the applications?
    In main() do this:
    System.setProperty("whoami",(new Throwable().getStackTrace()[0].getClassName()));Elsewhere:
    String whoami = System.getProperty("whoami");

  • Query to find out pertcular schema related datafiles free space????

    hai,
    whats the query to find out free space in datafiles and index files related free space for perticular schmea?
    Regards
    dba

    If you wish to get free space in index tablespace then use following query:
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name
    and a.tablespace_name='INDX';
    and if you get info for all tablespace then :
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name;

  • How to find out the list of users who used Discoverer

    Dear All,
    We have Oracle E-Business Suite 11.5.10.2 with Disco. 4i.
    We need to know how we can find out the Employee ID, Responsibility, Org... who used discoverer during a specific period in the past ? For example the last year.
    Any help plz.
    Regards,
    Mohammad Muhtadi

    I'm not sure You can get the responsibilities or the org that was used in that specific run but as for getting when it was run and by whom...
    Try that SQL:
    select distinct
    qs.qs_doc_name workbook,
    --qs.qs_doc_details worksheet,
    case when instr(qs.qs_doc_owner,'#')=1 then substr(qs.qs_doc_owner,2,10) else qs.qs_doc_owner end workbook_owner,
    qs.qs_created_date run_date,
    case when instr(qs.qs_created_by,'#')=1 then substr(qs.qs_created_by,2,10) else qs.qs_created_by end apps_user_id,
    fu.user_name apps_user_name,
    ppf.FULL_NAME user_full_name,
    ppf.EMPLOYEE_NUMBER user_employee_number
    from
    eul_us.eul4_qpp_stats qs,
    fnd_user fu,
    per_people_f ppf
    where to_number(substr(qs.qs_created_by,2,10))=fu.user_id(+)
    and fu.employee_id=ppf.PERSON_ID
    and sysdate between ppf.EFFECTIVE_START_DATE and ppf.EFFECTIVE_END_DATE
    change the "eul_us" to the discoverer schema.
    Basically the primary data you are looking for lies in the qpp_stats table...

  • How to find out the NULL columns in the table?

    Hi,
    Please provide the query to find the null columns in the table. Here, all rows in the table have same column as null. It won't change.
    Table
    c1 c2 c3 c4
    X C 10
    T D 20
    I wanna find out as C2 is the nullable column.
    Thanks in advance !!
    Regards,
    Vissu....

    Below code might be solution for finding NULL valued in columns in a table and if it is solution .kindly give me points for the same.
    declare
    cursor col_cur is
    select column_name
    from user_tab_cols -- all_tables can also be used in case the table is present in own schema
    where table_name = 'TABLE_NAME'; --provide the TABLE_NAME  
    stmt varchar2(1000):= '';
    v_count number;
    count_null number;
    begin
    execute immediate 'select count(*) from TABLE_NAME' into v_count; --provide the TABLE_NAME  
    for rec in col_cur loop
    execute immediate 'select count(*) from TABLE_NAME' where --provide the TABLE_NAME  
    '||rec.column_name||' IS NULL' into count_null;
    if count_null = v_count then
    stmt :=stmt|| rec.column_name ||chr(13);
    end if;
    end loop;
    dbms_output.put_line(stmt);
    end ;

  • How to find out what user locked account

    We had production type schema account locked this morning. I checked profile which this user belongs and it has 3 times for Failed Login Attempts. My question is how to find out what user had 3 unsuccessful login attempts and lock this account.
    Oracle version 8.1.7

    Assuming that [auditing was enabled|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/security.htm#sthref2916], the command
    AUDIT CONNECT WHENEVER NOT SUCCESSFULThat will write audit records when there is an unsuccessful login. Depending on how you've configured auditing, those records will either be written to the SYS.AUD$ table, in which case you can query them through a few different views, or to a file on the operating system that you can grep.
    Justin

Maybe you are looking for

  • How to "stupidify" UI controls?

    So far the only thing I don't like about JavaFX is how smart UI controls tend to be. Assume your application is based on MVP/MVC architecture. Now, consider UI control like CheckBox. What should cause CheckBox to change its state (checked/unchecked)?

  • Non printing of SAP on HP LaserJet P 1505 printer

    We have purchased a HP LaserJet P 1505 printer (ZHPLJCM1 device type), but nothing is being printed on the paper. No output is generated on the paper. The spool is generated correctly with complete status. Is there any solution by which I can print a

  • Can't start itunes because it gives me a message thta MSVCR80.dll is missing in my computer

    I can't start iTunes because it gives me a message that MSVCR80.dll is missing in my computer

  • Set a container element inside class to exit a loop

    Hi, I want to set a container element inside a class to exit a loop. The element is marked as import/export parameter and the binding from the task to the container exists as well. The loop has a condition  &finish& = X but I cannot exit the loop. Lo

  • Need help with space between bullet and text in list

    I've been trying to increase the space between my bullet and text in my list. Everytime I increase the margin-left or padding everything moves to the right but the space between the bullet and text stays the same. Would someone help me figure out wha