TRIGGERS TO AUTOMATE THE REVOKE COMMAND

Hello

I want to write a trigger that helps REVOKE privileges for objects that have been ABANDONED.

We have several privileges assigned to a role, for example:

GRANT SELECT, INSERT, UPDATE, DELETE ON EXAMPLE_TBL TO OPERATOR_ROLE;

Well, the main problem is that when we drop a table, this disappears from the name column of the OBJECT privilege to objects to the ROLE, instead of this name (EXAMPLE_TBL) is displayed something like 'BIN '. »

This last name can be the link with the old, DBA_RECYCLEBIN research:

SELECT OBJECT_NAME FROM DBA_RECYCLEBIN WHERE OWNER = 'USER' AND ORIGINAL_NAME = "EXAMPLE_TBL";

So, how can I put them together? I want to run the REVOKE command AFTER a drop table occurs.


Bq. {color: #008080} CREATE OR REPLACE TRIGGER SUSCRI. DO_REVOKE {color} \ {color: #008080}------AFTER DROP ON SUSCRI. SCHEMA {color}-{color: #008080}-DECLARE {color}-{color: #008080}------ORIG_NAME VARCHAR2 (255); {color} \ {color: #008080}------RCBN_NAME VARCHAR2 (255); {color} \ {color: #008080}------L_STR VARCHAR2 (255); {color} \ {color: #008080}------L_JOB NUMBER; {color} \ {color: #008080}------BEGIN {color}-{color: #008080}------ORIG_NAME: = ORA_DICT_OBJ_NAME; {color}-{color: #008080}------IF (ORA_DICT_OBJ_TYPE = 'TABLE') {color}-{color: #008080}------THEN {color}-{color: #008080}------L_STR: = ' EXECUTE IMMEDIATE ' SELECT ORIG_NAME INTO RCBN_NAME DBA_RECYCLEBIN WHERE OWNER =, SUSCRI, AND ORIGINAL_NAME =,' | ORIG_NAME |', '; '; {color} \ {color: #008080}------DBMS_JOB. SUBMIT (L_JOB, REPLACE (REPLACE (L_STR,'"'," ' "), ',' ','" ');) {color} \ {color: #008080} \ L_STR: = ' EXECUTE IMMEDIATE ' REVOKE SELECT, INSERT, UPDATE, DELETE ON ' | RCBN_NAME | "OF SUSCRI_OPERATOR_ROLE." '; {color} \ {color: #008080}------DBMS_JOB. SUBMIT (L_JOB, REPLACE (L_STR,'"'," ' ")); {color} \ {color: #008080}------END IF; {color} \ {color: #008080}------END; {color} \ {color: #008080} \ / {color}




Any ideas? Thanks in advance!

Published by: AntonioJose.Moran on November 28, 2008 04:00

Seems to be a bit complicated. These BIN... tables are table in the Recycle Bin, from 10g a command 'drop table' move the table into the garbage, it does not go down irrevocably. To avoid this problem "drop table... purge" and your subsidies disappear.
But that recycle bin feature doesn't is not if badly, you easily get a table dumped by mistake.

Werner

Tags: Database

Similar Questions

  • Path to script and automate the vmkfstools command?

    Very long story short, running vSphere 5, I need a way to execute the command 'vmkfstools y 60' against my stores of data to recover free space on my table of Compellent SAN.

    This article explains the command and the object: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US & cmd = displayKC & externalId = 2014849

    From one or more hosts, I so need to go into each VMFS data store and run the command "vmkfstools y XX" to reclaim space. Otherwise the Compellent table see SVMotion jobs and snapshots as "new entries" and never release the free space.

    To automate this, I would use PowerCLI and maybe just run the script as a scheduled my vSphere Server task.

    I understand also the VMA device can do this kind of stuff, but I don't understand how to automate/schedule tasks with it more I prefer using PowerCLI.

    Anyway, sorry for the question noob and thanks in advance. Any help is very appreciated!

    The problem is we use thin Volumes put into service on a Board of 3par, with T10 off Unmap (which is now the default) freeing up space by deleting a virtual machine or by a storage vmotion means space gets released to the VMWare/data store layer and can be reused by Vpshere but he is not recovered at the Array level , delivering a vmkfstools, writes a file in the data store removes it returns T10Unmap to the matrix, the 3par then and returns this space to the free pool. It works when we manually we just want until VMWare decide UNMAP turn automate it.

    Brett

  • How to automate the SSH connection/commands on a series of switches PowerConnect 3400 3500 and 6200 series.

    I'm trying to find a way to automate the commands to send a series of switches (about 20) showing some configs and save the output to a file. The way I was trying to do was using plink and creation of a batch of files for her.

    Essentially, it would be something similar to the following.

    ECHO

    for /f % in (devices.txt) plink % l word of PAST of USERNAME-pw-v - m C:\Batch\commands.txt > output.txt

    To split the above command, looking for my ips in the devices.txt and made a "plink pw - username PASSWORD - v IP-l m - COMMANDS > OUTPUT" for each. The problem, I'm running is that the switches do not accept logins, they constantly ask for the user and the password again. Even when you try to put them in the commands.txt he will not accept the entry. I googled using plink with dell switches but there is nothing to talk about this problem.

    So my question is, is it possible to automate this sort of thing in a batch file? Or some way to automate a series of commands to a switch via SSH? I'm just not wan't do manually connect to each of them, carry out my orders, out, reconnect and repeat. I did it on cisco switches so I thought the process would be similar but I don't understand what obstacle I'm running in here. Ideally, I'd like to see how to do this via SSH but at this point, I am ready to accept almost any alternative (secure) to automate the sending of orders for my switches.

    I hope that all makes sense.

    Sorry, I haven't used before plink, so I'm not sure what to change to get this to work. In the past, there was another Member of the community who has been able to use expect to establish connections to switches and save configs.

    Linux.Die.net/.../expect

    It may be somewhat more than installation, but you can be able to make it work for your needs.

    http://Dell.to/1RONL3D

    Let us know

  • Automatic execution of commands in the batch file

    When the batch file containing the following commands is executed, orders of the line 1, 2, and 3 are executed, but the 'TIME' command is executed after that I closed the "EXCEL." I want the command 'TIME' to be run automatically without needing to close the 'EXCEL '. Could you please suggest a way to do it.

    CLS

    TASKKILL /IM "" EXCEL. "." "EXE" / F

    C:\PROGRA~1\MICROS~2\Office14\EXCEL. EXE

    TIME

    The code must be in the following form:

    CLS

    TASKKILL /IM "" EXCEL. "." "EXE" / F

    Start/b C:\Progra~1\Micros~2\Office14\EXCEL. EXE

    TIME

  • automate the action for the PDF in the batch command

    Hello

    I would like to completely automate certain actions, I use pdf files.

    So I as Photoshop would treat an action on all of the pdf files in a given folder.

    I know I can using the batch command him.

    Unfortunately, I need to change a setting by opening the pdf file: "Cultures in: Art Box."

    When I automate this openness to an action, the file is already specified, but I always want to open files in my folder.

    I hope that I have noticed my problem.

    How can I open each of the pdf files in a folder bearing ' Crop to: Art Box ', treat my action on each one and then save these files again with a small extension in the file name?

    (In the command batch dialog box, it is easy to change the file name for recording, but I can't manage it in the composition of this specific task :/)

    Thanks in advance

    Alex

    P.S.: I use Photoshop CS 5.5 on Windows.

    Unfortunately, conversion of a file is not the same as opening a file.

    Have you tried processor Image (or Image Processor Pro)?

  • HI - y at - it a command to automate the scroll for a long web page?

    I have a wall of gypsum, and it would be useful to show the info if possible to automate the scroll.

    In fact, someone else is already a: ScrollyFox.

  • Create an executable by mathscript or from the Windows command window

    Hello

    I have a lot of screws that must be built into executables. So, I think to write a script to save time.

    Windows MathScript looks a lot like the command window in MATLAB, so I wonder if there is a way to create executable files using mathscript?

    Or is it possible to build from the windows command window?

    Thanks for your reply and have a nice day.

    Kind regards

    Yan

    You can use the tools in the palette of constructor calls write a LabVIEW program to automate the construction of applications.

    (Somehow I don't understand not what you want. Building is usually negligible compared to write the program or the configuration of the build).

  • RunAs with the /savecred option does not accept the credentials stored by the cmdkey command

    Hello

    I am trying to automate the storage of credentials for profiles of several people on several servers so that they can use it with scripts, they will use that have the command 'runas' with the /savecred option.  I use the command "cmdkey" to store the user and the password, but when the runas command is run, it prompts for the password anyway.  I know that the /savecred works since if I leave the command-line runas for the password and I enter, on subsequent runs, he is more requested for the password.  Curiously, if I use the cmdkey command to replace the stored credentials, runas invite you again the password so it can store it himself.  Almost as runas does not 'trust' cmdkey.  Any thoughts on why this can happen and how can I get around it?  I really need to automate the identification information storing or it will take a couple hundred manual executions of the runas command to get this store on the profiles of all the people in need.

    Hello

    The question you have posted is related to professional level support. Please visit the below mentioned link to find a community that will support what ask you:

    http://social.technet.Microsoft.com/forums/en/category/w7itpro, w8itpro, windowsvistaitpro, windowsxpitpro, windowsintune

  • I can't defragment my hard drive, even though I cancelled the chkdsk command.

    Whenever I have try to defragment my HARD drive, I get the Error Message: Disk Defragmenter has detected that Chkdsk is scheduled to run on this volume (c). Please run Chkdsk/f. I ran, canceled regular for the C: drive, but I still get the same error message whenever I try to run Disk Defragmenter. What else should I do to fix this?

    When you try to defragment a volume of that Disk Defragmenter reports:

    Disk Defragmenter has detected that Chkdsk is scheduled to run on the volume: (c :))
     
    Please run Chkdsk /f.

    This means that the volume that you want to defragment was marked 'dirty' XP.  This is not necessarily all of the data has been lost on the volume, it simply means that XP thinks that the volume should be checked to find errors because of something that happened before.

    You won't be able to defragment the volume until the dirty bit has been removed.

    This does not mean that a disk check is scheduled to run, and you can't cancel what needs to happen in this case because this isn't the problem.

    Also the dirty bit is not set on a volume, you can still run a disk defrag with a record of date of arrival in the meantime (try).

    Entry of commands to reset or erase a disc awaiting review is therefore a waste of time - that is not the problem.

    A volume can be marked as dirty, if the system underwent a power interruption (power failure, pulling plug, removing the battery, button / stop), abandoned restart or an abnormal termination.  One of these events?

    When XP starts, it automatically checks the bit of impurity on each volume.  You can also tell XP to ignore the bit of impurity on any volume, but this probably isn't a good idea in case there is a real problem that needs to be fixed.  If you have a hard drive where the dirty bit will not disappear, you can tell XP not to check.

    If the starting XP detects that the volume is dirty, it will be automatically run the check disk with error correction (chkdsk/r) and try to fix the problems detected.

    If the chkdsk command succeeds, it clears the dirty bit, and then you can defragment the volume.

    You can check the status of your bit of impurity from a command prompt window.

    To do this, click Start, run and enter in the box:

    cmd

    Click OK to open a command prompt window.

    For example, to query the bit of impurity on drive C, type:

    fsutil dirty query C:

    The sample output:
    Volume c is dirty
    Volume C: is dirty

    Is the volume of your sale or it is not dirty?

    You cannot use fsutil or chkntfs from a command prompt to delete the bit of impurity on a volume.

    The only thing that can clear the bit of impurity on a volume is chkdsk /r (or chkdsk/p).  You could tell XP not to check the bit of impurity on a volume where the dirty bit does not erase, but this probably isn't a good idea since there is some sort of problem on the volume.

    You also won't solve this problem by editing your registry database - not where is the problem.

    Once a volume is marked as dirty, the only way to clear the dirty bit is to run "chkdsk/r" or "chkdsk/p" when the volume is not in use.  The only way a volume can not be used while XP is just starting to load or from the XP Recovery Console.

    If XP will not run chkdsk correctly when your system restarts or the dirty bit will not erase as it should, you need to look in the Event Viewer log chkdsk and see what is happening and fix it.

    If XP will not always clear the dirty bit, you need to run chkdsk/r of the XP Recovery Console so you can look and see what works and run it again until it works.

    If you need help in doing this, I'm sure a technical support engineer can tell you how, and if not, I'll give you instructions.

  • automate the backup of the computer while limiting the space used

    Hello
    I would like to help by using the Task Scheduler to automate a "computer backup."  I also use the "back up files" to back up my data files.  I want to use the same destination for two backups drive, but must limit the space used for each utility half the destination drive.  for example, I have a 150 GB C: drive.  the backup destination, F: drive is 500 GB.  I would use 250 for backup of the computer and 250 GB for backup of files.  is there a command in Task Scheduler that will automate the backup of the computer while minimizing space used for 250 GB?  Thank you!

    moved the post to the backup – Windows and Windows Server forum: http://social.technet.microsoft.com/Forums/en-US/windowsbackup/thread/bbacc0df-3964-40ae-bf98-a3fe2c36314c

  • Automate the backup of Config

    I'm looking to install a way to backup the configuration of my C370.  Currently, I know how to do it manually via the GUI.  Is it possible to automate this process and it backs up through the CLI?  I was searching through the CLI yesterday, but I couldn't find what would save the config on the command.  I guess if I could find the command that I could set up a job through our Kiwi CatTools to do.  I would like to know if anyone knows how to do this, or if you have found another way to do this effectively.

    Thank you

    Mike

    Hi Mike,.

    There are actually two ways to do this.

    You can save the configuration of the CLI by using the saveconfig command. You can load a configuration file using the loadconfig command. I would like to run these commands first, just so that you can see the process. Basically, you can script something around these commands that could do the job.

    We also have a section of Nice knowledge base that covers this topic as well. The approach is a little differnet but the results are the same.

    How can I schedule or automate the backup of the file of configuration XML from my device?  Where he lives?  How to do a scheduled backup of the configuration of a Windows system file?

    Environment:

    -ESA with AsyncOS 6.x or later.
    -A designated host for the introduction and the storage of backups.

    NOTES:

    Familiarity with the BONES of script and forecasts of the tasks is necessary to understand and implement these tasks safely.  Please understand that many of these concepts are beyond the scope of the IronPort customer support and these sample scripts are certainly not taken in charge.  Although these steps have been successfully tested, this article is mainly for purposes of demonstration and illustration.

    The configuration file dynamically generated during the use of the recording or email of the CLI or GUI configuration tools.  To have an effective backup, it is best to "unmask" passwords, which allows you to place a ground form of passwords for local administrative accounts in the device configuration file.  For this reason, we can not simply copy a flat file "running Setup" of the device.  This method allows us to access the device first, issue a command to dynamically build the current configuration, and either save or mail a copy of this file somewhere remotely, without any intervention from the user.  Once this is done, we can then repeat or schedule this task to occur on a regular basis.

    Quickly and automatically save the configuration with the passwords exposed files:

    (1) generate a SSH key pair to use.  Verify that you can access your device via SSH without having to enter a password.  Details on this operation is provided in article #283.

    (2) create script to connect to the device, save the config and copy (or by mail).  Two simple examples written in BASH:

    Example #1: Saving the configuration to a specific host
    #! / bin/bash
    # This saves the config and then he copies locally via SCP in a directory called backup/config-ironport
    HOSTNAME = test.com
    USER name = admin
    FILENAME = "ssh $USERNAME@$HOSTNAME "saveconfig Yes"|" grep xml | cut f 3 - d "" ' "
    SCP $USERNAME@$HOSTNAME:./configuration/$FILENAME./ironport/config-backups /.

    Example #2: Emailing an email address configuration
    #! / bin/bash
    # This sends the config to MAILDEST
    HOSTNAME = MX.test.com
    USER name = admin
    [email protected] / * /.
    SSH $USERNAME@$HOSTNAME 'mailconfig $MAILDEST Yes.

    NOTE: this similar logic can be applied in any scripting language OS such as VB scripts or batch for Windows.  These scripts are intended as examples only rudimentary.

    (3) use cron or or scheduling tool to start work on a regular basis.  Services like cron or Task Scheduler in Windows are easy tools that can be used to automate simple jobs like that.  For example, the * NIX CRON configuration file follows this format:

    minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), day of the week (0-6, 0 = Sunday), command

    So a good example to run this script every day at 02:00 would look like:
    00 02 * /location/your_script.sh

    Otherwise, here is another method to automate a backup of the configuration.

    How to do a scheduled backup of the configuration of a Windows system file?

    With the following procedure, you can save the configuration on a regular basis of a Windows system file.

    1 install the emulator of terminal 'PuTTY' under C:\

    2. create a text file with the following line and name it "send_config.txt" and place it under C:\ (Change of [email protected] / * / to the email address you want the configuration file must be sent to)

    mailconfig [email protected] / * /.
    3. create a text file with the following lines and name it "send_config_batch.bat" and place it under C:\
    (Change the "hostname" for the host name can be resolved or IP address of your device and the "password" to your real password for the admin account).

    C:\putty.exe-SSH hostname-l - pw admin and password C:\send_config.txt m
    output

    4. Add "send_config_batch.bat" to the scheduled task window.

    The Configuration file will be sent to the address specified in the "send_config.txt".

    I hope this helps!

    Christopher C Smith

    CSE
    Cisco IronPort customer

  • How to use the chkdsk command in windows 7 its not working not not his poster error access denied

    Please help me about the chkdsk command to remove the windows command prompt 7...

    If you try to use chkdsk for C:\ partition, you cannot run that the disc must be disassembled for the operation, which is not possible with the C:\ partition (or the partition where Windows is installed).

    Instead, go on-> do work right click on the partition-> click Properties-> in the Properties dialog box, go to the Tools tab-> under error-checking, click check now... This will automatically set a check the next time you start Windows.
  • 11.1.2.3.00 recommended to automate the Migration of production to Test

    Hi all.

    I would like to migrate the following items of Prod to Test and want to automate completely.

    Shared services

    Manager of Calc

    Planning

    Essbase

    HFM

    EPMA

    Can anyone provide a high level of how they would be fully automate all of these objects, including the automation of deployment of applications of EPMA and in what order?

    In addition, guidance on what to monitor (i.e. the issues or security) will be greatly appreciated.

    The recommended route is to use LCM which has a command line utility, so can be automated, LCM also has the ability to export/import all objects by using a utility.

    EPMA also offers a command line utility, so you can automate the deployment.

    HFM, you can use the utility to copy app.

    The problem you face is that LCM don't really remove it from target to make it work much better when it's a clean environment if you want to source and target to match.

    See you soon

    John

  • Automate the approval process in creative cloud Portal

    Heyho dear community,

    I was wondering if there is a method to "talk" on the portal of creative cloud programmatically, as the way that you can do with Microsoft Office 365 portal. I want to automate the process 'Install the software license - guest User - order' and to implement as part of our services. We use SCCM to deploy the software, and licenses are purchased from a retailer. But there is a way to order a new license directly in the portal and set it to a user, without having completed the process of order (on the site of the dealer).

    Long story short: I got the idea to write a script that runs when the dealer sent an email as "license ordered" and creates then the license in the portal prompts the user and triggers an another script that does some "things SCCM. So far, I wasn't able to find documentations that would build this scenario... Does anyone of you have experience in the automation of processes related to the creative cloud and can share his knowledge to me?

    Thanks for your help!

    Kind regards

    Christoph L.

    There are features to automate adding, deleting and editing rights for the Enterprise Dashboard.

    See User Management API

  • Do not lock - automate the deletion of backups RMAN old day after a success

    Hi all

    Admin: Do not lock this thread. I moved here the database instance based on the suggestion of another Member, and the question to this forum. If you want to lock a thread, lock one in the forum of the database, not this one.

    I am looking for a way to automate the deletion of backups RMAN old days only after the occurrence of a success. At the present time, I have daily backups of L0 via crontab, and I need to create a script that can tell if a successful backup is done, then delete the old L0 if it has. Any suggestions on how to start? I'm stuck in code to see if a successful backup has been performed.

    Oracle 11.2.0.3

    Exadata (4 nodes)

    Linux 5.10

    * a from database forum

    A backup is completed when the backup command is complete.

    You have two 'blocks execution' in your rman script.

    Put the DELETE OBSOLETE between the end of the last execution block and EXIT:

    OUTPUT CHANNEL fs1b;
    OUTPUT CHANNEL fs2b;
    OUTPUT CHANNEL fs3b;
    CHANNEL fs4b;
    CHANNEL fs5b;
    CHANNEL fs6b;
    CHANNEL fs7b;
    CHANNEL fs8b;

    }

    remove the backup noprompt obsolete;
    "exit";

    You also want to do some other household:

    cross-checking of backup;

    delete expired backup noprompt.

    overlap archivelog all;

    delete noprompt expired archivelog all;

Maybe you are looking for