Ask The Real Tom

July 30, 2010



Oracle ASM Disk Overview

Filed under: oracle — Tags: , , , , — tkalo @ 3:38 pm

I’ve wrote a simple SQL script to list all ASM disks with state, size and their diskgroups, if any.

set pages 5000 lines 180
set heading on
set feedback off
set serveroutput on

col LABEL for a28
col DISKGROUP for a9
col STATUS for a9
col TOTAL for a11
col MOUNT_STATE for a11

exec dbms_output.put_line('---');
exec dbms_output.put_line('--- DISK OVERVIEW');
exec dbms_output.put_line('---');

SELECT
        D.LABEL||' ('||D.NAME||')' LABEL,
        (SELECT
          NAME
         FROM
          V$ASM_DISKGROUP
         WHERE
          GROUP_NUMBER=D.GROUP_NUMBER)
        DISKGROUP,
        D.STATE STATUS,
        lpad(D.TOTAL_MB/1024,6)||' GB' TOTAL,
        D.MOUNT_STATUS MOUNT_STATE
FROM
        V$ASM_DISK D
ORDER BY 2;

exec dbms_output.put_line('---');
set feedback on

The output looks as follow:

---
--- DISK OVERVIEW
---

LABEL                        DISKGROUP STATUS    TOTAL       MOUNT_STATE
---------------------------- --------- --------- ----------- -----------
ORAASM1 (ORAASM1)            DG1       NORMAL    99.984 GB   CACHED
ORAASM3 (ORAASM3)            DG1       NORMAL    99.984 GB   CACHED
ORAASM5 (ORAASM5)            DG1       NORMAL    99.984 GB   CACHED
ORAASM4 (ORAASM4)            DG1       NORMAL    99.984 GB   CACHED
ORAASM2 (ORAASM2)            FRA1      NORMAL    99.984 GB   CACHED
ORAASM6 ()                             NORMAL         0 GB   CLOSED
---

July 29, 2010



Set lock_sga to true on Linux (SLES)

Filed under: Uncategorized, oracle — Tags: , , — admin @ 1:01 pm

To lock the SGA into physical memory you have to set the lock_sga parameter to true.

Usually you get following Error message.

SQL> startup
SQL> ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory

The problem it ulimit -l
You have to set it in /etc/security/limits.conf and relogon to the system and restart database.

cat /etc/security/limits.conf
...
oracle soft memlock unlimited
oracle hard memlock unlimited


alter system set lock_sga=true scope=spfile;
shutdown immediate
startup

And you SGA stays in physical memory.

If you SGA gets pages out you will encounter following waits.
Wait Event: latch: shared pool

July 28, 2010



Enable and Validate Constraints in Parallel (Oracle)

Enabling and validating constraints is can take a huge amount of time in big oracle databases.
To speed the validaten up, it can be done in parallel.

This can save you valuable time in release windows.

  1. Enable Constraint with novalidate option
  2. Set parallel degree on the table or on session with force ddl parallel
  3. Enable nable the constraints with validation

Example:

ALTER TABLE T_1 ADD CONSTRAINT NC_1 not null (colname) disabled;
ALTER TABLE T_1 ENABLE NOVALIDATE CONSTRAINT NC_1;
ALTER SESSION FORCE PARALLEL DDL PARALLEL 8;
ALTER TABLE T_1 PARALLEL 8;
ALTER TABLE T_1 ENABLE VALIDATE CONSTRAINT NC_1;
ALTER SESSION DISABLE PARALLEL DDL;



ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device

Problem:


SQL> startup nomount
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device

There are 64G physical memoray avaliable.

shmmax is set to 52G

But still its not possibel to start the Oracle instance with more than 30G SGA.

Solution:

kernel.shmall is set to small.


cat /proc/sys/kernel/shmall
8248733
getconf PAGE_SIZE
4096

This means that only 8248733 memory pages can be allocate.

4096 x 8248733 = 32G



To allocate 50G we need to set shmall to at least 13107200

July 15, 2010



ORA-56708: Could not find any datafiles with asynchronous i/o capability

Filed under: oracle — Tags: , , , — admin @ 8:57 am

I tried to run IO calibrate to check what the system is able to handle.
But I run into following error (using ASM / ASMlib)


