How to determine the owner of the current package ?

From a package (that is defined with invoker's rights: AUTHID CURRENT_USER) I want to determine the owner of that package. (We plan to deploy the same code into multiple schemas.)
One approach would be to parse the results of DBMS_UTILITY.format_call_stack . . . any other ideas?
Thanks,
Mike

mtefft wrote:
We are using Total Recall aka Flashback Data Archive.
If you have a Flashback Data Archive on a table, you can not drop it without removing the archive, and to do that you need ADMINISTER FLASHBACK ARCHIVE privilege. We want to give users the ability to remove the flashback archive (this is an ALTER TABLE) from their own tables without granting that privilege.
So, we have a utilty schema which has this privilege. We created a definer-rights package to issue the alter, but it does not have ALTER ANY TABLE privilege. So, we added an invoker-rights package that the table-owner can call. This first issues GRANT ALTER ON [input-table-name] TO itself, then calls the definer-rights package, which now has both the system privilege and the object privilege needed. Why not just create a procedure owned by an "admin" user that does the alter table and grant execute on the proc to the utility schema ?
As an example with scott and sys (using sys in a real-world system would be a Bad Idea© but I'm on a playground database on my laptop) :
As Scott :Scott@my11g SQL>!cat createTable.sql
create table mytable (
id integer,
val varchar2(30),
constraint mytable_pk primary key(id)
Scott@my11g SQL>@createTable
Table created.As admin user :Sys@my11g SQL>!cat startFlashback.sql
alter table scott.mytable flashback archive fl_archive;
Sys@my11g SQL>alter table scott.mytable flashback archive fl_archive;
Table altered.
Sys@my11g SQL>select * from dba_flashback_archive_tables;
TABLE_NAME                     OWNER_NAME                     FLASHBACK_ARCHIVE_NAME
ARCHIVE_TABLE_NAME                                    STATUS
MYTABLE                        SCOTT                          FL_ARCHIVE
SYS_FBA_HIST_79498                                    ENABLEDAs admin user, I create the procedure and grant execute to scott :Sys@my11g SQL>!cat createProc.sql
create or replace procedure remove_flarch(
p_tabname varchar2
is
l_strcmd varchar2(200);
begin
for cur in (
select owner, table_name from dba_tables where owner=user and table_name=upper(p_tabname)
) loop
l_strcmd := 'alter table '||cur.owner||'.'||cur.table_name||' no flashback archive' ;
execute immediate l_strcmd ;
end loop;
end;
sho err
grant execute on remove_flarch to scott;
Sys@my11g SQL>@createProc.sql
Procedure created.
No errors.
Grant succeeded.As Scott I cannot disable the flashback archive explicitly :Scott@my11g SQL>alter table mytable no flashback archive ;
alter table mytable no flashback archive
ERROR at line 1:
ORA-55620: No privilege to use Flashback ArchiveBut I can do it using the procedure :Scott@my11g SQL>begin
  2  sys.remove_flarch('MYTABLE');
  3  end;
  4  /
PL/SQL procedure successfully completed.Checking from admin point of view :Sys@my11g SQL>select * from dba_flashback_archive_tables;
no rows selected
mtefft wrote:All is well, except for the fact that we want to deploy this under multiple schemas. So we need to know 'to whom should the ALTER TABLE grant be given?'Just grant execute on the procedure to your different users.

Similar Messages

  • How do you change the name of the owner on the I Pad

    How do you change the name of the owner on the I Pad?

    plug it into itunes and click on the ipad s name 3 times and then you can change the name to whatever youn like

  • Iphone 4s - how do I change the name in the contacts for the owner of the phone - it is coming up as the other person who uses the laptop - so when ringing or texting anyone 2 names are being used as the caller id on the screen

    Iphone 4s - how do I change the name in the contacts for the owner of the phone - it is coming up as the other person who uses the laptop - so when ringing or texting anyone 2 names are being used as the caller id on the screen

    *Ralph Johns* writes:
    "Your options are:
    Get a trial account form @mac which will work as an iChat name after the 60 days run out but not be a email account that is valid (And is free)"
    Do you mean a trial account from .Mac? (DotMac)
    "Get an AIM Screen name and set it to Display what you want as you set it up.
    The Screen name can be whatever yu want but you can also set it to display something else as well."
    I had thought about this, but it seems other people have already chosen the screen name "pinksharkmark" and virtually every variation of it I can think of. So that isn't an option for me. As for getting it to display something else as well, do you mean that if I were to get an AIM screen name like "CromulentCat" I could somehow log in to iChat under the AIM account "CromulentCat" yet get iChat to represent me to my Buddies as "PinkSharkMark"? Because I have to admit I don't see how that can be done. It appears as if iChat displays to anyone chatting with you precisely the account name you logged in under and nothing else. So if you logged in using a .Mac account, then you are displayed as "[email protected]" while if you logged in under an AIM account, you are displayed as "CromulentCat". But that's it that's all... there is no way to change CromulentCat to PinkSharkMark.
    Thanks very much for taking the time to reply, though.

  • HT201441 I bought iPhone 4s device from the owner and the previous owner is not present and the device has already been erased, how can I use this device using my Apple ID and iCloud

    I bought iPhone 4s device from the owner and the previous owner is not present and the device has already been erased, how can I use this device using my Apple ID and iCloud

    Hello adilx
    The only way to get passed that and to use that iPhone is to ask the previous owner to remove it from icloud.com in the Find my iPhone section.
    Find My iPhone Activation Lock: Removing a device from a previous owner’s account
    http://support.apple.com/kb/TS4515
    If the previous owner is not present
    Make sure the device is powered on and connected to a Wi-Fi or cellular network. Then contact the previous owner and ask them to follow these steps to remove the device from their account:
    Sign in to their iCloud account at www.icloud.com/find.
    Click All Devices to open a list of devices linked to their account, then select the device to be removed.
    Click the Erase button to erase all content and settings from the device. When prompted, don't enter a phone number or message. Click Next until the device is erased.
    When the erase is complete, click "Remove from Account" to remove the device from the account.
    After the device is erased and removed from the account, you can proceed with the device setup process.
    Regards,
    -Norm G.

  • I was wondering how i could get in contact with the owner of the Apple company or maybe a developer?

    I need to know how to get in contact with the owner of the Apple store line or the developers of this company

    For what purpose? animal...vegetable...mineral...legal...?
    Are you a developer yourself?
    Apple Developer Relations: 
    (800) 633 2152
    (408) 974 4897
    And see the 'Contact Us' link below.

  • HT3939 how to find the owner of the phone number

    how to find the owner of the phone number
    <Phone Number Edited by Host>

    Look it up on Google. It may or may not work.

  • HT201441 Hello,how can i contact the owner for the stolen iphone using email?because i call the owner no phone,no one accept the call..

    Hello,how can i contact the owner for the stolen iphone using email?because i call the owner no phone,no one accept the call..

    Unless you have the owners email address you can't email them.
    If you have found a stolen iPhone and are trying to return it to its rightful owner, hand it in to the police.

  • How do I Add Owner in the permissions section of a WFA Status?

    How do I Add "Owner" in the permissions section of a WFA Status?

    got it, i couldn't remember the trick to make that screen appear with the selection for author and owner.

  • A way to get the owner of the current procedure

    The user X is the owner of this procedure
    CREATE OR REPLACE PROCEDURE P_REPL
    BEGIN
    DBMS_REFRESH.REFRESH ('X.GROUP1');
    END P_REPL;
    Is there a way so that I would not have to hardcode 'X'. I would like to replace 'X' by the owner of the procedure, so that if the owner change, the procedure would still work.
    USER doesn't work, because if the user Y call this procedure, the value of USER is Y, not X (the owner of the procedure).
    Thanks
    Jérôme

    Apparently a popular question today...
    sys_context('userenv', 'current_user')

  • SCCM 2007 R2- How to identify the owner of the machine in SCCM.

    Hi All,
    Is there a way to know the owner of the machine in SCCM 2007 R2?
    Rgs,

    Hi,
    Who is the owner is really hard as you would have to write that information somewhere when you deploy it or dynamically afterwards if you mean the actual owner of the assett.
    the available options are either the last logon username.
    http://smsug.ca/blogs/garth_jones/archive/2007/06/30/482.aspx
    or the top console user, which is more reliant as last logon could be blank or wrong if for instance a technician logs on.
    http://msitpros.com/?tag=top-console-user
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • Excuse me apple I had the police nock on my door about an iPad that was located at our house and the owner lost the iPad in-between bowral nsw and Sydney can you please fix the app (Find My IPhone)

    Excuse me apple I had the police nock on my door about an iPad that was located at our house and the owner lost the iPad in-between bowral nsw and Sydney can you please fix the app (Find My IPhone) so that person can find their iPad coz the police would of taken mine if I did not show proof of purchase

    You are not communicating with Apple by posting here. Everyone here is just a fellow user and cannot fix anything.
    The Find My iPad service may have indeed been accurate to the limits of the technology. Unless the iPad was a 3G unit, location is determined based on the nearest WiFi router which in your case could just happened to have been yours. The police may be the ones who need to "fix" their understanding of how the technology works and its limitations.
    If you want to provide feedback to Apple on the matter, you can do so via their feedback pages:
    http://www.apple.com/feedback/ipad.html
    but to be of any good you'll have to provide them with more precise details.
    Regards.

  • To Apple Inc. respectable brothers, dear, I've purchased a Yvonne immediately after S Black color I did not know that the owner of the device may do Service i Claude and I've work restor of Yvonne and when activation asked me to calculate i Claude and I d

    To Apple Inc. respectable brothers, dear, I've purchased a Yvonne immediately 4 S Black color I did not know that the owner of the device may do Service icloud and I've work restor of Yvonne and when activation asked me to calculate icloud and I do not know;  I do not know who is the owner of the device with science I bought the machine from Turkey Fargo to help me, I was involved with this device, and I'm from users of the iPhone please help me thank you with the knowledge that Amy device is 013186007698501
    If it is possible to activate the iPhone and that did not help me Fargo just inform me or give me the e-mail which has enabled Claude feature so that I could e-mail correspondence on Arslo Please e-mail me
    For I am God and you will lose device safely God

    Birden konuları gönderme Lütfen dur.
    Buraya git -> https://discussions.apple.com/message/24870284 # 24870284

  • I've purchased a phone Yvonne appeared that the phone was stolen , and you connect with the owner of the phone did not respond to Vkpf you helped me , because I have to pay a sum of money and did not know that the phone was stolen

    I've purchased a phone Yvonne appeared that the phone was stolen , and you connect with the owner of the phone did not respond to Vkpf you helped me , because I have to pay a sum of money and did not know that the phone was stolen

    Return it. If you can't return it, turn it over to the police and consider this a life lesson.

  • What is the procedure to change the owner of the BW jobs.

    Hi Gurus,
    Version- BW 3.5
    I need to change few jobs Owners which are collected from the SM37 from a individual User to generic account(ALEREMOTE).
    Will any body help me out with the procedure to change the owner of the BW jobs.
    Thnaks in advanace..
    With Regards,
    MBS

    in SM37, take all release jobs by giving JOb name as "" and user as "".
    When you get the release job details then follow the steps.
    1. Select theJob --> Menu Bar --> JOB --> Change --> here you will get the details of the job and Clieck on STEP just above the job name.
    In the next screen select the job and click on Change ICON.  here you can see the user name in change mode and you can update the user to ALEREMOTE. And then save the job.
    Once done then the job will be on the new user.
    Hope this helps..

  • In em, OS user credentials gives "The owner of the job is not registered O"

    In em manager, to do a back or recovery, you have to enter an operating system user:
    "To perform recovery, supply operating system login credentials to access the target database"
    For lack of any guidance, i tried the oracle user, which has full access to the oracle directories and is in the DBA group.
    However, em console always gives this:
    ORA-20446: The owner of the job is not registered ORA-06512: at "SYSMAN.MGMT_JOBS", line 168 ORA-06512: at "SYSMAN.MGMT_JOBS", line 86 ORA-06512: at line 1
    Any ideas?
    DB is 11.2.0.1.0, and OS is CentOs 5.5. linux.
    The oracle OS user does not exist in the DB obviously. Ive googled this for hours, and noone seems to have found a solution on Unix (windows users can assign some permission, but linux doesnt have the concept).

    This is an Oracle bug in 11g, there is a fix available, you can use following workaround:
    logon as SYSMAN
    and issue
    execute MGMT_USER.MAKE_EM_USER(‘USERID’);
    What database credentials are you using for this database?
    Regards
    Rob
    http://oemgc.wordpress.com

  • Shouldnt the owner of the directory object be the user who created the directory?

    This is in continuation to my earlier query. I checked the all_directories table. Here it says that the owner of the directory is 'SYS' although I created the directory from 'SCOTT'.
    Is this the reason why the PL/SQL proc trying to load an image cannot access the directory?
    Any clues?

    See my reply to your other question.

Maybe you are looking for

  • Point a logical Port in the backend to XI

    Hi friends, how do i point a logical port in backend to XI,how do i derive the XI url to be pointed. regards kaushik

  • Problem with wget to download oracle

    Hi All, I want to download http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html for my newly purchased linux server, unfortunately i have only ssh putty access to this server, i had already tried a l

  • Comparisons between Pages, Word, Nisus...

    Hi everyone, I am comparing full-featured word processing programs, because I am finally leaving Word. (Word 2008 is unbelievably ugly and badly designed; it's almost as bad as the infamous Word version 6.) I need a full-featured word processor, and

  • FM for presentation server

    Hi Experts, I need a FM which return all the file names in a specified directory of presentation server. I also need FM which will provide F4 help on presentation server to search  directories. Regards, Jeetu

  • How to set a boolean webservice parameter to null

    Hi all, is it possible to set a boolean input parameter of a webservice to null? False and true works well, but is there also the posibility of setting it to null? Greetings Florian