Monday, December 19, 2011

What is High Water Mark in Oracle?

 

The high water mark level is just a line separate the used blocks and free blocks.

The blocks above the HWM level is free blocks, they are ready to use.
The blocks below the HWM level is used blocks, they are already used.

For example'

if you delete some huge records from the database, that data will delete but the blocks are not ready to used, because that blocks are still below HWM level, so delete command never reset the HWM level,

At the same time you truncate the date, then the data will delete and that used blocks will goto above the HWM level, now its ready to used. now they consider has free blocks.

with 10g there are two different HWM for a table


After deleting rows high water mark remain same, what will happen if i insert new rows now.where these new rows will be stored? above the HWM or below?
The space freed by deletions is available for new insertions, so it will be below, until this free space is filled.
Otherwise; Above the HWM when using the APPEND hint in the INSERT statement (or using DIRECT=Y in sql*loader)

They will remain under the HWM until the object is rebuilt, truncated, or shrunk (shrinking of a segment is a new Oracle 10g feature that is supported only if the segment is in an ASSM tablespace).

Thursday, December 08, 2011

How to find Primary Key of a table

 

SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
FROM all_constraints cons, all_cons_columns cols
WHERE cols.table_name = 'TABLENAME'
AND cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner
AND cols.owner = 'sivaora'
AND cons.owner = 'sivaora'
ORDER BY cols.table_name, cols.position


This can be useful when getting error
ORA-00001: unique constraint (constraint_name) violated

Wednesday, December 07, 2011

ORA-00955: name is already used by an existing object


Cause:
An attempt was made to create a database object (such as a table, view, cluster, index, or synonym) that already exists. A user's database objects must have distinct names.

Action: Enter a unique name for the database object or modify or drop the existing object so it can be reused.

Cross verify to find the existing object by the given name

SELECT   *
  FROM   ALL_OBJECTS
where Object_name like '%obj_name%'

Friday, October 28, 2011

HP-UX DOSKEY equivalent functionality

 

To use the DOSKEY functionality on the HP-UX, in your environment or execute on terminal

Code:

set -o vi

Then you hit escape then with 'k' and 'j' scroll commands (up and down ,like in vi editor).

Then you can use the keystroke sequence <esc>/k to present the last command typed for editing. Move backwards or forwards through the command history using the "-" or "+" keys respectively. If you find a command you want to edit, type "v" which will invoke "vi". Then after editing, use the usual ":wq!" to exit vi and the edited command will execute.

Tip: If you decide to not execute any command (edited or not), blank the command in vi (eg. the "dd" vi command) and then ":wq!".

Friday, October 14, 2011

Moving Data files Between ASM Disk Groups

 

Method 1: Using RMAN

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Back up the datafile to the new ASM disk group.

RMAN> BACKUP AS COPY DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' FORMAT '+DG_DEVSYS_mydb1_DATA_01';

Step 4:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 5: Point the control file to the newly created copy of the datafile

RMAN> SWITCH DATAFILE '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' TO COPY;

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8. Delete the old datafile
RMAN>DELETE DATAFILECOPY “DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421”

Reference: http://download.oracle.com/docs/cd/B28359_01/backup.111/b28270/rcmasmmi.htm

Method 2: Using ASMCMD CP ( Copy ) Command

Step 1: Start RMAN and connect to the target database.

$ rman target /

Step 2: Generate a report that shows the names of the datafiles.

RMAN> REPORT SCHEMA;

Step 3:  Bring the Datafile Offline
alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 4:  Connect to ASMCMD and use CP to copy files
$ asmcmd –p

ASMCMD [+] > cp +DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421 +DG_DEVSYS_mydb1_DATA_01

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online

Step 8: Verify the file name
RMAN> REPORT SCHEMA


Method 3:  Using RMAN Copy

Step 1:  Restrict the Session
ALTER SYSTEM enable restricted session;

Step 2:   Bring the Datafile Offline

alter database datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' offline

Step 3: Start RMAN and connect to the target database.

$ rman target /

Step 4:  RMAN Copy datafile
RMAN> copy datafile '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421' to '+DG_DEVSYS_mydb1_DATA_01';

Step 5:  After copied datafile, then rename file in database.  With ASM(OMF) this delete old datafile.

alter database rename file '+DG_DEVSYS_mydb1_FLASH_01/mydb1/datafile/data01.290.709985421'  to '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767'

Step 6:  Recover the renamed datafile
RMAN> recover datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767';

Step 7. Bring the datafile online.
alter database datafile '+DG_DEVSYS_mydb1_DATA_01/mydb1/datafile/data01.272.764459767' online


Step 8: Verify the file name
RMAN> REPORT SCHEMA

Step 9: Disable the Restricted Session

ALTER SYSTEM disable restricted session;

Thursday, October 06, 2011

ORA-38729: Not enough flashback database log data to do FLASHBACK.

Just check the oldest flashback time available>

select oldest_flashback_time from v$flashback_database_log;

Cause:

We need to have the required archive logs in the archive destination at the time of flashback.

Like, there could be a  backup script is archiving all the archivelogs and purging it from the ASM, hence, we cannot flashback with the error that it cannot locate the log files.
 
Resolution:
 
That is, if the flashback database command does not work in SQLPlus because a needed archive log was deleted after an RMAN backup, execute the flashback database command from RMAN. RMAN will flashback the database, restore the missing archive log(s) and apply the logs as needed.

Then 'alter database open resetlogs ;' is executed after the flashback database as normal.

 

Ref: https://support.oracle.com Document ID 560686.1.

Wednesday, October 05, 2011

OEM Collection Status : Disabled by Upload Manager

 

oracle@DBSRVR1:/app/oracle/product/11g/db_1/network/admin $ oemagent status
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 11.1.0.1.0
OMS Version       : 11.1.0.1.0
Protocol Version  : 11.1.0.0.0
Agent Home        : /app/oracle/product/em/agent11g/DBSRVR1.production.siva.com
Agent binaries    : /app/oracle/product/em/agent11g
Agent Process ID  : 16164
Parent Process ID : 18735
Agent URL         : https://DBSRVR1.production.siva.com:3872/emd/main
Repository URL    : https://GRIDCTLSRVR.siva.com:1159/em/upload
Started at        : 2011-10-03 12:25:14
Started by user   : oracle
Last Reload       : 2011-10-03 12:25:14
Last successful upload                       : 2011-10-05 18:32:35
Total Megabytes of XML files uploaded so far :  1400.06
Number of XML files pending upload           :      390
Size of XML files pending upload(MB)         :    51.97
Available disk space on upload filesystem    :    26.53%
Collection Status                            : Disabled by Upload Manager
Last attempted heartbeat to OMS              : 2011-10-05 20:44:10
Last successful heartbeat to OMS             : 2011-10-05 18:32:15
---------------------------------------------------------------
Agent is Running and Ready

