ORA-00054: resource busy and acquire with NOWAIT

There’s More than One Solution I would Love to Share :

1-Before 11g, you can mark the tablespace read-only for the duration of the alter table 


Alter Tablespace Test read only

2-in 11g you can mark table read-only :

Alter table test Read only

And You can Check Read Only Tables By :


Select    table_name, read_only from    dba_tables
Where owner = ‘myowner’ and table_name = ‘mytab’;

Just To Make Sure After You Alter table to Read Only prevent Update by Create Trigger


create or replace trigger
   tabl_read_only
before
   insert or update or delete
on mytab
begin
raise_application_error (-999999, ‘Table Is Read Only Now’);
end; /

3- You Can Check if there’s Lock on your Database :


SQL> set linesize 130
SQL> set pages 100
SQL> col username       format a20
SQL> col sess_id        format a10
SQL> col object format a25
SQL> col mode_held      format a10
SQL> select     oracle_username || ‘ (‘ || s.osuser || ‘)’ username
,  s.sid || ‘,’ || s.serial# sess_id
,  owner || ‘.’ || object_name object
,  object_type
,  decode( l.block
,       0, ‘Not Blocking’
,       1, ‘Blocking’
,       2, ‘Global’) status
,  decode(v.locked_mode
,       0, ‘None’
,       1, ‘Null’
,       2, ‘Row-S (SS)’
,       3, ‘Row-X (SX)’
,       4, ‘Share’
,       5, ‘S/Row-X (SSX)’
,       6, ‘Exclusive’, TO_CHAR(lmode)) mode_held
from       v$locked_object v
,  dba_objects d
,  v$lock l
,  v$session s
where      v.object_id = d.object_id
and        v.object_id = l.id1
and        v.session_id = s.sid
order by oracle_username
,  session_id
/

  Use

SQL> alter system kill session ‘SID,Serial# ‘;

Enjoy 
OSama Mustafa

 

Apply PSU Patch in Oracle

* You Must have two thing to apply PSU Patch :
1-Lastest version For Optach.
2-PSU Patch that you want to apply.


Steps:

$ORACLE_HOME/OPatch/opatch version

Output will be:
Invoking OPatch 11.2.0.1.7
OPatch Version:  11.2.0.1.7
OPatch succeeded 

1-you need to Update latest version For Optach, to do this :

cd $ORACLE_HOME

cp -r Optach/ /u01/backup/Optach

**make sure you in ORACLE_HOME

rm -rf $ORACLE_HOME/Optach

unzip Optach_that_you_download_from_MOS inside $ORACLE_HOME.

Patch Number :6880880

2-Check Optach After Doing Above Steps :

$ORACLE_HOME/OPatch/opatch version

Output will be:
Invoking OPatch 11.2.0.3.0
OPatch Version:  11.2.0.3.0
OPatch succeeded

3-Apply PSU Patch By Doing the Following, for example :

unzip p13923374_11203_.zip
cd 13923374
opatch apply

Answer the question that you been asked by Oracle 

4- Post Installation Steps :

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
 SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

sysman.emcp.ParamsManager setFlag

This error Appears when are trying maunally creating EM using :

emca -config dbcontrol db -repos create 


To Solve this error make sure you do all the below steps :

1-In your local users and groups add User to ORA_DBA group.
2-Set ORACLE_HOME and ORACLE_SID.

3- sqlplus / as sysdba

@$ORACLE_HOME/rdbms/admin/dbmspool.sql
Package created.

Create the dbmspool package body:

@$ORACLE_HOME/rdbms/admin/prvtpool.plb
View created.
Package body created.

Grant execution privilege on the package:
 

 SQL> grant execute on dbms_shared_pool to sysman;
Grant succeeded.


SQL> grant execute on dbms_shared_pool to dba;
Grant succeeded.

4-Reinstall EM Using
 
emca -deconfig dbcontrol db -repos drop
emca -config dbcontrol db -repos create