ORA-56708: Could not find any datafiles with asynchronous i/o capability
ORA-06512: at "SYS.DBMS_RMIN", line 456
ORA-06512: at "SYS.DBMS_RESOURCE_MANAGER", line 1285
ORA-06512: at line 6

The ASM files show ASYNC_ON

SELECT name, asynch_io
FROM v$datafile f,v$iostat_file i
WHERE f.file# = i.file_no
AND filetype_name = 'Data File'
/
+DG1/xxxx/datafile/system.260.721649043
ASYNC_ON
....

did not help as well

alter system set filesystemio_options=setall scope=spfile;
shutdown immediate
startup

I guess that the problem is that moste datafiles (smallfiles) are full (max. number of blocks). So the io calibrate tool can not write to this files.

System aio slots:

To find out the maximum avalable asynch I/O slots:
$ cat /proc/sys/fs/aio-max-nr
65536

To find out how many are being used:
$ cat /proc/sys/fs/aio-nr

increase fs.aio-max-nr if nessesary (or restart some db's)
65536

June 22, 2010



ORA-31623: a job is not attached to this session via the specified handle

Filed under: oracle — Tags: , , , , , , — tkalo @ 11:23 am

We recently faced a strange error when trying to import a schema through a database link on 11gR2.

shell> impdp system/*** SCHEMAS=LFXQAA02 directory=DATA_PUMP_DIR LOGFILE=liflexdp1.log NETWORK_LINK=tliflex01.world PARALLEL=2

Import: Release 11.2.0.1.0 - Production on Tue Jun 22 11:07:58 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning and Automatic Storage Management options

UDI-31623: operation generated ORACLE error 31623
ORA-31623: a job is not attached to this session via the specified handle
ORA-06512: at “SYS.DBMS_DATAPUMP”, line 3263
ORA-06512: at “SYS.DBMS_DATAPUMP”, line 4488
ORA-06512: at line 1

After serval approaches we found out that streams_pool_size=0 was set.

alter system set streams_pool_size=40M scope=spfile;

restart DB and run import again..

There is also a Metalink note on this topic: 1080775.1

April 14, 2010



How do I find the device for a ASMLIB disk

Filed under: oracle — Tags: , , — admin @ 10:00 am

Just lookup the minor, major id.


oracle@server1:/u00/app/oracle/ [grid11201] ll /dev/oracleasm/disks/
total 0
drwxr-xr-x 1 root root 0 2009-12-18 14:31 .
drwxr-xr-x 4 root root 0 2009-12-18 14:31 ..
brw-rw—- 1 oracle dba 253, 19 2009-12-18 14:31 ORAASM1
brw-rw—- 1 oracle dba 253, 20 2009-12-18 14:31 ORAASM2

oracle@server1:/u00/app/oracle/ [grid11201] ll /dev/dm-*|grep ‘253, 19′
brw-r—– 1 root disk 253, 19 2009-12-18 14:31 /dev/dm-19

oracle@server1:/u00/app/oracle/ [grid11201] ll /dev/disk/by-id/ |grep dm-19
lrwxrwxrwx 1 root root 11 2009-12-18 14:31 scsi-sanvg-oraasm01 -> ../../dm-19

March 12, 2010



Quick Help: TNS - 12519 TNS: no appropriate service handler found

Filed under: oracle — Tags: , , , , — admin @ 4:35 pm

If you get a “TNS - 12519 TNS: no appropriate service handler found” the very first thing to check is the max session/processes.

select * from v$resource_limit

RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU
------------------------------ ------------------- --------------- ---------- ----------
processes                                       47             300        300        300
sessions                                        52             309        335        335
enqueue_locks                                   34              91       5008       5008
enqueue_resources                               53             260       2514  UNLIMITED
ges_procs                                        0               0          0          0
ges_ress                                         0               0          0  UNLIMITED
ges_locks                                        0               0          0  UNLIMITED
ges_cache_ress                                   0               0          0  UNLIMITED
ges_reg_msgs                                     0               0          0  UNLIMITED
ges_big_msgs                                     0               0          0  UNLIMITED
ges_rsv_msgs                                     0               0          0          0
gcs_resources                                    0               0          0          0
gcs_shadows                                      0               0          0          0
dml_locks                                       59             454       1472  UNLIMITED
temporary_table_locks                            0              23  UNLIMITED  UNLIMITED
transactions                                  1409            1442        368  UNLIMITED
branches                                         0              16        368  UNLIMITED
cmtcallbk                                        0               3        368  UNLIMITED
sort_segment_locks                               0              40  UNLIMITED  UNLIMITED
max_rollback_segments                           29              58        368      65535
max_shared_servers                               1               1  UNLIMITED  UNLIMITED
parallel_max_servers                             0               8          8       3600

As it is visible at MAX_UTILIZATION for processes the maximum processes was once reached.

Just increase it an restart your database.

alter system set processes=600

January 4, 2010



Oracle Flashback Archive (Total Recall) Problems

Filed under: Uncategorized, oracle — Tags: , , , , , — admin @ 1:42 pm

Oracle Flashback Archive offers simple archiving with simple administration.
During some testing on Oracle 11.2 with Flashback Archive I exprerianced some heavy problems.

The day began with a simple testcase:

create user tkrim identified by tkrim1;
grant connect to tkrim;
grant resource to tkrim;
grant FLASHBACK ARCHIVE administer to tkrim;

connect tkrim/tkrim1

col scn for 999999999999999999999999

create table demo (id number, val varchar(200) ) ;
ALTER TABLE demo FLASHBACK ARCHIVE fla1;

insert into demo values (1,'test1');
insert into demo values (2,'test2');
insert into demo values (3,'test3');
commit;

select dbms_flashback.get_system_change_number scn from dual;

update demo set val='abc1' where id=1;
update demo set val='abc2' where id=2;
update demo set val='abc3' where id=3;
commit;

select dbms_flashback.get_system_change_number scn from dual;

delete from demo where id=3;
commit;

select dbms_flashback.get_system_change_number scn from dual;

select * from demo;

select * from demo as of scn 55710824751 ;

After a my UNDO tablespace was full I played a bit with undo_retention and changing the undo tablespace which case following error.


ORA-01555 caused by SQL statement below (SQL ID: 1p36ta7p3d7fu, Query Duration=0 sec, SCN: 0x000c.f7ca7c8f):
select file#, block#, ts#, blocks from seg$ where type# = 3
ORA-01555 caused by SQL statement below (SQL ID: 1p36ta7p3d7fu, Query Duration=1 sec, SCN: 0x000c.f7ca7d8f):
select file#, block#, ts#, blocks from seg$ where type# = 3
ORA-01555 caused by SQL statement below (SQL ID: 1p36ta7p3d7fu, Query Duration=0 sec, SCN: 0x000c.f7ca7ee1):
select file#, block#, ts#, blocks from seg$ where type# = 3

Somehow not really bulletprof, this oracle falshback archive.
Anyway the real trouble started when i tried to drop the user and the flashback archive.


ALTER TABLE demo NO FLASHBACK ARCHIVE;

Worked, but leafes some tables named like TKRIM.SYS_FBA_HIST_* and SYS_FBA_TCRV_*.

At this stage it’s impossible to drop the Flashback archive tablepspace or the user tkrim aswell this tables.

After doing some hacks

SELECT o.object_id, o. owner, o.object_name, t.property
FROM dba_objects o, tab$ t
WHERE o.object_type = 'TABLE'
AND o.object_id = t.obj#
AND t.property = 9126805504;

UPDATE tab$
SET property = 536870912
WHERE property = 9126805504;

COMMIT;

I was able to drop the table SYS_FBA_TCRV_*.

But it was still impossible to drop the HIST Table.


SQL > drop table TKRIM.SYS_FBA_HIST_15517640;
drop table TKRIM.SYS_FBA_HIST_15517640
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [ktadrprc-1], [], [], [], [], [],
[], [], [], [], [], []

At the end I was not able to cleanup the flashback archive or the user.

December 8, 2009



Just a hint for ASM on Oracle 11.2

Filed under: oracle — Tags: , , , — admin @ 12:51 pm

Until 11.1 the oracle ASM binaries have been on the Oracle Database CD.

With 11.2 the ASM binaries are on the Oracle Grid Infrastructure CD. (Search about 2 houers to find that)
Does anyone know if its stated cleary on the oracle documentation? I could not find it.

Older Posts »

Powered by WordPress