User accidentaly drop a table - no downtime is allowed , what will you do..
hi guys,
i am on oracle 10g. i do not have flashback recovery area. it is disabled.
i have a daily full db backup schedule at 3am daily.
i have a 12am daily logical export as well.
Now assumming on 21th 2am user accidentally drop a table and purge it and the issue was realise only later at 5am.
q1) is it possible to
i) import using the 12am daily export dump file
ii) and perform recovery on that particular table only ? -- which i think not possible...
or should i..
q2) restore the fullbackup on 20th on another server. recover the database until 21th 2am. export the table out.. and import the table in production server (where the table was accidentaly deleted)
however , i might not have aonther server at my expense
what should i do ?!
Rgds,
Noob
Hi,
q1) is it possible to
i) import using the 12am daily export dump file
ii) and perform recovery on that particular table only ? -- which i think not possible...Yes, it is possible, just fetch out only that particular table but not the whole DB.
"i might not have another server at my expense"
- Pavan Kumar N
Oracle 9i/10g - OCP
http://oracleinternals.blogspot.com/
Similar Messages
-
How to find the user who dropped the tables
Hi All,
Some one has dropped 5 tables in the production database that has caused a SEV1 but thankfully we are having those tables in recyclebin and we are restored those with out data loss.
But I want to know who has dropped those tables and want to know who has connected to database at that time. Can you please guide me in this how to find out....
Database version: 11.2.0.2 version
Thanks
Kk
Edited by: 908098 on Jan 18, 2012 4:23 AMOr you can use this kind of audit (i had used this some time ago)
-is pretty detailed but is good for auditing purpuse.
hope this helps
CREATE TABLE AUDITORIA_ESQUEMA (
operation VARCHAR2(30),
os_user VARCHAR2(30),
obj_owner VARCHAR2(30),
object_name VARCHAR2(30),
object_type VARCHAR2(30),
sql_text VARCHAR2(64),
attempt_by VARCHAR2(30),
attempt_dt DATE,
Ip_adress VARCHAR2(15));
CREATE OR REPLACE TRIGGER AUDITORIA_ESQUEMA
BEFORE CREATE OR ALTER OR DROP OR RENAME or alter
ON DATABASE
DECLARE
oper varchar2(200);
sql_text ora_name_list_t;
i PLS_INTEGER;
BEGIN
SELECT ora_sysevent
INTO oper
FROM DUAL;
i := sql_txt(sql_text);
IF oper IN ('CREATE', 'DROP','RENAME','ALTER') THEN
INSERT INTO AUDITORIA_ESQUEMA
SELECT ora_sysevent,(select sys_context('USERENV','OS_USER') from dual)
, ora_dict_obj_owner,
ora_dict_obj_name,ora_dict_obj_type, sql_text(1), USER, SYSDATE,
(select SYS_CONTEXT('USERENV', 'IP_ADDRESS') from dual)
FROM DUAL;
ELSIF oper = 'ALTER' THEN
INSERT INTO AUDITORIA_ESQUEMA
SELECT ora_sysevent,(select sys_context('USERENV','OS_USER') from dual)
, ora_dict_obj_owner,
ora_dict_obj_name,ora_dict_obj_type, sql_text(1), USER, SYSDATE,
(select SYS_CONTEXT('USERENV', 'IP_ADDRESS') from dual)
FROM sys.gv_$sqltext
WHERE UPPER(sql_text) LIKE 'ALTER%'
AND UPPER(sql_text) LIKE '%NEW_TABLE%';
END IF;
END AUDITORIA_ESQUEMA; -
dropping users' favorite addons can not help your business. VB Please fix this as soon as possible. You shouldn't put new versions in the auto-update facility until they are fully functional with know add-ons. Bad move.
Add-ons are the responsibility of their authors. McAfee does not even put their extension on http://addons.mozilla.org you had to install it from their site.
Disable "McAfee Site Advisor" extension which was just updated to 3.4.0, which probably took it out of the addons block list.
* "Ctrl+Shift+A" > find McAfee Site Advisor and use "Disable", and then restart Firefox.
* Do a Google Search no problem
* It seems that if you re-enable Site Advisor again, and restart Firefox you are okay. At least you know where to look if you get the error again or Google searches slow down. -
How to drop a table in another schema.
Hi there, was looking to drop a table that is currently created under GL schema when consolidation process is done. These tables are kind of temporary and stay there if consolidation process doesn't complete successfully.
So, I'm try to execute a script that would drop the table but the particularity is that this drop isn'T executed by apps but with bolinf (custom user).
So, while trying to delete it with bolinf, I always get an error message that the table doesn't exists or so.
Here's the code
r_gl_int_ctrl.INTERFACE_TABLE_NAME is retreived from gl_interface_control table and from INTERFACE_TABLE_NAME column.
EXECUTE IMMEDIATE 'DROP TABLE GL.' || r_gl_int_ctrl.INTERFACE_TABLE_NAME;
and this generates the following error : ORA-00942: table or view does not exist
R12.0.6
RDBMS 10.2.0.3.0
Custom package under bolinf schema is trying to drop GL.GL_CONS_INTERFACE_38190 and it's not working. Nevertheless, if I install this package under apps, table get dropped.
Is there a way that I can drop a GL table like GL.GL_CONS_INTERFACE_38190 from BOLINF schema ? If so, what privileges/grant should user BOLINF have in order to drop this table from a GL Schema ?
Thank you.Hi;
You need to give drop grant to your user.Easy way is to give
GRANT DROP ANY TABLE TO USER; << but its mean it will give drop grant for all table.
Also see:
OERR: ORA 942 "table or view does not exist" [ID 18536.1]
Regard
Helios -
Avoiding server events of drop downs, table rows--serious discontent:Users
Hi All,
We have developed Timesheet, satffing request system, Visa Requisition System, Dash board using WEB DYNPRO for JAVA. Each application has UI elements->drop downs,Table.
<b> We are facing serious discontent from onsite users( US,Germany, UK etc..) who get lot of server events while using each UI element( mentioned above). "It is absolutely unfriendly" is the comments we are getting from users</b>.
<u>CAN'T WE AVOID THIS....by upgrading EP version(currently we are using 6.40) or some other way.....</u>
Please let us know how can we OVERCOME this issue...
Thanks in advance,
Gangadharayya.Hi,
See if you can find the "CompatibilityMode" property for the table. Set this property to "nw04plus" value. This should eliminate your issue.
Hope this helps. -
Ora-00600 error when dropping a table
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
When I tried to drop a table, I got 600 error:
SQL> desc DEV.ATTR_IDX$EX
Name Null? Type
NODE_ID NOT NULL NUMBER
COL1 NUMBER
SQL> show user;
USER is "DEV"
SQL> select count(*) from DEV.ATTR_IDX$EX;
COUNT(*)
0
SQL> drop table DEV.ATTR_IDX$EX;
drop table DEV.ATTR_IDX$EX
ERROR at line 1:
ORA-00600: internal error code, arguments: [15265], [], [], [], [], [], [], [],
SQL> drop table DEV.ATTR_IDX$EX purge;
drop table DEV.ATTR_IDX$EX purge
ERROR at line 1:
ORA-00600: internal error code, arguments: [15265], [], [], [], [], [], [], [],
I guess this is because it had a parent table, which I dropped (I used "drop table <parent_table>", and it did not give me error, very strange).
SQL> select dbms_metadata.get_ddl('TABLE','ATTR_IDX$EX') from dual;
DBMS_METADATA.GET_DDL('TABLE','ATTR_IDX$EX')
CREATE TABLE "DEV"."ATTR_IDX$EX"
( "NODE_ID" NUMBER NOT NULL ENABLE,
"COL1" NUMBER,
FOREIGN KEY ("NODE_ID")
REFERENCES () ON DELETE CASCADE ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
MONITORING
Try to drop FK constraints yields the same error.
So now how can I drop this table table, any work around?
Thanks.This is a bug. There is no Patch avaialble for this yet. This error is seen where recyclebin is enabled. Possible workaround is to disable the recyclebin.
This happens with the dictionary corruption due to inconsistency between obj$ and seg$.
This is a correct answer but still i would suggest to contact Oracle support. -
Unable to descripe the table and unable to drop the table
Hi,
I have a temp table that we use like staging table to import the data in to the main table through some scheduled procedures.And that will dropped every day and will be created through the script.
Some how while I am trying to drop the table manually got hanged, There after I could not find that table in dba_objects, dba_tables or any where.
But Now I am unable to create that table manually(Keep on running the create command with out giving any error), Even I am not getting any error (keep on running )if I give drop/desc of table.
Can you please any one help on this ? Is it some where got stored the table in DB or do we any option to repair the table ?
SQL> select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where OBJECT_NAME like 'TEMP%';
no rows selected
SQL> desc temp
Thank in advance.Hi,
if this table drops then it moved DBA_RECYCLEBIN table. and also original name of its changed automatically by oracle.
For example :
SQL> create table tst (col varchar2(10), row_chng_dt date);
Table created.
SQL> insert into tst values ('Version1', sysdate);
1 row created.
SQL> select * from tst ;
COL ROW_CHNG
Version1 16:10:03
If the RECYCLEBIN initialization parameter is set to ON (the default in 10g), then dropping this table will place it in the recyclebin:
SQL> drop table tst;
Table dropped.
SQL> select object_name, original_name, type, can_undrop as "UND", can_purge as "PUR", droptime
2 from recyclebin
SQL> /
OBJECT_NAME ORIGINAL_NAME TYPE UND PUR DROPTIME
BIN$HGnc55/7rRPgQPeM/qQoRw==$0 TST TABLE YES YES 2013-10-08:16:10:12
All that happened to the table when we dropped it was that it got renamed. The table data is still there and can be queried just like a normal table:
SQL> alter session set nls_date_format='HH24:MI:SS' ;
Session altered.
SQL> select * from "BIN$HGnc55/7rRPgQPeM/qQoRw==$0" ;
COL ROW_CHNG
Version1 16:10:03
Since the table data is still there, it's very easy to "undrop" the table. This operation is known as a "flashback drop". The command is FLASHBACK TABLE... TO BEFORE DROP, and it simply renames the BIN$... table to its original name:
SQL> flashback table tst to before drop;
Flashback complete.
SQL> select * from tst ;
COL ROW_CHNG
Version1 16:10:03
SQL> select * from recyclebin ;
no rows selected
It's important to know that after you've dropped a table, it has only been renamed; the table segments are still sitting there in your tablespace, unchanged, taking up space. This space still counts against your user tablespace quotas, as well as filling up the tablespace. It will not be reclaimed until you get the table out of the recyclebin. You can remove an object from the recyclebin by restoring it, or by purging it from the recyclebin.
SQL> select object_name, original_name, type, can_undrop as "UND", can_purge as "PUR", droptime
2 from recyclebin
SQL> /
OBJECT_NAME ORIGINAL_NAME TYPE UND PUR DROPTIME
BIN$HGnc55/7rRPgQPeM/qQoRw==$0 TST TABLE YES YES 2006-09-01:16:10:12
SQL> purge table "BIN$HGnc55/7rRPgQPeM/qQoRw==$0" ;
Table purged.
SQL> select * from recyclebin ;
no rows selected
Thank you
And check this link:
http://www.orafaq.com/node/968
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables011.htm
Thank you -
If dropping a table without the PURGE clause sends table definition, indexes and triggers to the recycle bin leaving the table data inaccessible then where exactly is that table data? Is it just unstructured data floating around in the tablespace sucking up the user's quota?
MattOnce a table is dropped, if the 'PURGE' clause was not declared, it will remain there as a ghost object, actually consuming space.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
CREATE$JAVA$LOB$TABLE TABLE
JAVA$OPTIONS TABLE
EMP TABLE
SQL> drop table emp;
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
CREATE$JAVA$LOB$TABLE TABLE
JAVA$OPTIONS TABLE
BIN$aCRWNoJ2TE+g+lQ/XJutWg==$0 TABLEThere you can see the EMP table turned into a Recycle Bin object. This will remain there until you issue the command:
SQL> PURGE RECYCLEBIN;
This will definitely and permanently purge the object. What it really happens in 10g R1 and above, is that the recycle bin feature is enabled by default, but you can change this behavior at either session or instance level.
~ Madrid
http://hrivera99.blogspot.com -
Hi Gurus,
when i am trying to drop a table, getting the below error:
ora - 00942; table or view does not exists
when am doing "desc <table_name>", i can see the structure.
tried to rename the table still its giving ora 00942
can you please suggest why the table cannot be dropped?
thanks in advance!
//sabyTry this as user TEST2:
SQL> select 'drop table "'||table_name||'" purge;' from user_tables where upper(TABLE_NAME) like 'SKF_%' ;
'DROPTABLE"'||TABLE_NAME||'"PURGE;'
drop table "SKF_CL_AL_ROW_AVAILABILITY " purge;
SQL> drop table "SKF_CL_AL_ROW_AVAILABILITY " purge;
There COULD be a blank (or something else) at the end of the table name. -
How to drop all tables in perticular schema??
Hi,
I am new in oracle.
I want to drop all tables in one perticular schema,
Please tell me solution.
PratHameshIf your few of your tables have referential intigrity constraints and trying to drop master table whithout droping child table first, oracle will produce an error.
Better option would be to drop the entire schema and then create a new schema with the same name.
on sql plus.
set long size 20000
select dbms_metadata.get_ddl('USER','USERNAME') from dual;
--then save the above output to create the user later.
drop username cascade
use the above saved script to create the user again.
Jaffar -
Grant access to create/alter/drop/ to tables, view, index
Using (Transact-sql) SQL query analyser 8.00.2039
Objective: To delete/drop the schema on every run of database setup (i mean drop the schema and build it on every run).
I have done the following to accomplish the same ...
Logged in as sa ... i did the following
use master
exec sp_addlogin 'sas'
exec sp_adduser 'sas'
create database ss
use ss
exec sp_grantdbaccess 'sas', 'ss'
i am having issues with the grant command in the above version.
i want to grant create table, create index, create view, alter table, drop view, drop index, drop table to the user sas
When i ran the command
grant create table, create index, create view, alter table, drop view, drop index, drop table to sas
i got
Server: Msg 165, Level 16, State 6, Line 1
Privilege CREATE INDEX may not be granted or revoked.
Server: Msg 165, Level 16, State 1, Line 1
Privilege ALTER TABLE may not be granted or revoked.
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'delete'.
If the grant worked, i thought of creating the schema like
create schema epp authorization sas
Then for removing the schema (as there is no drop schema command for the version mentioned above)
i would have done this,
use master
exec sp_revokedbaccess 'sas'
alter database ss set single_user with rollback immediate
drop database ss
exec sp_droplogin 'sas'
I referred the online book but not of much help on this.
Is this is the correct way to drop/delete a schema on every run of database setup
pls. offer your suggestionsTerminology.
When you write “schema” I will guess that you mean ‘database ‘rather than a security schema within a database.
User.
A user is an object that belongs to a database. In your create code you added the user sas to the master database. If you want to add that user to the ss database you have to create the ss database first, then USE database ss; before you sp_adduser. If you are using SQL Server 2005 use CREATE User not sp_adduser.
To DROP a database you DROP the database. All the objects in the database including its users are dropped with it. The Logins belong to the server and they can be dropped before or after you drop the database though if you drop a Login and don’t drop a database that has that Login as a User you orphan the User. -
Hi,
Have two redundant tables that contain 3 billion rows of data that I'm planning to drop.
I was planning to drop the tables (no need to truncate first?)
Then shrink the database & files
Is there anything else I should consider doing?
This is approx 30% of the entire database.Shrinking cause data fragmentation, so make sure to reindex the database after shrinking
As in this?
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
GO
EXEC sp_updatestats
GO
There is a better solution than that, use Ola Hallengen script
http://ola.hallengren.com
vt
Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker -
Hi,
I wants to drop the selected tables from a user (eg:select table_name from user_tables where table_name like 'C%'). I created a temp table and inserted the selected table names.I need a procedure to drop all the tables.
suppose if table does not exist at the time of dropping it should continue dropping other tables.
can any one help me?
Thanks & regards,
Balaji tk.Balaji,
I could see multiple issues with this code, i have corrected few in the code below.....since i dont have oracle in my system right now......rest you can trace and resolve, then tell us clearly the issue.But i m sure, the issue you are getting is due to some other error
CREATE OR REPLACE PROCEDURE Delete_Tables
IS
TYPE v_tables_temp IS TABLE OF varchar2 INDEX BY BINARY_INTEGER;
--TYPE v_tables_temp IS TABLE OF temp.table_name%TYPE INDEX BY BINARY_INTEGER;
v_tables v_tables_temp;
v_temp temp.table_name%TYPE;
cursor c is
SELECT table_name
FROM user_tables
WHERE table_name = v_tables(v_Index);
BEGIN
SELECT table_name bulk collect
--SELECT table_name
INTO v_tables
--FROM temp;;
FROM temp;
open c;
FOR v_Index IN 1..v_tables.COUNT
LOOP
fetch c into v_temp;
if (c%FOUND) then
EXECUTE IMMEDIATE 'Drop table v_tables(v_Index)';
--EXECUTE IMMEDIATE 'Delete from temp where table_name=v_tables(v_Index)';
end if;
--else
EXECUTE IMMEDIATE 'Delete from temp where table_name = v_tables(v_Index)';
commit;
END LOOP;
close c;
ENDCompare this with your code, and find the error u had in the code !!!
also grant direct DROP privelege to the table, and not through any role -
How to reset All users and delete their table?
Hi,
i want to know How to reset All users and delete their tables with username- system and password-manager.
thanksHi
Here delete means truncate or drop?????
If drop use the following statement to generate the script:
select 'drop table ' || Owner || '.' || Table_Name || ';' from Dba_tables
where owner in (<All_the_users_you_want_to_reset>);
But before firing the above statement extract the DDL's to create all the users and put it in a file and just run that file to re-create the users.
if its truncate then:
select 'truncate table ' || Owner || '.' || Table_Name || ';' from Dba_tables
where owner in (<All_the_users_you_want_to_reset>);
Hope this Helps
Regards -
hi
I am tryin to drop a schema devj2ee with the following command:
SQL> drop user devj2ee cascade;
drop user devj2ee cascade
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables
Now if try to see which queue tables exist for devj2ee it returns no rows.
SQL> select count(*) FROM DBA_QUEUE_TABLES WHERE owner ='DEVJ2EE';
COUNT(*)
0
The DBA_QUEUE_TABLES has all the sys/system queue tables as find below;
select owner, queue_table from dba_queue_tables;
OWNER QUEUE_TABLE
SYS ALERT_QT
SYS AQ$_MEM_MC
SYS AQ_EVENT_TABLE
SYS AQ_SRVNTFN_TABLE
SYS KUPC$DATAPUMP_QUETAB
SYS SCHEDULER$_EVENT_QTAB
SYS SCHEDULER$_JOBQTAB
SYS SYS$SERVICE_METRICS_TAB
SYSMAN MGMT_NOTIFY_QTABLE
SYSTEM DEF$_AQCALL
SYSTEM DEF$_AQERROR
11 rows selected.
Please advice how to remove the user DEVJ2EE.
My db is 10gR2 on solaris10 box.SQL> select object_name,object_type from dba_objects where owner='DEVJ2EE' and object_name like '%AQ%';
OBJECT_NAME OBJECT_TYPE
CMN_AQ_MESSAGE_TYPE TYPE
DLS_AQ_QUEUE TABLE
Now if I try to drop this table i get the following error:
SQL> begin
2 DBMS_AQADM.DROP_QUEUE_TABLE('DLS_AQ_QUEUE');
3 end;
4 /
DBMS_AQADM.DROP_QUEUE_TABLE('DLS_AQ_QUEUE');
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00201: identifier 'DBMS_AQADM' must be declared
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
SQL> EXECUTE DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'DLS_AQ_QUEUE');
BEGIN DBMS_AQADM.DROP_QUEUE_TABLE (queue_table => 'DLS_AQ_QUEUE'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_AQADM' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
So, i thought this is a privelege issue.
SQL> conn sys@dbklsdev as sysdba
Enter password:
Connected.
SQL> begin
2 DBMS_AQADM.DROP_QUEUE_TABLE('DEVJ2EE.DLS_AQ_QUEUE');
3 end;
4 /
begin
ERROR at line 1:
ORA-24002: QUEUE_TABLE DEVJ2EE.DLS_AQ_QUEUE does not exist
ORA-06512: at "SYS.DBMS_AQADM_SYS", line 4084
ORA-06512: at "SYS.DBMS_AQADM", line 197
ORA-06512: at line 2
Alternatively, I tried granting privs to devj2ee and tried to drop the table from this user but the result was same.
SQL> GRANT RESOURCE TO devj2ee;
GRANT CONNECT TO devj2ee;
GRANT EXECUTE ANY PROCEDURE TO devj2ee;
GRANT aq_administrator_role TO devj2ee;
GRANT aq_user_role TO devj2ee;
GRANT EXECUTE ON dbms_aqadm TO devj2ee;
GRANT EXECUTE ON dbms_aq TO devj2ee;
GRANT EXECUTE ON dbms_aqin TO devj2ee;
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL>
Grant succeeded.
SQL> conn devj2ee/devj2ee@dbklsdev
Connected.
SQL> begin
2 DBMS_AQADM.DROP_QUEUE_TABLE('DLS_AQ_QUEUE');
3 end;
4 /
begin
ERROR at line 1:
ORA-24002: QUEUE_TABLE DEVJ2EE.DLS_AQ_QUEUE does not exist
ORA-06512: at "SYS.DBMS_AQADM_SYS", line 4084
ORA-06512: at "SYS.DBMS_AQADM", line 197
ORA-06512: at line 2
At this point I tried the same old query again to find out if the queue table really exist:
SQL> select object_name,object_type from user_objects where object_name like '%AQ%';
OBJECT_NAME OBJECT_TYPE
CMN_AQ_MESSAGE_TYPE TYPE
DLS_AQ_QUEUE TABLE
I hope you have any further tricks to try on this.
Maybe you are looking for
-
Purchase Order Document Control API's
Hi, I need to know if there are any API's available for PO Document Control Options like - Closed PO, Cancel PO, Close for Receiving and so on. Please Help Sudeep
-
Several spry photo galleries on a web page
I'm a bit new at this, but I have done the Don Booth tutorial on how to create a photo album using the spry framework. It's all working fine. However, I want to place several galleries on the one web page and I'm really not sure how to go about this.
-
How to get Safari to default to Google?
Prefernces are set to Google, but Safari insists on Yahoo.
-
How to alter width of navigation region
Is there a way to alter the width of the Navigation Region Alternative 1? I am using it to display links to other pages, but the descriptions are bumping onto three and four lines, making it cumbersome.
-
Sender Rewriting Scheme?
Are there any plans for IronPort to implement Sender Rewriting Scheme in AsyncOS? I'm personally not a big fan of SPF and SRS, but like it or not they're being deployed. We use a C300 to operate a mail forwarding service for our alumni (we get the fo