Time drift detected. Please check VKTM trace file for more details

Error :

“Time drift detected. Please check VKTM trace file for more details”

Description :

This Error usually Appear After upgrade to 11.2.0.2/11.2.0.3 regarding to MOS its Bug.

Bug 11837095 "TIME DRIFT DETECTED" APPEARS INTERMITTENTLY IN ALERT LOG, THO' EVENT 10795 SET.

And you Check MOS Note For More Information About this Bug :

Time Drift Detected. Please Check Vktm Trace File For More Details. [ID 1347586.1]
Bug 11837095 – “time drift detected” appears intermittently in alert log [ID 11837095.8]

To fix the issue, Please download and apply patch 11837095 if available for your release/platform.

Download Patch From MOS/Patch Tab .

Enjoy 

Osama Mustafa

ORA-14452

Error :
 ORA-14452: attempt to create, alter or drop an index on temporary table already in use

Cause : 
 An attempt was made to create, alter or drop an index on temporary table which is already in use.

Solution :
All the sessions using the session-specific temporary table have to truncate table and all the transactions using transaction specific temporary table have to end their transactions.

Example :

SQL>CREATE GLOBAL TEMPORARY TABLE Osama ON COMMIT PRESERVE ROWS
AS SELECT * FROM employee ;

SQL> DELETE FROM Osama;
258 rows deleted.

SQL> DROP TABLE Osama;
drop table t1
*
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an index on temporary table already in use

Fixing :

SQL> TRUNCATE TABLE Osama;
Table truncated.

SQL> DROP TABLE Osama;
Table dropped.

Done & Enjoy 

Osama Mustafa

BSLN_MAINTAIN_STATS_JOB

Error will Looks Like this :

Errors in file /u01/app/oracle/admin/ORCL/bdump/orcl1_j000_1781806.trc:
ORA-12012: error on auto execute of job 23122
ORA-06550: line 1, column 780:
PLS-00201: identifier ‘DBSNMP.BSLN_INTERNAL’ must be declared

Solution :

First Check if its Failed Or not :

select log_date,status from dba_scheduler_job_run_details  where job_name=’BSLN_MAINTAIN_STATS_JOB’
order by log_date desc;

LOG_DATE                                                                    STATUS
———————————————————————— ————
08-JUL-12 01.30.01.224309 PM                                         FAILED
09-JUL-12 01.30.00.855555 PM                                         FAILED
10-JUL-12 01.30.00.761203 PM                                         FAILED
11-JU:L-12 01.30.00.583605 PM                                        FAILED
12-DEC-12 01.30.00.450731 PM                                        FAILED

 to Fix it Run

SQL> @?/rdbms/admin/catnsnmp.sql
SQL> @?/rdbms/admin/catsnmp.sql

Done & Enjoy

Osama Mustafa

DBA Scripts / Part No.4

This Is new Scripts for Database Administrator , But this Scripts to Check Performance and helping you in Tuning :

1-Script_1 . (Active Session/Execution Plan/Oracle 9i)
2-Script_2 (Active Session/Execution Plan / Any Version).
3-Script_3 (Plan History).
4-Script_4 (Number Of sesion).

Done & Enjoy

Osama Mustafa

Mos Notes

On My Oracle Support There’s lot of Useful notes I Posted Some Of them Here :

Note:1030426.6 How to Clean Up Duplicate Objects Owned by SYS and SYSTEM Schema
Note:472937.1 Information On Installed Database Components
Note:753041.1 How to diagnose Components with NON VALID status

Simple but Useful .

Enjoy
Osama mustafa

Oracle OpenWorld 2012: Focus On Database Security

Oracle OpenWorld 2012 is going to be the place to learn about Oracle Database Security solutions including Oracle Advanced Security with transparent data encryption, Database Vault, Audit Vault and Database Firewall, Label Security, and more.
We’ve put together this Focus On Database Security document so you’ll know when and where to attend the key database security sessions, and not miss a thing.

Thank you
Osama Mustafa