July 25, 2015

How to add ASM disk to ASM Diskgroup

1. Login to the ASM instance

-bash-3.2$ ps -ef|grep pmon
oracle    1829     1  0 Jul21 ?        00:04:58 ora_pmon_PROD1
oracle    9529  8780  0 21:18 pts/0    00:00:00 grep pmon
oracle   16319     1  0  2014 ?        00:10:46 asm_pmon_+ASM1

-bash-3.2$ . oraenv
ORACLE_SID = [oracle] ? +ASM1
The Oracle base has been set to /u01/oracle/product
-bash-3.2$
-bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 24 21:18:43 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

2. Identify the disks to be added to the ASM diskgroup

SQL> select name,group_number,state,total_mb/1024 "Totalspace(GB)",free_mb/1024 "Freespace(GB)", (free_mb/total_mb)*100 "PCT_FREE" from v$asm_diskgroup;

NAME                 GROUP_NUMBER STATE       Totalspace(GB) Freespace(GB)   PCT_FREE
--------------------- ------------ ----------- -------------- ------------- ----------
SIVA_DBF01                               8 MOUNTED               600    82.396484 13.6675571

SQL> col path for a45
Select path,group_number,disk_number,mount_status,header_status,os_mb/1024,total_mb/1024,free_mb/1024 from v$asm_disk where group_number=&n;
Enter value for n: 8
old   1: Select path,group_number,disk_number,mount_status,header_status,os_mb/1024,total_mb/1024,free_mb/1024 from v$asm_disk where group_number=&n
new   1: Select path,group_number,disk_number,mount_status,header_status,os_mb/1024,total_mb/1024,free_mb/1024 from v$asm_disk where group_number=8

PATH                                          GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU OS_MB/1024 TOTAL_MB/1024 FREE_MB/1024
--------------------------------------------- ------------ ----------- ------- ------------ ---------- ------------- ------------
ORCL:SIVA_ASM01                                         8          01 CACHED  MEMBER              200           200   28.7119141
ORCL:SIVA_ASM02                                         8          02 CACHED  MEMBER              200           200   28.7089844
ORCL:SIVA_ASM03                                         8          03 CACHED  MEMBER              200           200   28.7207031

SQL> Select path,group_number,disk_number,mount_status,header_status,os_mb/1024,total_mb/1024,free_mb/1024 from v$asm_disk where header_status <>'MEMBER';

PATH                                          GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU OS_MB/1024 TOTAL_MB/1024 FREE_MB/1024
--------------------------------------------- ------------ ----------- ------- ------------ ---------- ------------- ------------
ORCL:SIVA_ASM04                                         0           4 CLOSED  PROVISIONED         200             0            0
ORCL:SIVA_ASM05                                         0           5 CLOSED  PROVISIONED         200             0            0
ORCL:SIVA_ASM06                                         0           6 CLOSED  PROVISIONED         200             0            0

3. Add the disk to the Diskgroup

SQL> alter diskgroup SIVA_DBF01 add disk 'ORCL:SIVA_ASM04' name SIVA_ASM04 size 204800m;
alter diskgroup SIVA_DBF01 add disk 'ORCL:SIVA_ASM04' name SIVA_ASM04 size 204800m
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15260: permission denied on ASM disk group

Note:
****
For adding a disk to the diskgroup you need to login as a SYSASM not SYSDBA.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

-bash-3.2$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Fri Jul 24 21:24:33 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options


SQL> alter diskgroup SIVA_DBF01 add disk 'ORCL:SIVA_ASM04' name SIVA_ASM04 size 204800m rebalance power 4;

Diskgroup altered.

SQL>  select * from v$asm_operation;

GROUP_NUMBER OPERA STAT      POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- --------------------------------------------
           8 REBAL RUN           4          4        972     154322       4344          35


Happy Learning :)









July 4, 2015

ORA-20 Maximum number of processes(150) exceeded

SQL> select status,count(*) from v$session group by status;

STATUS     COUNT(*)
-------- ----------
ACTIVE           43
INACTIVE        354

SQL> select * from v$resource_limit where resource_name in ('sessions','processes');

RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_ALLOCATION             LIMIT_VALUE
------------------------------ ------------------- --------------- ------------------------------ ------------------------------
processes                                      403             435        500                            500
sessions                                       421             530        792                            792

SQL> select username,status,count(*) from v$session group by username,status;

USERNAME                       STATUS     COUNT(*)
------------------------------ -------- ----------
PROD_101                INACTIVE         27
CRM_USER                        INACTIVE          3
SYS                            ACTIVE            1
ORDM                            INACTIVE          1
DBSNMP                         INACTIVE          2
ORDM_TEST                     INACTIVE         38

KZAENGER                       INACTIVE          4
RTALBOOM                       INACTIVE          1

CPINEDA                        INACTIVE          1
GROMERO                        INACTIVE          2
ORDM_UAT                       INACTIVE        275
PUBLIC                         INACTIVE          1

12 rows selected.

SQL> select count(*) from v$session where last_call_et>3600 and username='ORDM_UAT';

  COUNT(*)
----------
202


From the above result we can understand that there are 202 sessions are in inactive state more than half an hour.
If we kill the sessions then the issue will resolved (But confirm with the application team before killing the sessions)

July 1, 2015

Upload timed out before completion. Agent upload status failed

bash-4.1$  ./emctl upload agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error:full upload has failed: Upload Recent Sending Statistics
________________________________

Avg send time=0.0 milliseconds
Backoff Event List
________________________________
Upload Failure List
_______________________________
Connection Event List
_____________________________
Upload timed out before completion.
Number of files to upload before the uploadNow call: 4903, total size (MB): 3.049202
Remaining number of files to upload: 4903, total size (MB): 3.049202 (TIMEOUT)

When you got the above error we need to do the as the below.

-bash-4.1$ emctl stop agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
Stopping agent ..... stopped.
-bash-4.1$ pwd
/u01/app/oracle/product/agent12c/agent_inst/sysman/emd

you need to move the upload,colletction and state folders as stated the below.

-bash-4.1$ ls -ltrh
total 72K
drwxr-----  2 oracle dba 4.0K Sep 16  2014 dumps
drwxr-----  4 oracle dba 4.0K Sep 16  2014 upload
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricExtLib
drwxr-----  2 oracle dba 4.0K Sep 16  2014 attachmentDB
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricCache
drwxr-----  2 oracle dba 4.0K Sep 16  2014 temp
drwxr----- 12 oracle dba 4.0K Dec 10  2014 state
-rw-r-----  1 oracle dba 5.9K Apr  8 15:32 targets.xml.bak
-rw-r-----  1 oracle dba  910 Jun 26 22:10 blackouts.xml.bak
-rw-r-----  1 oracle dba   13 Jun 27 00:46 blackouts.xml
-rw-r-----  1 oracle dba 3.1K Jun 30 09:06 emagent_storage.config
-rw-r-----  1 oracle dba 5.9K Jul  1 03:48 targets.xml
-rw-r-----  1 oracle dba    0 Jul  1 03:48 blackouts.lck
-rw-r-----  1 oracle dba  282 Jul  1 04:01 agntstmp.txt.bak
drwxr-----  2 oracle dba 4.0K Jul  1 04:03 collection
-rw-r-----  1 oracle dba   23 Jul  1 04:03 ag_current_status.msg
-rw-r-----  1 oracle dba  321 Jul  1 04:03 agntstmp.txt
-bash-4.1$ cd upload
-bash-4.1$ ls -ltrh
total 16K
drwxr----- 10 oracle dba 4.0K Sep 16  2014 upload
drwxr-----  2 oracle dba  12K Jul  1 04:03 pending
-bash-4.1$ mkdir old
-bash-4.1$ pwd
/u01/app/oracle/product/agent12c/agent_inst/sysman/emd/upload
-bash-4.1$ mv upload /u01/app/oracle/product/agent12c/agent_inst/sysman/emd/upload/old
-bash-4.1$ mv pending /u01/app/oracle/product/agent12c/agent_inst/sysman/emd/upload/old
-bash-4.1$ ls -ltrh
total 4.0K
drwxr-xr-x 4 oracle dba 4.0K Jul  1 04:05 old
-bash-4.1$ cd ..
-bash-4.1$ ls -ltrh
total 72K
drwxr-----  2 oracle dba 4.0K Sep 16  2014 dumps
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricExtLib
drwxr-----  2 oracle dba 4.0K Sep 16  2014 attachmentDB
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricCache
drwxr-----  2 oracle dba 4.0K Sep 16  2014 temp
drwxr----- 12 oracle dba 4.0K Dec 10  2014 state
-rw-r-----  1 oracle dba 5.9K Apr  8 15:32 targets.xml.bak
-rw-r-----  1 oracle dba  910 Jun 26 22:10 blackouts.xml.bak
-rw-r-----  1 oracle dba   13 Jun 27 00:46 blackouts.xml
-rw-r-----  1 oracle dba 3.1K Jun 30 09:06 emagent_storage.config
-rw-r-----  1 oracle dba 5.9K Jul  1 03:48 targets.xml
-rw-r-----  1 oracle dba    0 Jul  1 03:48 blackouts.lck
-rw-r-----  1 oracle dba  282 Jul  1 04:01 agntstmp.txt.bak
drwxr-----  2 oracle dba 4.0K Jul  1 04:03 collection
-rw-r-----  1 oracle dba   23 Jul  1 04:03 ag_current_status.msg
-rw-r-----  1 oracle dba  321 Jul  1 04:03 agntstmp.txt
drwxr-----  3 oracle dba 4.0K Jul  1 04:05 upload
-bash-4.1$ cd collection

