Saturday, 11 February 2012

ORA-01940: cannot drop a user that is currently connected

ORA-01940: cannot drop a user that is currently connected

SQL>drop user username cascade;
drop user username cascade

*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

SQL>select s.sid, s.serial#, s.status, p.spid from v$session s, v$process p where s.username = 'ISL_DF' and p.addr (+) = s.paddr;

SID           SERIAL# STATUS    SPID

----------   ----------    --------       ------------
159               29          INACTIVE 12349

SQL>alter system kill session '159,29';

System altered.


SQL>!kill -9 12349            - (kill the process in OS level)


SQL>drop user username cascade;


User dropped.

Wednesday, 8 February 2012

ORA-12705: Cannot access NLS data files or invalid environment specified

ORA-12705: Cannot access NLS data files or invalid environment specified:

Question: I an getting the error "Resolving ORA-12705: Cannot access NLS data files or invalid environment specified" when I change my NLS_LANG setting.

The developers need to experiment with different character sets but when they issue export NLS_LANG and try to start SQLPLUS after that they get the ORA-12705 error.

Answer: First, The ORA-12705 error is indeed controlled by NLS_LANG, and the ORA-12705 commonly happens when Oracle does an automatic "alter session" at login time and discovers an invalid NLS_LANG setting. The Oracle documentation notes are not very helpful:

ORA-12705: "invalid or unknown NLS parameter value specified"

Cause: There are two possible causes:
- An attempt was made to issue an ALTER SESSION statement with an invalid NLS parameter or value.
- The NLS_LANG environment variable contains an invalid language, territory, or character set.

Action: Check the syntax of the ALTER SESSION command and the NLS parameter, correct the syntax and retry the statement, or specify correct values in the NLS_LANG environment variable.

Oracle also says that the ORA-12705 can happen under these conditions and MOSC has resolutions for these ORA-12705 conditions:

1. ORA-12705 with incorrect NLS_LANG parameter
2. ORA-12705 with incorrectly specified ORA_NLSx
3. ORA-12705 from incorrect Oracle install or configuration
4. ORA-12705 when using Special Character sets
5. ORA-12705 when connecting with SQL*Net
6. ORA-12705 during migrations
7. ORA-12705 when connecting with SQL*Plus
8. ORA-12705 when connecting with language pre-compilers
9. ORA-12705 during Export/Import

For ORA-12705 errors caused by invalid NLS_LANG settings, you need to verify that it is "unset" at the system-level:


Windows - The NLS_LANG must be unset in the Windows registry (re-named is best). Look for the NLS_LANG subkey in the registry at \HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, and rename it.

Linux/UNIX - Here you simply issue the Linux command "unset NLS_LANG"

Tuesday, 7 February 2012

ORA-00230: operation disallowed: snapshot control file enqueue unavailable

ORA-00230: operation disallowed: snapshot control file enqueue unavailable:
if Linux :-

find the Enqueue locks:

SELECT s.sid, username AS "User", program, module, action, logon_time "Logon", l.*
     FROM v$session s, v$enqueue_lock l

     WHERE l.sid = s.sid and l.type = 'CF' AND l.id1 = 0 and l.id2 = 2;

then kill the session with sid and Process# from v$session;

alter system kill session 'SID, Process#' immediately;

if Windows :-

Bug 7450366 RMAN Autobackup fails with unable to obtain snapshot enqueue (ORA-230)


This note gives a brief overview of bug 7450366.
The content was last updated on: 17-OCT-2011
Click here for details of each of the sections below.

Affects:
Product (Component) Oracle Server (Rdbms)
Range of versions believed to be affected Versions BELOW 11.2
Versions confirmed as being affected • 11.1.0.7
• 10.2.0.5
• 10.2.0.4
• 10.2.0.3
• 10.2.0.2
• 9.2.0.1

Platforms affected Generic (all / most platforms affected)

Fixed:
This issue is fixed in • 11.2.0.1 (Base Release)
• 10.2.0.5.5 Patch Set Update


Friday, 3 February 2012

RMAN-08040: full resync skipped, control file is not current or backup

RMAN> register database;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of register command at 02/02/2012 23:14:17
RMAN-08040: full resync skipped, control file is not current or backup

RMAN>
 
 
Cause:  trying you register the standby database to perform/configure backup?
 
SQL> select open_mode,controlfile_type from v$database;

OPEN_MODE CONTROL
______________________________________________
MOUNTED      STANDBY


Solution:

If yes then register the primary database instead of a standby database. Once you register the primary database, you can use the same catalog schema for the backup of physical standby database since the DBID of both the databases is same.

Wednesday, 1 February 2012

ORA-19554: ORA-27211: Failed to load Media Management Library

While taking rman backups may get error like this,

run {

allocate channel c1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/......./....../....../oracle/bin64/tdpo.opt)'
format '%d_controlfile_%U.rbck';
backup current controlfile tag CONTROLFILE_DAY;
release channel c1;}
released channel: ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of allocate command on a1 channel at 01/31/2012 16:37:38
ORA-19554: error allocating device, device type: SBT_TAPE, device name:
ORA-27211: Failed to load Media Management Library
Additional information: 2

if target servers already registered with preferred TSM servers,


Cause: More then one oracle_home without proper library soft link,

Actions: Create soft link for all oracle_home
Ex:
ln -sf /usr/lib/libobk64.a /u001/app/oracle/product/10.2.0/db_1/lib/libobk.a

ln -sf /usr/lib/libobk64.a /u001/app/oracle/product/11.1.0/db_1/lib/libobk.a

ln -sf /usr/lib/libobk64.a /u001/app/oracle/product/11.1.0/db_2/lib/libobk.a

ln -sf /usr/lib/libobk64.a /u001/app/oracle/product/11.2.0/db_1/lib/libobk.a

........
......
....