Some times we get an error while running a DDL statement on a table. something like belowSQL> drop table aa;
drop table aa
*
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an index on temporary table already in use
This happens because some other session is using this table or having a lock on this table.
Following is the simple procedure to kill the session holding the lock on this table and drop the table. Note that this should be done only if you are sure that this table is no more required and all sessions holding lock on this table can be deleted
1. Get the object ID of the table to be droppedSQL> select object_id from dba_objects where object_name = 'AA';
OBJECT_ID
----------
3735492
2. Get the session ID which is holding lock on this object from v$locked_object view
SQL> select OBJECT_ID, SESSION_ID, ORACLE_USERNAME, PROCESS from v$locked_object where OBJECT_ID = 3735492;
OBJECT_ID SESSION_ID ORACLE_USERNAME PROCESS
---------- ---------- ------------------------------ ------------------------
3735492 1124 MSC 4092@AKPRADH-LAP
3. Get the serial# of the SID using v$session
SQL> select sid, serial# from v$session where sid = 1124;
SID SERIAL#
---------- ----------
1124 51189
4. Kill the session by connecting as sysdba and try dropping the table
SQL> alter system kill session '1124, 51189';
System altered.
SQL> drop table aa;
Table dropped.
Wednesday, March 17, 2010
Monday, November 30, 2009
Perform Export and Import Parallely
This helped me in saving space in some of activities and also in cases to do parallel export and import.
Scenario 1 :
You were asked to import a schema of your production server into your test server for some purpose. You are expecting that the export will take 5 hours and again the import will take quite more than that. In this case, you can use this option which will save your time in exporting and shipping the file to the other server.By doing this we will be able to export and import parallel on the same box.
1. In your test server, add the production database tnsnames to your tnsnames.ora
2. Create a unix pipe
mknod pipe name -p
ex : mknod ram_pipe -p
3. Start your export :
exp system/password@prod file=ram_pipe owner=erpds statistics=none log=/u01/export.log &
Remember to use & at the end to start the export in back groud and You be able to notice from the logfile whtr the pipe broken due to some errors in the export commands or the export is progressing...!!
4. Now from the same terminal start the import..!!
imp system/XXXXX@testserver file=ram_pipe fromuser=erpds touser=testds log=/u01/import.log &
Simple..!! You will notice one job wil be exporting and other will be importing...!!
Scenario 1 :
You were asked to import a schema of your production server into your test server for some purpose. You are expecting that the export will take 5 hours and again the import will take quite more than that. In this case, you can use this option which will save your time in exporting and shipping the file to the other server.By doing this we will be able to export and import parallel on the same box.
1. In your test server, add the production database tnsnames to your tnsnames.ora
2. Create a unix pipe
mknod pipe name -p
ex : mknod ram_pipe -p
3. Start your export :
exp system/password@prod file=ram_pipe owner=erpds statistics=none log=/u01/export.log &
Remember to use & at the end to start the export in back groud and You be able to notice from the logfile whtr the pipe broken due to some errors in the export commands or the export is progressing...!!
4. Now from the same terminal start the import..!!
imp system/XXXXX@testserver file=ram_pipe fromuser=erpds touser=testds log=/u01/import.log &
Simple..!! You will notice one job wil be exporting and other will be importing...!!
Subscribe to:
Posts (Atom)