Causes:

  1. There are too many files backlogged
  2. There is not enough free space on the directory
  3. The size of the files backlogged is too large.
  4. It could be of network issue between OEM Agent and OMS Server

Please check the emd.properties file to override the defaults that automatically disable collection

Friday, September 30, 2011

How to monitor ASM Disk group usage on OEM Grid

  1. Connect to OEM
  2. Connect to the Host
  3. From the Host –> Go to Target Tab
    image
  4. From the listed target, select ASM by looking at type as  “Automatic Storage Management
    image

  5. Now select type ASM, then we will be landed at ASM on OEM Grid Control.
  6. On the Home Page of ASM, we can find the Disk group usage
    image
  7. Also from the Home, go to tab Disk Group

    image

Disk group has used % of safely usable free space

OEM Alert Message looks like;

Message=Disk group DISGKGROUP_FLASH_01 has used 75.08% of safely usable free space.
Metric=Disk Group Used % of Safely Usable
Metric value=75.08
Disk Group Name=DISGKGROUP_FLASH_01
Severity=Warning
Target Name=+ASM1_DBSRVR.siva.com
Target type=Automatic Storage Management
Host=dbsrvr.siva.com
Occurred At=Sep 29, 2011 11:14:52 PM IST
Acknowledged=No
Notification Rule Name=DBSrvr ASM Health Check
Notification Rule Owner=DBA

 

By default:
This metric will generate a warning alert if the Disk Group is using 90% of the Safely usable space and
Critical warning for 100 %. Threshold limit can be changed to generate alert at different values.

This metric is collected at a time interval of 15 minutes.

Metric Collection:
This metric is collected from the view V$ASM_DISKGROUP_STAT

Used % of Safely Usable = 100 - (usable_file_mb/usable_total_mb)*100

Where usable_total_mb = total_mb - required_mirror_free_mb)/redundancy_factor

total_mb and required_mirror_free_mb will come from the V$ASM_DISKGROUP_STAT  view column and

Redundancy Factor Disk Group Type
1 External
2 Normal
3 High

Query:

 select 100-(FREE_MB/TOTAL_MB)*100 as "Used % Safely Usable Area",  Name from v$asm_diskgroup_stat

Alternatively connect to ASM and check the free space;

ASMCMD> lsdg


Workaround:
If the Archive Log file occupies the ASM Disk group, move the files or delete files to free up Disk group.

Permanent Resolution:
New disks can be added in a disk group to avoid the alerts.
Go to the Disk Group general page ---> and click on add button to add a new disk to a disk group.

Friday, September 23, 2011

find: missing conjunction

$  find . -type d –name siva*

Resolution:  Use single quote on the string in –name clause

Ex:   $  find . -type d –name ‘siva*’

How to find the open mode status of database?

Option 1:

select status from v$instance;

Option 2:

select open_mode from v$database;


Option 3:

Search Alert Log for string of “Database” or “alter database”.

How to generate AWR Report?

Method 1:  By Querying

1. Query dba_hist_snapshot to find the snap id for the interval you are looking for.

SELECT dbid, snap_id, begin_interval_time, end_interval_time from dba_hist_snapshot
order by begin_interval_time;

2.

spool siv_awr_201109.lst
SELECT output
FROM TABLE (dbms_workload_repository.awr_report_text(3463084831, 1, 18048, 18050));
spool off

Method 2:

@?/rdbms/admin/awrrpt.sql

It is an interactive script that can be used to generate HTML or text reports. The script prompts for type of report
requested and prompts for number of days of snapshots to choose from so based on that it displays snap ids to
choose the start and end snapshot it.

@?/rdbms/admin/awrrpti.sql

Script can be used for the specified database and instance so the script in addition will prompt for dbid and instance number.
@?/rdbms/admin/awrddrpt.sql Script can be used to generate a combine report of 2 different snapshots for comparison of performance in one report so it will prompt for two pairs of snapshot snapshots to compare against.
@?/rdbms/admin/awrinfo.sql Script print AWR information like space usage by AWR, subset of AWR snap ids, Automatic Database Diagnostic Monitor (ADDM), Active Session History (ASH) information.

Saturday, September 17, 2011

Sequence of steps performed when opening up a database

After issuing of SHUTDOWN ABORT command, when opening up database following step are performed

1. SPFile / PFile:             Server Parameter file ( SP File ) or the initialization parameter (initSID.ora / PFILE ) file is read
2. Memory :                      SGA is allocated
3. Background Process: Background process are started
4. Control File :                Control file is read
5. Redo Log File:              Redo Log file is read
6. Data File:                       Data files are checked for consistency
7. Instance Recovery:   Instance Recovery is started

Friday, August 26, 2011

ksh: =: is not an identifier

 

Error:  ksh: =: is not an identifier
-------------------------------------------------------------------------------------------
Cause:  Space between VariableName, = and Value

Resolution: Remove the space betwen Variablename, = and Value

Example

oracle@myDBSrvr1: export ORACLE_HOME = /app/oracle/product/11g/db_1
ksh: =: is not an identifier
oracle@myDBSrvr1: export ORACLE_HOME=/app/oracle/product/11g/db_1

ORA-00235 controlfile fixed table inconsistent due to concurrent update


Error: controlfile fixed table inconsistent due to concurrent update


Cause: Concurrent update activity on a controlfile caused a query on a controlfile fixed table to read inconsistent information.

Action: Retry the operation.


Reference:  Oracle Support [ID 48816.1]

OEM Grid Agent command to list it’s targets


Here is the command to find the target of an OEM Agent.

./emctl config agent listtargets

Here is the example of the command

oracle@dbsrvr1:/app/oracle/product/em/agent11g/bin $ ./emctl config agent listtargets
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
[dbsrvr1.production.dorvin.org:3872, oracle_emd]
[usrncwd, cluster]
[LIS_RCATP_01_dbsrvr1.production.dorvin.org, oracle_listener]
[LISTENER_dbsrvr1_dbsrvr1.production.dorvin.org, oracle_listener]
[pla31p.dorvin_pla31p1, oracle_database]
[son49p.dorvin, rac_database]
[+ASM1_dbsrvr1.production.dorvin.org, osm_instance]
[dbsrvr1.production.dorvin.org, host]
[rcatp.dorvin, oracle_database]

Sunday, August 21, 2011

ORA-16037: user requested cancel of managed recovery operation

 

Cause:
The managed standby database recovery operation has been canceled per user request.

Option 1:

When the command alter database recover managed standby database cancel issued

Option 2:

When the Primary database of Dataguard got shutdown.

Resolution:
           No action needed

Monday, August 08, 2011

How to find the Master node in RAC

 

The command is oracle@DB_Node2:/home/oracle $ ocrconfig –showbackup
Since, the OCR Automatic backups are taken only by master node. We can verify with following command.


DB_Node1     2011/08/07 22:50:25     /app/crs/product/11g/cdata/PRDDB_cluster/backup00.ocr
DB_Node1     2011/08/07 18:50:24     /app/crs/product/11g/cdata/PRDDB_cluster/backup01.ocr
DB_Node1     2011/08/07 14:50:24     /app/crs/product/11g/cdata/PRDDB_cluster/backup02.ocr
DB_Node1     2011/08/06 06:50:16     /app/crs/product/11g/cdata/PRDDB_cluster/day.ocr
DB_Node1     2011/07/26 06:48:45     /app/crs/product/11g/cdata/PRDDB_cluster/week.ocr

Here the Master node is DB_Node1

Monday, August 01, 2011

EM Alert: target is broken, Suspended on Agent Unreachable


Error: EM Alert:Suspended on Agent Unreachable

Diagnosis
/app/oracle/product/em/agent11g/sysman/log/emagent.log

2011-07-27 16:12:34,737 Thread-4083678112 target {CLUSTERNAME, cluster} is broken: cannot compute dynamic properties in time. (00155)
2011-07-27 16:12:37,342 Thread-4099427232 target {+ASM1_nodename02.domain.com, osm_instance} is broken: cannot compute dynamic properties in time. (00155)
2011-07-27 16:14:04,597 Thread-4093127584 target {RACDB.DOMAIN.COM, rac_database} is broken: cannot compute dynamic properties in time. (00155)

/app/oracle/product/em/agent11g/sysman/log/emagent.trc

2011-07-29 12:03:35,253 Thread-3985230752 ERROR upload: 1 Failure(s) in a row or XML error for C0002000.xml, retcode = -2, we give up
2011-07-29 12:03:48,271 Thread-4035967904 ERROR pingManager: Did not receive valid response to ping "ERROR-Loader/Receiver disabled on this OMS"
2011-07-29 12:03:48,359 Thread-4035967904 ERROR pingManager: Did not receive valid response to ping "ERROR-Loader/Receiver disabled on this OMS"
2011-07-29 12:05:18,641 Thread-3994700704 ERROR pingManager: Did not receive valid response to ping "ERROR-Loader/Receiver disabled on this OMS"
2011-07-29 12:06:18,875 Thread-3985230752 ERROR pingManager: Did not receive valid response to ping "ERROR-Loader/Receiver disabled on this OMS"
2011-07-29 12:08:36,023 Thread-3985230752 WARN upload: FxferSend: received http error in header from repository: https://em.domain.com:1159/em/upload
ERROR-300|Loader/Receiver disabled on this OMS
2011-07-29 12:08:36,024 Thread-3985230752 ERROR upload: Failed to upload file C0002002.xml: HTTP error.
Response received: ERROR-300|Loader/Receiver disabled on this OMS
2011-07-29 12:08:36,175 Thread-3985230752 WARN upload: FxferSend: received http error in header from repository: https://em.domain.com:1159/em/upload
ERROR-300|Loader/Receiver disabled on this OMS


Solution:

Click the configure button and go through the steps without making any changes.

Target {database instance, oracle_database} is broken: cannot compute dynamic properties in time [ID 739993.1] which advised to change the dynamicPropsComputeTimeout property in the emd.properties

Thursday, July 28, 2011

How to find what Shell being used on the server

 

siva@mydbsrvr1:/home/oracle $ echo $SHELL
/usr/bin/ksh


You can find out what shell you are using by the command: echo $SHELL

Environment Variables in Unix
By prefixing $ to the variable name, you can evaluate it in any command

Wednesday, July 27, 2011

How to list hidden files in Unix


On ls command use the –a option.
-a Shows you all files, even files that are hidden (these files begin with a dot.)

ls -a

Sunday, July 24, 2011

ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073

 


Error Message on Trace file

*** SERVICE NAME:(SYS$USERS) 2011-07-24 00:00:18.201
*** MODULE NAME:(DBMS_SCHEDULER) 2011-07-24 00:00:18.201
*** ACTION NAME:(BSLN_MAINTAIN_STATS_JOB) 2011-07-24 00:00:18.201

ORA-12012: error on auto execute of job 11762
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "DBSNMP.BSLN_INTERNAL", line 2073
ORA-06512: at line 1

Cause:

Table DBSNMP.BSLN_BASELINES contains inconsistent information. In this case, after database cloning, existing records in table "DBSNMP.BSLN_BASELINES" conflict with new baseline information inserted in the database.

The DBSNMP user needs to be dropped and re-created.

Solution:

SQL> @?/rdbms/admin/catnsnmp.sql -- drop user

SQL> @?/rdbms/admin/catsnmp.sql -- create user

 

Reference: Oracle ID 736627.1

Monday, July 18, 2011

Flash Recovery Area – Size determination

Ideally, the flash recovery area should be large enough to hold a copy of all of your

  1. data files
  2. control files,
  3. the online redo logs
  4. the archived redo log files

needed to recover your database using the data file backups kept under your retention policy.
Setting the size of DB_FILE_RECOVERY_DEST_SIZE must be based on following factors.
1) your flash back retention target,
2) what all files you are storing in flashback and
3) if that includes backup then the retention policy for them or how often you move them to tape

Oracle Internal Space management mechanism for Falshback recovery area itself is designed in such way that if you define your db_recovery_file_dest_size and DB_FLASHBACK_RETENTION_TARGET at a optimal value, you wont need any further administration or management.

If a Flash Recovery Area is configured, then the database uses an internal algorithm to delete files from the Flash Recovery Area that are no longer needed because they are redundant, orphaned, and so forth. The backups with status OBSOLETE form a subset of the files deemed eligible for deletion by the disk quota rules.

When space is required in the Flash Recovery Area, then the following files are deleted:
a) Any backups which have become obsolete as per the retention policy.
b) Any files in the Flash Recovery Area which has been already backed up
to a tertiary device such as tape.
c) Flashback logs may be deleted from the Flash Recovery Area to make space available for other required files.

Friday, July 15, 2011

How to delete control file


 

Verify the file specification information for the current control file(s):

SQL> show parameters control_files

If your are using pfile, change CONTROL_FILES to point to the remaining control files. Make sure that the full file specification is used.

vi $ORACLE_HOME/dbs/init<SID>.ora.

CONTROL_FILES = (/oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl)

If you are using spfile, you may modify the CONTROL_FILES parameter using the ALTER SYSTEM SET command.

