Drop All Objects

Hi
We have a script for dropping all objects in an schema.
We use it on our application schema.
By mistake, I had logged in as SYS user id and ran the script. It generated a file called a1.sql and also ran this script. Realising the mistake, I broke the SQL session and closed the SQL session.
How do I go about correcting the situation.
Has the Database become inconsistent or it it recoverable ?
Apparantely, we do not have a backup of the Database.
Can anyone suggest a method to retrieve ?
Mahadevan

Hi
If you really dropped objects under sys, I will say that your database is corrupted. Therefore it cannot be recovered without a backup.
Chris

Similar Messages

  • Dropping all objects in a user's schema

    Hi,
    I want to drop all the objects in my schema. Now I'm issuing the drop command every time to drop the objects one by one. Is there any way to drop all the objects at one go without dropping the user?
    Thanks,
    Babu

    Hi,
    How about dropping the user (schema) itself and re-creating it. That would gurantee dropping all schema objects.
    One problem is, you have to log in as SYS or SYSTEM or somebody with DBA privilege.
    I would say, before dropping the user, prepare the 'create user' script from TOAD or DBMS_DESCRIBE or using various data dictionary views, so that we have the complete create scripts with all the roles etc etc. Then drop the user and re-create it.
    Cheers

  • Search script generator for all objects and data (!) from a user/schema ?

    Is there a way to create a script which (when run) creates all the existing
    TABLES; INDEXES, KEYS and DATA for a specified user/schema ?
    This (PL-)SQL script should contain all INSERTS for the currently existing rows of
    all the TABLEs.
    When I use e.g. export to Dumpfile I have at first find all TABLEs and components
    which I want to dump. This is rather uncomfortable.
    I just want to specify the user name similar to
    createscript user=karl@XE outfile=D:\mydata\myscript.sql
    Is this somehow possible ?

    So that I understand your requirements exactly, are you asking for your script to ...
    1/ export from database A the entire schema of a specified user
    2/ drop all objects owned by that user in database B
    3/ import the objects from database A into database B
    If so, it sounds to me that a shell script that does a schema level export as Nicholas suggested, and then drops the user from database B using the cascade keyword (e.g. drop user username cascade), recreates the user and then imports the export file into B should do the trick.
    I don't think searching for individual tables and creating the statements to recreate them is the best idea.
    Hope that helps
    Graham

  • How to drop schema objects without dropping user in one pass?

    HI,
    I am after some PL/SQL that can drop all the objects that a user has, without dropping the user himself.
    I can write a query that spool SQL to a script to drop all the appropriate objects, but it has to be run multiple times as some things can not be dropped before other objects which may appear later in the script.
    I want a script that developers can run once to drop all their objects.
    Can anyone point me in the right direction?
    Thanks

    Hi,
    but it has to be run multiple times as some things can not be dropped beforeDid you use cascade constraints ?
    select 'drop '||object_type||' '|| object_name||  DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS;',';')
    from user_objects
    I want a script that developers can run once to drop all their objects.With a PL/SQL, and a loop on user_object.
    But if you drop all objects, why not drop/recreate user ?
    Nicolas.
    Message was edited by:
    N. Gasparotto

  • Undable to drop tablespace ORA-01561: failed to remove all objects in the

    hi,
    i am unable to drop table tablespace how can i do that??
    please advise
    DROP TABLESPACE tbs_tp2 INCLUDING CONTENTS AND datafiles
    ERROR at line 1:
    ORA-01561: failed to remove all objects in the tablespace specified
    Thanks in advance
    siva
    chennai

    Have you tried dropping the objects individually? You can see which objects still belong to this tablespace by using the DBA_SEGMENTS view as shown below:
    SELECT OWNER, SEGMENT_NAME, SEGMENT_TYPE, TABLESPACE_NAME
    FROM DBA_SEGMENTS
    WHERE TABLESPACE_NAME=tbs_tp2;HTH!

  • How to Drop all data in a database?

    Hi There,
    I'm use to dropping all the objects in a database, however, how do I drop ONLY the DATA in the database? Is all data in the database stored in tables? Do I have to TRUNCATE all the tables in the database only? Thanks in advanced.
    J

    You can try to:
    1. disable foreign key constraints instead of dropping them.
    2. truncate all tables in any order
    3. enable foreign key constraints.
    Short example:
    SQL> truncate table parent;
    truncate table parent
    ERROR at line 1:
    ORA-02266: unique/primary keys in table referenced by enabled foreign keys
    SQL> select constraint_name, table_name from user_constraints where r_constraint_name is not null;
    CONSTRAINT_NAME                TABLE_NAME
    SYS_C0011060                   CHILD
    JHIST_JOB_FK                   JOB_HISTORY
    JHIST_EMP_FK                   JOB_HISTORY
    JHIST_DEPT_FK                  JOB_HISTORY
    EMP_DEPT_FK                    EMPLOYEES
    EMP_JOB_FK                     EMPLOYEES
    EMP_MANAGER_FK                 EMPLOYEES
    DEPT_LOC_FK                    DEPARTMENTS
    DEPT_MGR_FK                    DEPARTMENTS
    LOC_C_ID_FK                    LOCATIONS
    COUNTR_REG_FK                  COUNTRIES
    11 rows selected.
    SQL> alter table child disable constraint sys_c0011060;
    Table altered.
    SQL> truncate table parent;
    Table truncated.
    SQL> truncate table child;
    Table truncated.
    SQL> alter table child enable constraint sys_c0011060;
    Table altered.
    SQL>

  • Extract DDL for all objects separately !

    Hi All
    I have a huge DB having 3000 tables (having indexes,triggers,synonym), 1200 functions/procedures, 1000 views etc.
    I need to extract only metadata and put into a version control repository.
    I need to extract all objects (tables,procs,functions,views) in separate files, with the grants for each procs/func/table/view in the respective procs/func/table/view file only.
    Indexes should be in respective table file only. Each object (procs/func/table/view etc) should have DROP command in the beginning.
    I tried sql developer, but it gives separate files for grants,indexes,triggers,drops etc and also gives option to generate one script for all tables, one for all views, one for all indexes and so on, so doesn't satisfy my requirement.
    Please suggest me a good tool (preferably FREE one) to extract the metadata in said fashion.
    Thanks.

    AnkitV wrote:
    Hi All
    I have a huge DB having 3000 tables (having indexes,triggers,synonym), 1200 functions/procedures, 1000 views etc.
    I need to extract only metadata and put into a version control repository.
    I need to extract all objects (tables,procs,functions,views) in separate files, with the grants for each procs/func/table/view in the respective procs/func/table/view file only.
    Indexes should be in respective table file only. Each object (procs/func/table/view etc) should have DROP command in the beginning.The hard part is the requirement of separating the items into different files.
    sb2075's answers are your best option. Write a PL/SQL script on the server to use DBMS_METADATA.GET_DDL or whatevever equivalent extraction routine will work for you. Loop through the objects you need from the data dictionary and writing the data using UTL_FILE. The simplified logic should look something like
    foreach table
      get the ddl
      generate filename
      open file
      write ddl
      close file>
    I tried sql developer, but it gives separate files for grants,indexes,triggers,drops etc and also gives option to generate one script for all tables, one for all views, one for all indexes and so on, so doesn't satisfy my requirement.You don't want to manually use SQL*Developer to do 3000 extractions anyways. The script should do it all for you.

  • Dropping all deployed tables in OWB 10.2.0.3.0

    I am running OWB 10.2.0.3.0 and have multiple schemas containing deployed tables. This is a test instance and I would like to drop all the old tables and recapture some of the space. Is WB_RT_VERSION_FLAG the only table I need to keep intact to keep OWB functioning? Should I also leave CREATE$JAVA$LOB$TABLE and TRACE if it exists? Thanks.

    Hi,
    you must keep WB_RT_VERSION_FLAG, all the synonyms (created by owb) and the roles of a target user. All other objects may be dropped.
    You should consider dropping the objects using control center manager (use context menu on the module an set the action to drop for all objects at once) in order to have the deployment status correctly.
    Regards,
    Carsten.

  • Changing the Owner of all Objects in Instance ?

    How to Change the Owner of all Objects in Instance, like for example the Procedure: sp_changedbowner in an MS-SQL-Database, who changed the Owner of the actual Database !
    I'am looking for another possibility to do it by export the Datbase and import as new Owner !

    Hi Laurent Schneider
    OCM DBA, I successfully run:
    connect SYS/&2 as SYSDBA;
    Update sys.obj$ set owner#=(Select USER# from sys.user$ where NAME = '&4')
    where owner#=(Select USER# from sys.user$ where NAME = '&3');
    commit;
    Afterwards I dropped the &3 User CASCADE and then created the &3 User with less rights ! Before Update-Command the &4 User shouldn't be the Owner of any Object ! At Last I'm not sure that is the right way ?!

  • IMPDP question -- Replace all objects

    Question
    I have a situation where I would like to use Data Pump to refresh a test database schema weekly from our production instance schema. I would like to set up a job to do this with data pump. I can use data pump (impdp) with success using the network_link with no issue. My question is does anyone know if there is a way (or can recommend a way) to update all schema objects in this refresh job? For example, I want to bring over all tables, data, sequences, plsql, etc. The impdp command allows for TABLE_EXISTS_ACTION=REPLACE to replace existing tables/data, is there a similar commadn so I can do this for specifically sequences, etc? Is there a replace command for other objects types when using impdp? If not anyone have any ideas how I can easily do this?
    I know I could write a sql script to drop and recreate all, but then I run into the problem of having to regrant privileges to sequences, synonyms, plsql, etc.
    Looking for ideas.
    Thanks.

    - Is TEST always the exact same schema (DDL) as PROD?YES, or should I say it better be as I do not typically allow for direct changes to be made to production without running through test. Although if we are refreshing test from production, any DDL changes would eventually be updated in test from their values in prod anyway.
    - Have you considered using replication or CTAS instead?Replication, YES, but there is a lot of overhead for something I don't think warrants it. CTAS would work, but drop and recreating is slower than IMPDP.
    Just the data & PL/SQL, no DDL?I suppose DDL would also need to be refreshed.
    There is IGNORE=N, which forces you to pre-drop the tables in TEST, thereby guaranteeing freshness.Does this option drop the objects or does it just err out and require that you pre-drop them by some other means. I suppose it is the latter..
    Because IMPDP is good at brining privileges over. I am considering the following.
    1. Connect to TEST, drop user XYZ cascade;
    2. impdp command using network_link option.
    Does doing this miss something?
    I agree that impdp log file will have to be interrogated for errors.
    Let me know.
    Thanks.

  • Scrip to drop all users

    Hi,
    I want to kill all the sessions connected to the database. And I want to put it on a script so I can run it at night and drop the user and import the schema .
    Thanks

    another option is not to drop the user.
    if the user you will import has same name and password, you may drop just all objects of the user: tables, views, procs....
    you can generate the 'drop objects ' script with sql
    select 'drop '||object_type||' MYUSER."'||object_name||';' from dba_objects where owner='MYUSER'
    and object_type not in ('PACKAGE BODY','INDEX');
    {code}
    something like that...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Determine all objects that a group has been assigned to

    I am trying to determine all objects that a group has been assigned to. For example, I would like to know what communities and portletes a group has been assigned to.
    I can retrieve the information directly from the plumtree database, however, I have not been able to determine how to accomplish this via the api.
    I have tried the following
    IPTObjectManager ptObjMng = ptSession.GetCommunities();
    for(inti = 0; i<3;i++)
    filter[i] = newObject[1];
    filter[0][0] = PT_PROPIDS.PT_PROPID_USERGROUP_GROUPID;
    filter[1][0] = PT_FILTEROPS.PT_FILTEROP_EQ;
    filter[2][0] = 1634; //group id for my group
    IPTQueryResult ptResult = ptObjMng.Query(PT_PROPIDS.PT_PROPID_ALL,-1,PT_PROPIDS.PT_PROPID_NAME,0,-1,filter);
    I have verified that the group has been assigned to the community, however, this query returns no records.
    How can I retrieve all communities or group that a specific group has been assigned too?
    thanks in advance

    This sure would be a handy feature! iTunes has it so that you can easily tell which playlists a song is in. It would be convenient for iPhoto as well.

  • How to delete all objects in a package?

    Hello,
    I've seen a similar question here. But is there a tool or a smart way to delete all objects in a dev class or a transport request?
    Best Regards
    Volker

    These are really 3 questions??
    1. To delete objects in a request there are a number of ways, here is one:
    Position cursor on modifiable request.
    Double click on request and choose 'Objects' tab
    Choose object line you want to delete and click 'Delete'
    Save your changes.
    2. To delete objects in a Dev Class:
    Go to work bench --> edit object, Class and give your class name, you will see delete option at the bottom of the screen.
    3. How to delete all objects in a package:
    here is a link with the steps you need for this: http://benxbrain.com/en/index.do?onInputProcessing(brai_object_thread)&001_threadid=0000161442&sysid=WP5&pgmid=R3TR&object=DOMA&obj_name=DEVCLASS&child_param=

  • Hello, 2 questionss here is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

    Hello, 2 questionss here>is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

    Hello, 2 questionss here>is it possible or is there a way to convert all object s outlines in all frames to fills at once and not frame by frame? and why sometimes erases the outline instead of converting it to fill?

  • How to select the all object at a time while installing business content

    Hi All,
    how to select the all object at a time while installing business content Please let me know if nay document is there
    Thanks Ahmed Pasha

    Hi,
    Please check out the below links
    [Business content Installation|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/102906a4-f13d-2e10-7199-ce316ff254b8?QuickLink=index&overridelayout=true ]
    [BI Content|http://wiki.sdn.sap.com/wiki/display/BI/InstallingBusinessContent]
    Hope it helps.
    Regards,
    AL

Maybe you are looking for

  • I have a weird thing going on.

    My network preferences show that I'm connected online by ethernet... but I'm not. I'm connected via wifi from a time capsule. But Airport shows red, no connection. I'm sending this over the wifi connection described. Bizzarre. Any thougths? late 2013

  • Navigation Tabs

    Hi all, I am trying to work out how to create navigation tabs using images for the curved sides and backgroundsbut I am getting comfused. I have made three examples: http://www.villa-corti.com/indexnav.html In the first example- navtabs div -I have a

  • Import selection RAW / JPG in Lightroom 3

    Hello, On some assignments I need to quickly upload some photo's in jpg to a client. But for my archive I need the same pictures in RAW. Therefore in those situations I shoot both RAW and JPG on the same CF-card. I am looking for a way to quickly sel

  • Ever recurring syntax errors

    I have a syntax error that keeps recurring. I need help please.

  • Nac Server Errors | Collector Modules in Stalled state

    Hi Everyone, I am facing an issue in Nac Profiler. Please help me on this. All the Collector Modules are in the stalled state. Whenever I restart Collector Modules and also restart Profiler Server through CLI. The Collector Modules and Server comes i