Monday, December 8, 2014

ADD DATAFILE IN RAC WITH ASM



Step 1: Check Space in ASM DiaskGroups

SQL> SELECT name, free_mb, total_mb, free_mb/total_mb*100 as percentage FROM v$asm_diskgroup;

NAME                              FREE_MB   TOTAL_MB PERCENTAGE
------------------------------ ---------- ---------- ----------
WEBLOGDB_DATA1                          2         185080 .001080614
WEBLOGDB_DATA2                      19065     185080 10.3009509
WEBLOGDB_DATA3                      27253     185080 14.7249838
REDO                                               87549      139232 62.8799414

SQL>
SQL>
SQL>
SQL>














Step 2:  Add Datafile with respective ASM diskgroups

SQL>
SQL> ALTER TABLESPACE USERS ADD DATAFILE '+WEBLOGDB_DATA3' SIZE 100M  AUTOEXTEND ON  MAXSIZE 10240M;

Tablespace altered.

SQL>

Step 3: Check and verify datafile

SQL> select a.FILE#,a.CREATION_TIME,b.TABLESPACE_NAME,b.FILE_NAME ,b.BYTES/1024/1024 from v$datafile a ,dba_data_files b where a.FILE#=b.FILE_ID and b.TABLESPACE_NAME='&TABLESPACE_NAME'  order by a.CREATION_TIME,b.FILE_ID





ORA-10873: file 1 needs to be either taken out of backup mode or media recovered