SQL> alter system set control_files = /oradata/<sid>/data1/control_01.ctl, /oradata/<sid>/data3/control_02.ctl scope=spfile;

Shutdown and startup the database.

Verify the file specification information for the current control file(s):

SQL> show parameters control_files

If desired, delete the control file from the O/S.

ORA-1652: unable to extend temp segment by 128 in tablespace TEMP


Error:
ORA-1652: unable to extend temp segment by 128 in tablespace TEMP Fri Jul 11 01:09:12 2010

What does that error means:
This error is fairly self explanatory - we cannot get enough space for a temporary segment. The size reported in the error message is the number of contiguous free Oracle blocks that cannot be found in the listed tablespace.

How to approach the ORA-1652 error

There are two views in the database that help keep track of the free space in the temporary tablespace: v$sort_usage and v$tempseg_usage (from 9i onwards).

Check the status of the sort segment utilization :

select TABLESPACE_NAME,TOTAL_BLOCKS,USED_BLOCKS,FREE_BLOCKS from v$sort_segment;

TABLESPACE_NAME                 TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
------------------------------- ------------ ----------- -----------
TEMP                                 1310592           0     1310592

If USED_BLOCKS = TOTAL_BLOCKS, find which user and statement is using the temporary sort segment by following;

How Do You Find Who And What SQL Is Using Temp Segments

SELECT a.username, a.sid, a.serial#, a.osuser, b.tablespace, b.blocks, c.sql_text
FROM v$session a, v$tempseg_usage b, v$sqlarea c
WHERE a.saddr = b.session_addr
AND c.address= a.sql_address
AND c.hash_value = a.sql_hash_value
ORDER BY b.tablespace, b.blocks;

Resolution

There are two ways of solving this error:

  1. Add more tempfiles, increase the size of the current ones or enable auto extend and the most important:

  2. Tune the queries/statements so that the sort operations are done in memory and not on the disk.

Thursday, July 14, 2011

ORA-21779: duration not active



SMON generated the following errors in the alert log file :

SMON: following errors trapped and ignored:
ORA-21779: duration not active

ORA-06512: at line 1
Drop transient type:  SYSTPfQMEpjI7QJ7gQ6wVAuBAng==ÿ��

As per Oracle : SMON: Following Errors Trapped And Ignored ORA-21779 [ID 988663.1]

Cause of the error:
This error is caused by SMON not able to clean up some transient types and this problem has been reported a few times in Oracle10gR2

Solution

Other then producing large trace files,this error has no impact,SMON is erroring whilst evaluating a SYSTEM trigger whilst executing cleanup of TYPEs which are no longer needed,so currently we have the following options:

Option 1 --Bounce the DB and see if the error is persistent
OR
Option 2--Also Dev in similar bugs suggested to set the following event at system level to delay the cleanup of these types:

alter system set events '22834 trace name context forever, level 1';

This do not affect database functionality and the only problem is the the alert.log is filling up with many error messages (also after restarting the instance the error should not occur again).

The command "alter system flush shared_pool" could also resolve the problem.

As transient types are created when compiling cursors into memory then it looks like a good idea to execute"alter system flush shared_pool" as this cannot create any problems.

Option 3: Drop the transient type

The existence of the Transient type can be verified by query;

SELECT * FROM dba_types
WHERE type_name LIKE 'SYS%==' AND length(type_name) = 29

 

select 'drop type "'||s.username||'"."'||o.name||'" FORCE;'
from obj$ o, type$ t, dba_users s
where o.oid$ = t.tvoid
and bitand(t.properties,8388608) = 8388608
and (sysdate-o.ctime) > 0.0007
and o.owner#=s.user_id


DROP TYPE "TRACS_USER"."SYSTPZd71k+XjoyfgQG8KQW8u9g=="

What is this transient type?

How was it created?

Why can't SMON drop it while I, a DBA user, can?

When selecting from a table function which has return type ANYDATASET oracle creates dynamically a type object which matches the actual return type. and sql will cast it automatically to this actual return type, no ANYDATASET output is returned by the select. this mechanism is introduced with oracle 10 in general the smon should cleanup those types.

Tuesday, June 28, 2011

Steps to set database on flashback mode in RAC for Oracle 11g

 

---- Check if flashback on?

SELECT flashback_on, log_mode
FROM v$database;

--- Check for Flashback Parameters existing

set linesize 121
col name format a30
col value format a30

SELECT name, value
FROM gv$parameter
WHERE name LIKE '%flashback%';

---- Stop the RAC Database , it will stop all the instances of the DB

srvctl stop database -d sfodb

--- Start the DB in mount state

srvctl start instance -d sfodb -i sfo38u1 -o mount 

-- Set the Flashback on

alter database flashback on;

--- Open the database

alter database open;

--- Start the remaining instances of the RAC

srvctl start instance -d sfodb -i sfo38u2 -o mount exclusive

-- Verify the flashback settings

select INST_ID,Name, FLASHBACK_ON from gv$database;

Saturday, June 18, 2011

ORA-00257: archiver error. Connect internal only, until freed.

 

Error:

ORA-00257: archive error, Connect internal only, until freed.
followed by
The database is not available due to the following conditions: Stuck Archiver
followed by
Warning: Disk group +DG_UAT_FLASH_01 is 92% used


*Cause: 
The archiver process received an error while trying to archive a redo log.  If the problem is not resolved soon, the database will stop executing transactions. The most likely cause of this message is the destination device is out of space to store the redo log file.

*Action: 
Check archiver trace file for a detailed description of the problem. Also verify that the device specified in the initialization  parameter  ARCHIVE_LOG_DEST is set up properly for archiving.

Method   1. Without increasing DB_RECOVERY_FILE_DEST_SIZE.

Approach 1: Move the archive log from the FRA to some other location to free up FRA

Step 1: Check whether the database is in archive log mode and automatic archiving is enabled

SQL> archive log list

Database log mode            Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5559
Current log sequence           5561

Step 2:  As the archive destination is defined by USE_DB_RECOVERY_FILE_DEST, find the archive destination by

SQL> show parameter db_recovery_file_dest;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +DG_UAT_FLASH_01
db_recovery_file_dest_size           big integer 110G

Note the value for db_recovery_file_dest_size. Here it is 11G.

Step 3:  Find the space used in flash recovery area by :

SQL> SELECT * FROM V$RECOVERY_FILE_DEST;

NAME
--------------------------------------------------------------------------------
SPACE_LIMIT SPACE_USED SPACE_RECLAIMABLE NUMBER_OF_FILES
----------- ---------- ----------------- ---------------
+DG_UAT_FLASH_01
1.1811E+11 3.0249E+10        2.7808E+10            1140