-bash-4.1$ mkdir old
-bash-4.1$ mv * old
mv: cannot move `old' to a subdirectory of itself, `old/old'
-bash-4.1$ ls -ltrh
total 4.0K
drwxr-xr-x 2 oracle dba 4.0K Jul  1 04:05 old
-bash-4.1$ cd ..
-bash-4.1$ ls -ltrh
total 72K
drwxr-----  2 oracle dba 4.0K Sep 16  2014 dumps
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricExtLib
drwxr-----  2 oracle dba 4.0K Sep 16  2014 attachmentDB
drwxr-----  2 oracle dba 4.0K Sep 16  2014 metricCache
drwxr-----  2 oracle dba 4.0K Sep 16  2014 temp
drwxr----- 12 oracle dba 4.0K Dec 10  2014 state
-rw-r-----  1 oracle dba 5.9K Apr  8 15:32 targets.xml.bak
-rw-r-----  1 oracle dba  910 Jun 26 22:10 blackouts.xml.bak
-rw-r-----  1 oracle dba   13 Jun 27 00:46 blackouts.xml
-rw-r-----  1 oracle dba 3.1K Jun 30 09:06 emagent_storage.config
-rw-r-----  1 oracle dba 5.9K Jul  1 03:48 targets.xml
-rw-r-----  1 oracle dba    0 Jul  1 03:48 blackouts.lck
-rw-r-----  1 oracle dba  282 Jul  1 04:01 agntstmp.txt.bak
-rw-r-----  1 oracle dba   23 Jul  1 04:03 ag_current_status.msg
-rw-r-----  1 oracle dba  321 Jul  1 04:03 agntstmp.txt
drwxr-----  3 oracle dba 4.0K Jul  1 04:05 upload
drwxr-----  3 oracle dba 4.0K Jul  1 04:05 collection
-bash-4.1$ cd state

-bash-4.1$ mkdir old
-bash-4.1$ mv * old
mv: cannot move `old' to a subdirectory of itself, `old/old'
-bash-4.1$ ls -ltrh
total 4.0K
drwxr-xr-x 12 oracle dba 4.0K Jul  1 04:06 old
-bash-4.1$ emctl status agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent is Not Running
-bash-4.1$ emctl clearstate agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
EMD clearstate completed successfully
-bash-4.1$ df -h .
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper         99G   63G   32G  67% /u01

-bash-4.1$ emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
Starting agent ......... started.
-bash-4.1$ emctl upload agent
Oracle Enterprise Manager Cloud Control 12c Release 2
Copyright (c) 1996, 2012 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload completed successfully