Before dropping a table
Hi, I have to do an impact analysis before dropping a table from production database, which Is the best/economic way to do an impact analysis in application developers view if the table is not using in the application itself ?
Thanks
Bcj
Our DBAs wanted to drop a table without impacting the application. This application is not directly using the table for any DML operations, but indirectly can be by triggers, procedures so, i wanted to make sure that this is not happening indirectly . There lots of database triggers and procedures. Thanks.
Similar Messages
-
Create a trigger before drop a table on oracle 11g
Hi all,
I am working on oracle 10g database.
My requirement is i want to revoke drop table(Only table) from owner(He is a original owner he owned the table).
The owner can able to create a table and other objects .
But we won't allow to drop a table. he can drop other objects like procudure,packages..
So i decide to implement the above solution with trigger.
Can anyone please guide me ,if possible please post the sample code.
regards,
reshuSQL> create user u1 identified by u1
2 default tablespace users
3 quota unlimited on users
4 /
User created.
SQL> grant create session,create table to u1
2 /
Grant succeeded.
SQL> create or replace
2 trigger u1_no_table_drop
3 before drop
4 on u1.schema
5 begin
6 if ora_dict_obj_type = 'TABLE'
7 then
8 raise_application_error(-20900,'DROP TABLE is not allowed.');
9 end if;
10 end;
11 /
Trigger created.
SQL> connect u1/u1
Connected.
SQL> create table test(id number)
2 /
Table created.
SQL> create index test_idx
2 on test(id)
3 /
Index created.
SQL> drop index test_idx
2 /
Index dropped.
SQL> drop table test
2 /
drop table test
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-20900: DROP TABLE is not allowed.
ORA-06512: at line 4
SQL> SY. -
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 -
Dropping a Table Using PL/SQL
I've read that PL/SQL doesn't support DDL, which seems to mean that I cannot use PL/SQL to create, alter, or drop a table. Is this true? I've written (but not tested) some PL/SQL code that needs to drop a table and rename another table under certain circumstances. Would this code work?:
IF archAlertCount = 0 THEN
EXECUTE IMMEDIATE 'DROP TABLE ' || tName(x);
EXECUTE IMMEDIATE 'RENAME ' || tName(x) || '_temp TO ' || tName(x);
COMMIT;
ELSE
ROLLBACK;
END IF;
END LOOP;
I can't test it because my test environment isn't ready... that's why I'm asking instead of just trying it.
As always, I appreciate any responses.
RebeccaHello;
This Points you should have still in focus.
* Implicit Commit's with DDL's
your transaction before a DDL are automatically committed.
* Invalid Package
If your procedure references the Object, which should be dropped,
in static code it will get invalid.
Ciau
Orca -
Dropping a table only if it exists
Does anyone have the sql code to drop a table
only if it exists in dba_tables? We build
temporary tables for the run of a job. Before we start the job we want to make sure that none of those tables were accidentally left around, so we check for their existence, and if they are present, we drop them. If you try to drop a table that does NOT exist, you get an error and are kicked out of the batch job.Just trap the error at drop time and ignore it.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ():
Does anyone have the sql code to drop a table
only if it exists in dba_tables? We build
temporary tables for the run of a job. Before we start the job we want to make sure that none of those tables were accidentally left around, so we check for their existence, and if they are present, we drop them. If you try to drop a table that does NOT exist, you get an error and are kicked out of the batch job.<HR></BLOCKQUOTE>
null -
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; -
What's up when you drag and drop a table into a jsp page?
Hi All,
I was wondering what's happen in dragging and drop a table into a jsp page. This question because untill yesterday i had an application up and running, with a table displaying a number of rows of the database, and an action associated with an update into a database.
The action is managed trough JNDI, defined from Preference-Embedded.......
It was working.
Then the machine hosting the db changed IP addres. I went into Webcenter Administration console, I've changed the connection string into the jdbc parameters, by updating the new IP address... but it's not working anymore! The log comes out with a big error, but basically it can't connect at the db!
So, I think there is somewhere some reference to the old db.....where???
Thanks
ClaudioYes Shay,
I got this error:
JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.jbo.DMLException, msg=JBO-26061: Error while opening JDBC connection.
in few hours I'll be able to give you the full stack.
Thanks
Clauido
Message was edited by:
user637862
Hi Shay,
Thanks a lot..you were right.
I've located the ba4j on the webcenter server...and I've noticed that it was with the old address.
I think it's a bug, cause on the local machine (before to deploy) this file comes with the right address.
So next time, before to redeploy a new application, I think I'm going to fiscally delete the folder from j2ee folder.
Thanks again for the help!
Claudio -
Grand total "before" on static table
I can do grand total "before" on pivot table...but I need to do in static table. Is possible??
With pivot table I have option "after", "before" but in static table I don't have any option...
Thanks!Set the aggregation for the metrics.. Either in RPD or in report.
In report, Open fx of column and you will aggregation drop down at bottom of pop up window. Set that to proper aggregation, and try grand totals.
- Madan -
Hello,
I am going to drop some tables in production environment for the first time do i need to check the mode of the tablespace?
Thanks,
New_to_oracleThis is a forum, not a chat. Please read documentation before question.
Handle: Sunny4989
Status Level: Newbie
Registered: Jun 20, 2012
Total Posts: 29
Total Questions: 11 (9 unresolved)
Name Sunil
And mark answered the post to clean the forum when your question will be solved. -
I would like move an entire row from one table to another with drag and drop components.
i´ve tried put the dragsource to the first table but i get error:
<af:table..>
<af:column....>
</af:column>
<af:dragSource actions="COPY" discriminant="fileModel" />
</af:table>
can anyone help me with the dragSource and dragTarget components????
Edited by: josefuente on 07-oct-2010 1:39Hi,
if you want to move rows, then you use
<af:table>
<af:dragSource
actions="MOVE" discriminant="rowmove" />
</af:table>
<table>
<af:dropTarget dropListener="#{mybean.drophandler}" actions="MOVE">
<af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet""
discriminant="rowmove" />
</table>
you then create a managed bean method
public DnDAction drophandler(DropEvent dropEvent){
Transferable t = dropEvent.getTransferable();
DataFlavor<RowKeySet> df = DataFlavor.getDataFlavor(RowKeySet.class, "rowmove");
RowKeySet rks = t.getData(df);
... iterate over rowKeySet to get key path of dragged data row ...
... look it up in source table and copy the full row over to another table ...
... before removing the table row in origin table ..
return DnDAction.MOVE;
Frank -
Dear All,
I have a script which creates tables and triggers and drop the tables.
I want to know if the triggers are dropped automatically when we drop the tables and when we create the tables what is the name of the tablespace that they are created in ?
thank you in advance for your replyTriggers are dropped automatically when you drop the associated table.
SQL> create table a (id number);
Table created.
SQL> create trigger trga before insert on a for each row
2 begin
3 null;
4 end;
5 /
Trigger created.
SQL> select trigger_name from user_triggers where table_name = 'A';
TRIGGER_NAME
TRGA
SQL> drop table a;
Table dropped.
SQL> select trigger_name from user_triggers where table_name = 'A';
no rows selected -
Drop parent table with disabled child constraints?
I have a table I would like to drop and recreate. I do not want to have to recreate all the foreign key constraints again. Can I disable the foreign key constraints, drop the table and then recreate the table and enable the foreign key constraints?
Thanks,
John E.No.
The Triggers,Indexes,Constraints etc, assocated with a table are bound to the table they are defined for.
They owe their existance to the existance of the table.
If the table goes, so do the constraints.
If you have Oracle9i, can use DBMS_METADATA to generate the DDL script of the table before dropping it. -
Hi guys ,
am trying to drop my table . but it is used by another user . am getting error message.
can give a suggession .
Edited by: Balajiraam on Mar 2, 2011 1:33 AMHi,
You cannot drop the table without the other user completing the transaction on the table. So the user's transaction has to be completed before you drop the table. As hoek said the user should either commit or rollback the transaction.
cheers
VT -
Hi
I have just dropped a very important table by mistake
can it be recovered without going to a back up?
thanks in adbvanceuser13530410 wrote:
But the select statement will just give u the details, we can't get it back again in the database.
SQL> create table emp1 as select ename,sal from emp
2 /
Table created.
SQL> drop table emp1
2 /
Table dropped.
SQL> select * from emp1
2 /
select * from emp1
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> SELECT object_name as recycle_name, original_name, type FROM recyclebin
2 /
RECYCLE_NAME ORIGINAL_NAME TYPE
BIN$YWrU8OVLTC6z5IEB2Edu6g==$0 EMP1 TABLE
SQL> flashback table emp1 to before drop
2 /
Flashback complete.
SQL> SELECT object_name as recycle_name, original_name, type FROM recyclebin
2 /
no rows selected
SQL> select * from emp1
2 /
ENAME SAL
SMITH 800
ALLEN 1600
WARD 1250
JONES 2975
MARTIN 1250
BLAKE 2850
CLARK 2450
SCOTT 3000
KING 5000
TURNER 1500
ADAMS 1100
JAMES 950
FORD 3000
MILLER 1300
14 rows selected.
SQL> SY. -
Hi All,
i got an error while dropping a table which is
ORA-00600: internal error code, arguments: [kghstack_free1], [kntgmvm: collst], [], [], [], [], [], [], [], [], [], []
i know learnt that -600 error is related to dba. now how to proceed.
thanks and regards,
sri ram.00600 errors should be raised as service request with Oracle as it implies some internal bug.
You can search oracle support first to see if anyone has had the same class of 00600 error, and then if not (and therefore no patch) raise your issue with Oracle.
http://support.oracle.com
Maybe you are looking for
-
Intensity pro and Radeon 5770 ?
Hi, I'm experiencing some problems with my Intensity Pro that I think might be due to some incompatibility issue with the ATI Radeon 5770 in my Mac Pro 3.2 ghz (Mid 2012). With the intensity pro card installed it takes about 5 minutes to boot, and th
-
Hi All, My Web application is FBA application and I am using the lists.asmx services in my custom webpart. To run this lists.asmx service in FBA enabled site we need to use Authentication.asmx service.. I referred this link: http://social.msdn.micros
-
Java Version BI 4.1 SP1
Hello, The last couple of weeks we have experienced quiet a lot of error messages that seems to relate to Java versions installed on users computers. Examples: What we have told our users is to upgrade or downgrade the Java to 7.45. My question is, d
-
ITunes automatically launches when I click on RSS links
Help! My iTunes automatically launches and subscribes to RSS feeds (even text ones!)...how do I change this config? I want to pick a different RSS reader for texts!!!
-
Does " Close Project without Saving " key assignment work at all ?
I'm using Logic Express 8. I'd really like to be able to close a project without seeing the " do I want to save the project " box. There is a function to do that in the Keypress Commands, but it seems broken. I've tried assigning several different ke