Step 4:  If SPACE_USED is equal to SPACE_LIMIT of db_recovery_file_dest, move the archive logs to different destination.

Step 5:  Archive all the log files

SQL> alter system archive log all;

Step 6:  Just switch the logs to verify:

SQL> alter system switch logfile;

Second Approach: Delete the Archive Log , when it is not needed to free up the DB_RECOVERY_FILE_DEST
Alternatively, we can solve this type of problem without increasing DB_RECOVERY_FILE_DEST_SIZE is to delete (archive log) files from DB_RECOVERY_FILE_DEST if we are sure we have backups and the archived logs are no longer necessary.

$rman target /
RMAN>delete archivelog until time 'SYSDATE-1';

Method 2:  By increasing DB_RECOVERY_FILE_DEST_SIZE.

Step 1:  See the path of flash recovery area.

SQL> show parameter db_recovery_file_dest;

Step 2: Disable the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='';

Step 3: Increase the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 200g;

Step 4: Enable the Flash Recovery Area

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = ‘+DG_UAT_FLASH_01’;

Friday, June 17, 2011

OEM OMS 10g Server Commands to start, stop and know the status (opmnctl)


Check status of the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl status

oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

Processes in Instance: EnterpriseManager0.omsrvrap.dbosmsrvr.siva.com
-------------------+--------------------+---------+---------
ias-component      | process-type       |     pid | status 
-------------------+--------------------+---------+---------
LogLoader          | logloaderd         |     N/A | Down   
HTTP_Server        | HTTP_Server        |    9146 | Alive  
dcm-daemon         | dcm-daemon         |     N/A | Down   
OC4J               | home               |    9147 | Alive  
OC4J               | OC4J_EM            |    9148 | Alive  
OC4J               | OC4J_EMPROV        |    9150 | Alive  
OC4J               | OCMRepeater        |    9151 | Alive  
WebCache           | WebCache           |    9152 | Alive  
WebCache           | WebCacheAdmin      |    9153 | Alive  
DSA                | DSA                |     N/A | Down   


Stop the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl stopall

oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

opmnctl: stopping opmn and all managed processes...

Start the GRID management server

1) export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn

2) cd $ORACLE_HOME/bin

3) ./opmnctl startall


oracle@omsrvrap$  export ORACLE_HOME=/app/oracle/product/10g/oms10g/opmn
oracle@omsrvrap$  cd $ORACLE_HOME/bin
oracle@omsrvrap$  opmnctl status

opmnctl: starting opmn and all managed processes...

OEM Grid 10g Agent commands to start, stop and know the status. ( emctl )

Oracle10g OEM GRID Agent ( emctl )Commands

Check status of the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl status agent

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./emctl status agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
---------------------------------------------------------------
Agent Version : 10.2.0.5.0
OMS Version : 10.2.0.5.0
Protocol Version : 10.2.0.5.0
Agent Home : /app/oracle/product/10g/agent10g
Agent binaries : /app/oracle/product/10g/agent10g
Agent Process ID : 20124
Parent Process ID : 20080
Agent URL : https://dbsrvr1.dbsrvr.siva.com:3872/emd/main/
Repository URL : https://hp6600ap.dbsrvr.siva.com:1159/em/upload
Started at : 2010-03-09 12:04:07
Started by user : oracle
Last Reload : 2010-03-09 12:08:39
Last successful upload : 2009-07-09 14:26:42
Total Megabytes of XML files uploaded so far : 291.89
Number of XML files pending upload : 0
Size of XML files pending upload(MB) : 0.00
Available disk space on upload filesystem : 35.13%
Last successful heartbeat to OMS : 2010-03-09 12:26:07
Agent is Running and Ready

STOP the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl stop agent

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ ./emctl stop agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Stopping agent ... stopped.


START the GRID control agent

1) export ORACLE_HOME=/app/oracle/product/10g/agent10g

2) cd $ORACLE_HOME/bin

3) ./emctl start agent

.

oracle@dbsrvr1$ export ORACLE_HOME=/app/oracle/product/10g/agent10g
oracle@dbsrvr1$ cd $ORACLE_HOME/bin
oracle@dbsrvr1$ /emctl start agent
Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.
Starting agent ................................ started.

Wednesday, June 15, 2011

ORA-00980: synonym translation is no longer valid

 

Error:  ORA-00980: synonym translation is no longer valid

Cause:

1. Synonym created on non-existing object by mistake.

2. The synonyms referencing the object is dropped but synonym is not dropped

3. Dropped a user, but the synonyms referencing the objects owned by that dropped user.

Query to find the invalid synonyms

select * from dba_synonyms s
where table_owner not in('SYSTEM','SYS')
and db_link is null
and not exists
(select 1
from dba_objects o
where s.table_owner=o.owner
and s.table_name=o.object_name);

select 'drop '||decode (s.owner,'PUBLIC','PUBLIC SYNONYM ','SYNONYM'||s.owner||'.')||s.synonym_name||';'
from dba_synonyms s
where table_owner not in('SYSTEM','SYS')
and db_link is null
and not exists
(select 1 from dba_objects o
where s.table_owner=o.owner
and s.table_name=o.object_name)

The query above generate the script to drop the synonyms whose translation is no longer valid

 

 

Wednesday, June 01, 2011

OEM Agent Log Files


The OEM Agent files are placed on AGENT_HOME/sysman/log/ by default.

OEM Agent Log File Management Agent log file emagent.log
OEM Agent Trace File Management Agent trace file emagent.trc
OEM Agent startup log file Management Agent startup log file emagent.nohup

Sunday, May 29, 2011

What is mounting the databases in Oracle?

After starting the instance, the Oracle software associates the instance with specific database. This is called mounting the database.

Oracle Database Memory Structure


image

Friday, May 27, 2011

ORA-00942: table or view does not exist or Warning: View altered with compilation errors.


Error:

SQL> ALTER VIEW HR.TMP_TABLE_REORG COMPILE;

Warning: View altered with compilation errors.

How to find out the cause:

Use the query below to find the query which makes the View

SQL> set long 10000
SQL> set pages 0
SQL> select dbms_metadata.get_ddl('VIEW','TMP_TABLE_REORG','HR') from dual;

Output will look like;

SQL>  select "TABLE_NAME","COLUMN_NAME","CONSTRAINT_NAME","T_TABLE_NAME","START_TIME  ","END_TIME","RELOAD_START_TIME","RELOAD_END_TIME","OBJECT_SIZE_MB","T_F_CW02TMP _MB","N_REQ_CW02TMP_MB","PRE_ORIG_ROWCNT","PRE_TMP_ROWCNT","POST_ORIG_ROWCNT","
P  OST_TMP_ROWCNT" from REORG_USR.tmp_table_reorg;
OST_TMP_ROWCNT" from REORG_USR.tmp_table_reorg