[oracle@racha1 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 2 16:50:33 2014

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

Connected to an idle instance.

SQL>
SQL> startup
ORACLE instance started.

Total System Global Area  636100608 bytes
Fixed Size                  1338392 bytes
Variable Size             184550376 bytes
Database Buffers          444596224 bytes
Redo Buffers                5615616 bytes
Database mounted.
ORA-10873: file 1 needs to be either taken out of backup mode or media
recovered
ORA-01110: data file 1: '+DATA/testdb/datafile/system.271.860462435'



///////////////

[oracle@racha1 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 2 16:50:33 2014

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

Connected to an idle instance.

SQL>
SQL> startup
ORACLE instance started.

Total System Global Area  636100608 bytes
Fixed Size                  1338392 bytes
Variable Size             184550376 bytes
Database Buffers          444596224 bytes
Redo Buffers                5615616 bytes
Database mounted.
ORA-10873: file 1 needs to be either taken out of backup mode or media
recovered
ORA-01110: data file 1: '+DATA/testdb/datafile/system.271.860462435'


SQL>
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
[oracle@racha1 ~]$
[oracle@racha1 ~]$
[oracle@racha1 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 2 16:54:02 2014

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL>
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL>
SQL>
SQL> select * from v$backup;

     FILE# STATUS                CHANGE# TIME
---------- ------------------ ---------- ---------
         1 ACTIVE                1541869 02-DEC-14
         2 ACTIVE                1541869 02-DEC-14
         3 ACTIVE                1541869 02-DEC-14
         4 ACTIVE                1541869 02-DEC-14
         5 ACTIVE                1541869 02-DEC-14
         6 ACTIVE                1541869 02-DEC-14
         7 ACTIVE                1541869 02-DEC-14
         8 ACTIVE                1541869 02-DEC-14
         9 ACTIVE                1541869 02-DEC-14

9 rows selected.

SQL>
SQL>
SQL> alter database end backup;

Database altered.

SQL>
SQL> select * from v$backup;

     FILE# STATUS                CHANGE# TIME
---------- ------------------ ---------- ---------
         1 NOT ACTIVE            1541869 02-DEC-14
         2 NOT ACTIVE            1541869 02-DEC-14
         3 NOT ACTIVE            1541869 02-DEC-14
         4 NOT ACTIVE            1541869 02-DEC-14
         5 NOT ACTIVE            1541869 02-DEC-14
         6 NOT ACTIVE            1541869 02-DEC-14
         7 NOT ACTIVE            1541869 02-DEC-14
         8 NOT ACTIVE            1541869 02-DEC-14
         9 NOT ACTIVE            1541869 02-DEC-14

9 rows selected.

SQL>
SQL> alter database open;

Database altered.

SQL>
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL>
SQL>

Friday, November 14, 2014

ASM MONITORING COMMAND

///////////TO CHECK DISKGROUP SPACE INFORMATION

SQL> SELECT name, free_mb/1024, total_mb/1024, free_mb/total_mb*100 as percentage FROM v$asm_diskgroup;


////////////////////IDENTIFY CANDIDATE DISK



 SELECT
    NVL(a.name, '[CANDIDATE]') as disk_group_name
  , b.path as disk_file_path
  , b.name as disk_file_name
  , b.failgroup as disk_file_fail_group
 FROM
    v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
 ORDER BY
    a.name;


/////////////////////CHECK ASM FILE INFORMATION

select file_number , sum(bytes)/(1024*1024) from v$asm_file group by file_number;

ORACLE RAC MONITORING COMMANDS

/////////////////check services

dbserver2:oracle$
dbserver2:oracle$
dbserver2:oracle$
dbserver2:oracle$ crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    dbserver1
ora....R1.lsnr application    ONLINE    ONLINE    dbserver1
ora....er1.vip application    ONLINE    ONLINE    dbserver1
ora....SM2.asm application    ONLINE    ONLINE    dbserver2
ora....R2.lsnr application    ONLINE    ONLINE    dbserver2
ora....er2.gsd application    ONLINE    ONLINE    dbserver2
ora....er2.ons application    ONLINE    ONLINE    dbserver2
ora....er2.vip application    ONLINE    ONLINE    dbserver2
ora....ogdb.db application    ONLINE    ONLINE    dbserver1
ora....ebdb.cs application    ONLINE    ONLINE    dbserver1
ora....db1.srv application    ONLINE    ONLINE    dbserver1
ora....db2.srv application    ONLINE    ONLINE    dbserver2
ora....b1.inst application    ONLINE    ONLINE    dbserver1
ora....b2.inst application    ONLINE    ONLINE    dbserver2
dbserver2:oracle$
dbserver2:oracle$
dbserver2:oracle$




/////////////////////////////cluster health status


dbserver1:oracle$ crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
dbserver1:oracle$
dbserver1:oracle$



/////////////////ocr backup info


dbserver2:oracle$ ocrconfig -showbackup

dbserver1     2014/10/07 11:47:21     /u01/app/oracle/product/10.2.0/crs/cdata/crs

dbserver1     2014/10/07 07:47:21     /u01/app/oracle/product/10.2.0/crs/cdata/crs

dbserver1     2014/10/07 03:47:19     /u01/app/oracle/product/10.2.0/crs/cdata/crs

dbserver1     2014/10/05 19:47:11     /u01/app/oracle/product/10.2.0/crs/cdata/crs

dbserver1     2014/09/29 07:46:33     /u01/app/oracle/product/10.2.0/crs/cdata/crs
dbserver2:oracle$





//////////////////////all node cluster database status

dbserver1:oracle$
dbserver1:oracle$ srvctl status database -d weblogdb
Instance weblogdb1 is running on node dbserver1
Instance weblogdb2 is running on node dbserver2
dbserver1:oracle$


///////////////////////////instance staus

////node1

srvctl status instance -d weblogdb -i weblogdb1

dbserver1:oracle$ srvctl status instance -d weblogdb -i weblogdb1
Instance weblogdb1 is running on node dbserver1
dbserver1:oracle$


////node2

srvctl status instance -d weblogdb -i weblogdb2

dbserver2:oracle$
dbserver2:oracle$ srvctl status instance -d weblogdb -i weblogdb2
Instance weblogdb2 is running on node dbserver2
dbserver2:oracle$
dbserver2:oracle$




////////////////////asm instance status/////////////////////////////////






////node1

srvctl status asm -n dbserver1

dbserver1:oracle$
dbserver1:oracle$ srvctl status asm -n dbserver1
ASM instance +ASM1 is running on node dbserver1.
dbserver1:oracle$
dbserver1:oracle$


////////node2

srvctl status asm -n dbserver2

dbserver2:oracle$
dbserver2:oracle$ srvctl status asm -n dbserver2
ASM instance +ASM2 is running on node dbserver2.
dbserver2:oracle$


///////////////////cluster nodeapps status/////////////////////////////////////////////





////node1

srvctl status nodeapps -n dbserver1
dbserver1:oracle$
dbserver1:oracle$ srvctl status nodeapps -n dbserver1
VIP is running on node: dbserver1

///node2

srvctl status nodeapps -n dbserver2
dbserver2:oracle$
dbserver2:oracle$ srvctl status nodeapps -n dbserver2
VIP is running on node: dbserver2
GSD is running on node: dbserver2
Listener is running on node: dbserver2
ONS daemon is running on node: dbserver2
dbserver2:oracle$


/////////////////////