Try to run the “Select statement” which makes the query. You will get error message as; It means that physical table that view depends on does not exist cause the issue.

ORA-00942: table or view does not exist

Wednesday, May 25, 2011

ASM – Automatic Storage Management

 

ASM : is the vertical integration of File system and Volume Manager, specifically built for Oracle Database files.

Advantages:

  1. Dynamic storage management, without shut downs of the Oracle database, storage can be adjusted.
  2. I/O Load balancing : distribute the I/O Load across all available resource to optimize the performance, while removing the manual need.
  3. Provide fault tolerance by maintaining redundant copy of data, per file basis.
    Supports mirroring at file level not at volume level.
  4. Supports online disk reconfiguration and dynamic rebalancing
  5. stripes files not the logical volumes
  6. Supports RAC and eliminates need of
    Cluster File system or Cluster Logical Volume Manager.

image

ASM divides data files into extent. This extent is different from data file extent.
Spread each extents across all the disks. It uses indexes to track the placement of each extent.

Monday, May 23, 2011

Oracle Database Storage Structure

 

Oracle DB Storage Structure

image

Relationship of Database, Tablespace and Data files

image

 

How table data is stored in Oracle Database

image

Content of Database Data Block

image

How to find the instance names of ASM on the cluster nodes

 

crsctl status resource ora.asm –f | grep servername

How to current directory to be displayed in the prompt, while using ASMCMD command?

asmcmd –p

-p causes the current directory to be displayed in the prompt.

+ signs denotes the root directory

To list the Disk group details

 ASMCMD [+] > ls -l +

State    Type    Rebal  Name
MOUNTED  EXTERN  N      DG_Test_DATA_01/
MOUNTED  EXTERN  N      DG_Test_FLASH_01/

To list the sizing information for each Disk group

ASMCMD [+] > ls -s +

Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
  1024   4096  8388608   3407872   665384                0          665384              0  DG_Test_DATA_01/
  1024   4096  8388608    524288   152944                0          152944              0  DG_Test_FLASH_01/

To display the content of current directory and its subdirectory

ASMCMD [+] > ls *

To find  file name matching the given query
ASMCMD [+] > find + *.dbf

Friday, May 20, 2011

How to find the Oracle databases running in a Unix Server?

 

First Option:
It will list all the currently running instances

ps -eaf | grep pmon | grep -v grep | awk ' {print $9}' | cut -c10-18

Second Option:
Check for the Oratab entries

Difference between Oracle Database Crash and Oracle Instance Crash both in Standalone and RAC Environment

 

  Instance Crash Database Crash
RAC Instance and DB crash are different.

In RAC, there is not a single instance mounting the database. It's always more than one. Now, as long as you have at least one instance up and running and have the db opened via it, the other instance's crash is called instance crash only.
If all the instances of the cluster get crashed, it eventually would mean that the db has to go down , this would be called database crash.

Stand alone Instance and DB crash are same Instance and DB crash is one because, there would be just a single instance linked with a database. So if that crashes, you would have the db going down, aka, getting crashed as well.
Definition An instance crash will therefore mean that the crash occurs in the instance due to an Oracle bug or similar. In other words a s/w error and not a database error Database crash means that the database itself is damaged in some way. A disk is no more. Data files are corrupted. Etc. The database itself thus causes the crash - and a database crash will also cause all database instances (RAC or single) for that database to crash too.

Tuesday, May 17, 2011

Oracle Enterprise Manager – OEM

 

OEM Management Framework configuration consists of

  1. Managed Targets
  2. Management Services
  3. Grid Control
  4. DB Console
  5. Application Server Console


OEM Services in Windows.image

OEM DB Console in Unix

Start dbconsole

emctl start dbconsole

Stop dbconsole

emctl stop dbconsole

Status dbconsole

emctl status dbconsole

Accessing Enterprise Manager Database Control, using browser client

http://hostname:portnumber/em

Monday, May 16, 2011

ORA-19511: Error received from media manager layer

 

RMAN Backup Failed with

Error Message:
ORA-19506: failed to create sequential file, name="<SYS00S_1846:751266012:1:33>.df", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: Error received from media manager layer, error text:
   Vendor specific error: OB2_StartObjectBackup() failed ERR(-17)

Cause:
The root cause of the backup failures was that the VLS ran out of tapes. 

Resolution:
Free up tapes from expired backups or add new tapes. 
Reboot the VLS to get the backups working again.

How to find the Preferred node in Oracle RAC?

 

To find the preferred node in Oracle RAC from the configuration. It find the details from Oracle Cluster Registry (OCR). It displays the Oracle Restart configuration information

$ srvctl config service -d db01
db01_Kline PREF: db0101t1 AVAIL: db01t2
db01_watch PREF: db01t2 db01t1 AVAIL:

To find the status of the services, on which instances, it  is running

$ srvctl status service -d db01
Service db01_Kline is running on instance(s) db01t2
Service db01_watch is running on instance(s) db01t2, db01t1


To relocate the services from one node to another or one instance to another

srvctl relocate service -d db_unique_name -s service_name {-c source_node -n target_node | -i old_instance_name -t new_instance_name} [-f]


What is Service in Oracle RAC?

Services allow you granular definition of workload and the DBA can dynamically define which instances provide the service. Connection Load Balancing (provided by Oracle Net Services) still needs to be set up to allow the user connections to be balanced across all instances providing a service.

Wednesday, May 11, 2011

GV$ Views on Oracle RAC


When administrating a RAC system use the dictionary views of GV$ and not V$.
GV$ has additional columns inst_id .

For almost every V$ view described in this chapter, Oracle has a corresponding GV$ (global V$) view. In Real Application Clusters, querying a GV$ view retrieves the V$ view information from all qualified instances.

In addition to the V$ information, each GV$ view contains an extra column named INST_ID of datatype NUMBER. The INST_ID column displays the instance number from which the associated V$ view information was obtained. The INST_ID column can be used as a filter to retrieve V$ information from a subset of available instances

GV$ V$
Across all the nodes:
The beauty of system dictionary views of GV$ which reflect information across the various nodes of a RAC system
Only the current node
The V$ views of the data dictionary, which relate to the current status of the single node you are connected to

For example;

select distinct(username) from v$session;

It only reflects connections to the connected node and not the entire RAC.
Whereas;

select distinct(username) from gv$session;


It gives the view of all sessions within the RAC.
The GV$ dictionary views have the additional INST_ID column which give the node that the action is occurring in

How to reset the Unix Prompt to default? ( PS1)


How do I get my prompt to show the current directory, like on DOS?

PS1 – stands for Prompt String 1

In korn shells

PS1='$PWD$ '


in Bourne shells

PS1="`pwd` "

Tuesday, May 10, 2011

WARNING: db_recovery_file_dest is same as db_create_online_log_dest_2

 

The warning message on Alert log file mean both the FRA – Flash Recovery Area and Online Log are same.

It can be verified by

SQL> show parameter recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +DG_DEV_FLASH_01
db_recovery_file_dest_size         big integer 220G
recovery_parallelism                 integer     0

SQL> show parameter online

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_online_log_dest_1          string      +DG_DEV_DATA_01
db_create_online_log_dest_2          string      +DG_DEV_FLASH_01
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string

Are Oracle instances down on the host?


This script would be of useful as a Pre-Check for Patching and Linking

#!/bin/sh
cat <<eof
Check if Oracle Down?
Pre-Check for Patching and Linking
Remember to also stop all cron and scheduled jobs
eof
ps -ef|egrep -i "oracle| sqlplus| rman| sqlldr| imp| exp| impdp| expdp| dgmgrl|tnslsnr|fastreader"

Monday, May 09, 2011

How to find if the instance using PFILE or SPFILE?

 

Execute the following query to see if the instance was started with a PFILE or SPFILE:

SELECT value, DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"
FROM sys.v_$spparameter WHERE name = 'spfile';

Wednesday, May 04, 2011

drop database command


The Drop Database command, that made a fast and efficient cleanup of all files below in one command.

  1. Data files
  2. Redo logs
  3. Control files
  4. spfile  -  If the database used a server parameter file (spfile), it is also deleted

Archived logs and backups are not removed, but you can use Recovery Manager (RMAN) to remove them.

Drop database do require to mount the database in exclusive restricted mode, that made quite difficult to execute it by mistake on the wrong database.

The steps are as follows:

shutdown abort;
startup mount exclusive restrict;
drop database;

This is a sample session using this feature:

1) Check Datafile, Controlfile and Online log names before drop database

  select name from v$database;
  select name from v$datafile;
  select member from v$logfile;
  select name from v$controlfile;

2) Drop Database

shutdown abort
ORACLE instance shut down.
startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area  989855744 bytes
Fixed Size                  2077552 bytes
Variable Size             864029840 bytes
Database Buffers          117440512 bytes
Redo Buffers                6307840 bytes
Database mounted.
drop database;
Database dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options

3) Check Datafile/Redologs/Controlfile after drop database

 ls -ltr

Tuesday, April 26, 2011

Error: ORA-04031

 

Error:
ORA-04031: unable to allocate 67280 bytes of shared memory ("large pool","unknown object","large pool","PX msg pool")

Cause:
An ORA-04031 error occurs in any of the memory pools in the SGA when Oracle cannot find a memory chunk large enough to satisfy an internal allocation request on behalf of a user's operation.

Resolution:

1. Increased the SGA_TARGET value.
2. Changed cursor_sharing parameter to SIMILAR
3. Recommended using bind variables instead of literals.

Saturday, April 16, 2011

Oracle 11g New features

 

11g New features Basic Testing Advanced Testing On Demand comments
11g New DBA Features        
Partitioning for tables X     Interval, system, Composite, virtual column, reference
New load balancing utilities X     web-server, listener
New table Data Type "simple_integer" X      
Improved table/index compression X      
Faster DML triggers X      
Improved NFS data file management X      
Server side connection pooling X      
Incident Packaging Service (IPS) X      
Feature Based Patching X      
New parameters & deprecated and obsolete parameters X      
11g High Availability & RAC new features        
Oracle 11g RAC parallel upgrades   X    
Oracle RAC load balancing advisor   X    
ADDM for RAC   X    
Optimized RAC cache fusion protocols   X    
Hot patching If available If available   Oracle has not created any required patches using "hot Patching"
Data Guard supports "Flashback Standby". X X    
Data Guard Load Balancing   X    
Streams enhancements   X    
11g language & PL/SQL New Features        
PL/SQL "continue" keyword X      
Disabled state for PL/SQL X      
Improved native Java & PL/SQL compilers. X      
Easy PL/SQL compiling X      
Oracle 11g XML Enhancements & data storage X      
Improved PL/SQL stored procedure X      
object-oriented DDL keyword X      
New Trigger features X      
New high-performance LOB features. X      
Enhanced Read only tables X      
Table trigger firing order X      
Oracle 11g SQL New Features        
The /*+result_cache*/ SQL hint X      
XML SQL queries X      
SQL Replay X      
Improved optimizer statistics collection speed X      
SQL execution Plan Management X      
Dynamic SQL X      
Fully Automatic SQL Tuning X      
Improved SQL Access Advisor X      
New Oracle11g Performance and Tuning X      
SQL Performance Analyzer (SPA) X      
Multi-column hybrid histograms X      
CBO correlating statistics X      
Automatic Diagnostic Repository (ADR) X      
Automatic Memory Tuning X      
Resource Manager X      
ADDM for RAC X X    
Faster sorting X      
SQL Plan Manageability (SQL Plan baselines) X      
AWR Baselines X      
Oracle 11g Security & Auditing new features        
Database Replay X      
Secure Passwords X      
Auditing Defaults in 11g X      
RMAN Catalog Security Model     X  
Database Administrator Security Setup X      
Transparent Data Encryption (TDE) enhancements     X  
TDE and Logminer     X  
Encrypted Tablespaces     X  
Encrypted LOB columns using Oracle SecureFiles     X  
Hardware Secure Module versus Oracle Wallet     X  
TDE and Logical Standby Database     X  
FGAC for UTL_SMTP, UTL_TCP and UTL_HTTP     X  
VPD configuration     X  
Application Contexts configuration     X  
11g Flashback New Features        
Optimized UNDO BACKUP X      
Tracking transactional changes using FLASHBACK DATA X      
Flashback Data Archive X      
Flashing back transactions:using DBMS_FLASHBACK X      
11g ASM enhancements        
ASM Fast Mirror Resync-not for external   X    
ASM Preferred Mirror Read   X    
ASM Performance Enhancements-increase extents size   X    
ASM Disk Group compatibility-db and asm level   X    
ASM Disk Group Checks enhanced   X    
SYSASM ROLE on ASM instance   X    
ASMCMD new features   X    
11g RMAN enhancements        
RMAN Compatibility 10g and 11g X      
Duplicate target DB from active DB X      
Create Standby from duplicate command X      
Merge Catalog functionality X      

Sunday, April 10, 2011

ORA-28031: maximum of 148 enabled roles exceeded

Error :

While connect to database as a normal user it fails with
ORA-28031: maximum of 148 enabled roles exceeded

Cause:

In a database at one time 148 user-defined roles can be enabled. Enabling more than 148 user-defined roles causes ORA-28031.

Resolution

At first time you can think about max_enabled_roles parameter but max_enabled_roles parameter has nothing to do if you enable 148 user-defined roles.

Possible that Data Import may also cause this.

In fact this parameter is deprecated. It is retained for backward compatibility only. You can see this parameter settings by,

SQL> show parameter max_enable
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
max_enabled_roles integer 150

Though this parameter is set to 150 and you have enabled 148 user defined roles but additional user-defined roles can't be enabled because of the actual number of roles that users can enable is 148. So max_enabled_roles is 2 plus 148, because each user has two additional roles, PUBLIC and the user's own role.
As there is limit to 148 so you have to disable fewer roles or drop some roles and reorganize your database role policy.

You can enable or disable roles by using the SET ROLE statement for your current session. Also regroup the roles.

Oracle Alert Monitoring

 

Here is the list of Alters in general to be considered for Oracle Alerts Monitoring.

Severity Oracle MessageNo Message

critical

ORA-00376 file %s cannot be read at this time
critical ORA-00449 background process '%s' unexpectedly terminated with error %s
critical ORA-00490 PSP process terminated with error
critical ORA-00600 internal error code, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]
critical ORA-01110 data file %s: '%s'
critical ORA-01113 file %s needs media recovery
critical ORA-01114 IO error writing block to file %s (block # %s)
critical ORA-01115 IO error reading block from file %s (block # %s)
critical ORA-01122 database file %s failed verification check
critical ORA-01157 cannot identify/lock data file %s - see DBWR trace file
critical ORA-01171 datafile %s going offline due to error advancing checkpoint
critical ORA-01186 file %s failed verification tests
critical ORA-01208 data file is an old version - not accessing current version
critical ORA-12535 TNS:operation timed out
critical ORA-01251 Unknown File Header Version read for file number %s
critical ORA-01259 unable to delete datafile %s
critical ORA-01578 ORACLE data block corrupted (file # %s, block # %s)
critical ORA-1632 max # extents (%s) reached in index %s.%s
critical ORA-1652 unable to extend temp segment by %s in tablespace %s
critical ORA-1653 unable to extend table %s.%s by %s in tablespace %s
critical ORA-01658 unable to create INITIAL extent for segment in tablespace %s
critical ORA-16038 log %s sequence# %s cannot be archived
critical ORA-1683 unable to extend index %s.%s partition %s by %s in tablespace %s
critical ORA-01688 unable to extend table %s.%s partition %s by %s in tablespace %s
critical ORA-02068 following severe error from %s%s
critical ORA-03113 end-of-file on communication channel
critical ORA-04031 unable to allocate %s bytes of shared memory (\%s\",\"%s\",\"%s\",\"%s\")"
critical ORA-07445 exception encountered: core dump [%s] [%s] [%s] [%s] [%s] [%s]
critical ORA-17500 ODM err:%s
critical ORA-17502 ksfdcre:%s Failed to create file %s
critical ORA-17503 ksfdopn:%s Failed to open file %s
critical ORA-19504 failed to create file \%s\""
critical   terminating instance due to error
critical   PMON failed to acquire latch, see PMON dump
     
warning ORA-  
     
exclude ORA-00001 Unique constraint violated
exclude ORA-00028 your session has been killed
exclude ORA-00060 deadlock detected while waiting for resource
exclude ORA-00601 cleanup lock conflict
exclude ORA-00604 error occurred at recursive SQL level %s
exclude ORA-00918 column ambiguously defined
exclude ORA-01001 invalid cursor
exclude ORA-01013 user requested cancel of current operation
exclude ORA-01017 invalid username/pwd; logon denied
exclude ORA-01034 oracle not available
exclude ORA-01089 immediate shutdown in progress
exclude ORA-01119 error in creating database file '%s'
exclude ORA-01403 no data found
exclude ORA-01551 extended rollback seg, pinned blocks released
exclude ORA-01555 snapshot too old
exclude ORA-01575 timeout waiting for space mgmt resource
exclude ORA-01591 lock held by in-doubt distributed transaction
exclude ORA-01595 error freeing extent %s of rollback seg %s
exclude ORA-01634 rollback seg number '%s' is about to go offline
exclude ORA-01722 invalid number
exclude ORA-01841 (full) year must be between -4713 and +9999, and not be 0
exclude ORA-01843 not a valid month
exclude ORA-02050 transaction %s rolled back, some remote DBs may be in-doubt
exclude ORA-02052 remote transaction failure at %s
exclude ORA-02063 preceding %s%s from %s%s (error recvd from remote db link)
exclude ORA-02067 transaction or savepoint rollback required
exclude ORA-02068 following severe error from %s%s (a severe error recvd from indicated db link)
exclude ORA-02091 transaction rolled back
exclude ORA-02291 integrity constraint violated - parent key not found
exclude ORA-03106 fatal two-task communication protocol error
exclude ORA-03113 end-of-file on communication channel
exclude ORA-03297 file contains used data beyond requested RESIZE value
exclude ORA-04060 insufficient privs to execute stored proc
exclude ORA-04061 existing state of stored proc has been invalidated
exclude ORA-04062 timestamp of stored proc has been changed
exclude ORA-04063 object has errors
exclude ORA-04064 not executed, invalidated stored proc
exclude ORA-04065 not executed, altered or dropped stored proc
exclude ORA-04066 non-executable object
exclude ORA-04067 not executed, stored proc does not exist
exclude ORA-04068 existing state of packages has been discarded
exclude ORA-06508 PL/SQL: could not find program unit being called
exclude ORA-06512 at %s line %s (backtrace msg as the stack is unwound by unhandled exeptions)
exclude ORA-1031 insufficient privs (an attempt was made to chg the current username/pwd)
exclude ORA-10387 parallel query server interrupt (normal)
exclude ORA-1142 cannot end online bkup - none of the files are in bkup mode
exclude ORA-1146 cannot start online bkup - file is already in bkup mode
exclude ORA-12008 error in snapshot refresh path
exclude ORA-12012 error on auto execute of job %s
exclude ORA-12203 TNS: unable to connect to destination
exclude ORA-12535 TNS: operation timed out
exclude ORA-1537 cannot add datafile %s - file already part of db
exclude ORA-1636 rollback seg %s is already online
exclude ORA-29549 class %s.%s has changed, Java session state cleared
exclude ORA-3217 invalid option for alter of TEMPORARY TABLESPACE
exclude ORA-959 tablsp %s does not exist
exclude ORA-00600 internal error code, arguments: [12235] Oracle process has no purpose in life.