Monday 7 July 2014

Configure Oracle ASM Instance Using 11G r2 grid Infrastructure..

In this post, I am showing you how to configure oracle ASM instance Using oracle 11g r2 grid infrastructure ( ASMLIB*  Packages)? Before I start configuration, let you know what kind infrastructure I have?.

-          RHEL 5.4
-          Oracle grid s/w 11g r2 (p10098816_112020_Linux-x86-64_3of7)
Requirement:-
                      For this installation we want ASMlib packages which I mentioned below.
- oracleasm-support-2.1.7-1.el5.x86_64.rpm
- oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
- oracleasmlib-2.0.4-1.el5.x86_64.rpm
- oracleasm-2.6.18-164.el5-debuginfo-2.0.5-1.el5.x86_64.rpm
- oracleasm-2.6.18-308.1.1.el5-2.0.5-1.el5.x86_64.rpm
                     Raw devices as per requirement in this installation I used three raw devices, per device size is 4 GB (for this raw devices you can ask to your system administrator)
-          /dev/sda5
-          /dev/sda6
-          /dev/sda7


1) First create raw devices as per requirement in this installation I used 3 raw devices.

    - /dev/sda5, /dev/sda6, /dev/sda7

2) Install Asmlib* packages

[root@alpha Asmlib-New-Package-64-Bit]# rpm -ivh oracleasm-support-2.1.7-1.el5.x86_64.rpm
 1:oracleasm-support      ########################################### [100%]
[root@alpha Asmlib-New-Package-64-Bit]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
1:oracleasm-2.6.18-164.el########################################### [100%]
[root@alpha Asmlib-New-Package-64-Bit]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
1:oracleasmlib           ########################################### [100%]
[root@alpha Asmlib-New-Package-64-Bit]# rpm -ivh oracleasm-2.6.18-164.el5-debuginfo-2.0.5-1.el5.x86_64.rpm
 1:oracleasm-2.6.18-164.el########################################### [100%]
[root@alpha Asmlib-New-Package-64-Bit]# rpm -ivh oracleasm-2.6.18-308.1.1.el5-2.0.5-1.el5.x86_64.rpm
 1:oracleasm-2.6.18-308.1.########################################### [100%]

3) Configure Oracle Asm

[root@clone ~]# oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmdba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

Note: - in this installation I used grid user for ASM instance.

[root@clone sysconfig]# oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm

4) Create Asm disk.

[root@clone sysconfig]# oracleasm  createdisk    Vol1   /dev/sda5
Writing disk header: done
Instantiating disk: done
[root@clone sysconfig]# oracleasm   createdisk   Vol2   /dev/sda6
Writing disk header: done
Instantiating disk: done
[root@clone sysconfig]# oracleasm createdisk   Vol3   /dev/sda7
Writing disk header: done
Instantiating disk: done
[root@clone sysconfig]# Oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@clone sysconfig]# oracleasm listdisks
VOL1
VOL2
VOL3

[grid@clone ~]$ xhost +
access control disabled, clients can connect from any host
[grid@clone ~]$ ll
total 834988
-rw-r--r-- 1 grid oinstall 854185065 Mar  1  2013 p10098816_112020_Linux-x86-64_3of7.zip
[grid@clone ~]$ unzip -q p10098816_112020_Linux-x86-64_3of7.zip
[grid@clone ~]$ ./RunInstaller




Note:- DATA is ASM Disk Name.


Note: - Here ASM Password showing in red colors because my password is not as per oracle recommended format.





[root@clone /]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

 [root@clone ~]# /u01/app/grid/product/11.2.0/grid/root.sh
Running Oracle 11g root script...

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/grid/product/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node clone successfully pinned.
Adding daemon to inittab
ACFS-9300: ADVM/ACFS distribution files found.
ACFS-9307: Installing requested ADVM/ACFS software.
ACFS-9308: Loading installed ADVM/ACFS drivers.
ACFS-9321: Creating udev for ADVM/ACFS.
ACFS-9323: Creating module dependencies - this may take some time.
ACFS-9327: Verifying ADVM/ACFS devices.
ACFS-9309: ADVM/ACFS installation correctness verified.

clone     2014/07/07 00:16:50     /u01/app/grid/product/11.2.0/grid/cdata/clone/backup_20140707_001650.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server





Note:- For oracle gurus if I did any mistake in this post please let me know i will modify the blogs

Thanks

Wednesday 5 March 2014

how to recover System table space After lost/corrupt?

In the following cases, it is assumed that database is running in archive log
mode.I explain all steps before and after file lost or Corrupt.

[oracle@dns1 ~]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 4 23:19:18 2014

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

Enter user-name: /as sysdba

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

SQL> select name from v$database;

NAME
---------
DB11G

SQL> shut immediate;
Database closed.
Database dismounted.

[oracle@dns1 DB11G]$ cd /u01/app/oracle/oradata/DB11G/

[oracle@dns1 DB11G]$ ls
control01.ctl  control02.ctl  redo01.log  redo02.log  redo03.log  sysaux01.dbf  system01.dbf  temp01.dbf  ts_ing_ecs01  undotbs01.dbf  users01.dbf

-- I am taking system file backup trough OS command.

[oracle@dns1 DB11G]$ cp system01.dbf  /u01/Archive/

[oracle@dns1 DB11G]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 4 23:21:22 2014

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

Enter user-name: /as sysdba
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 5261217792 bytes
Fixed Size                  2222560 bytes
Variable Size            3271558688 bytes
Database Buffers         1979711488 bytes
Redo Buffers                7725056 bytes
Database mounted.
Database opened.
SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.
SQL> shut abort;
ORACLE instance shut down.
SQL> !
[oracle@dns1 DB11G]$ rm system01.dbf
[oracle@dns1 DB11G]$ ls
control01.ctl  control02.ctl  redo01.log  redo02.log  redo03.log  sysaux01.dbf  temp01.dbf  ts_ing_ecs01  undotbs01.dbf  users01.dbf

[oracle@dns1 DB11G]$ exit
exit

SQL> startup mount;
ORACLE instance started.

Total System Global Area 5261217792 bytes
Fixed Size                  2222560 bytes
Variable Size            3271558688 bytes
Database Buffers         1979711488 bytes
Redo Buffers                7725056 bytes
Database mounted.
SQL> alter database rename file '/u01/app/oracle/oradata/DB11G/system01.dbf' to '/u01/Archive/system01.dbf'; ---rename lost file

Database altered.

SQL> recover datafile 1;
ORA-00279: change 9369328 generated at 03/04/2014 23:20:14 needed for thread 1
ORA-00289: suggestion : /u01/Archive/arch_837387824_1_771
ORA-00280: change 9369328 for thread 1 is in sequence #771


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto             ---recover using AUTO option.
Log applied.
Media recovery complete.
SQL> alter database open;

Database altered.

SQL> select name,OPEN_MODE from v$database;

NAME      OPEN_MODE
--------- --------------------
DB11G     READ WRITE

===========================END=======================================

Monday 3 March 2014

ORA-19905: log_archive_format must contain %s, %t and %r

ORA-19905:- this error generate due to incorrect Archive log format in oracle Release 11.2.0.1.0.

Problem:-
SQL> startup;
ORA-19905: log_archive_format must contain %s, %t and %r
SQL> startup mount;
ORA-19905: log_archive_format must contain %s, %t and %r

Solution:
Also Solution is given in metalink note 283507.1

 - create pfile from spfile using below Comand.

SQL> create pfile from spfile;

File created.

- got to oracle pfile location and edit the 'log_archive_format' parameter

[oracle@dns1 DB11G]$ cd /u01/app/oracle/product/11.2.0/db_1/dbs/

[oracle@dns1 dbs]$ vi  initDB11G.ora

-----------------before update----------------------------------

DB11G.__db_cache_size=1979711488
DB11G.__java_pool_size=16777216
DB11G.__large_pool_size=16777216
DB11G.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DB11G.__pga_aggregate_target=2097152000
DB11G.__sga_target=3154116608
DB11G.__shared_io_pool_size=0
DB11G.__shared_pool_size=1073741824
DB11G.__streams_pool_size=33554432
*.audit_file_dest='/u01/app/oracle/admin/DB11G/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/DB11G/control01.ctl','/u01/app/oracle/oradata/DB11G/control02.ctl'
*.cursor_sharing='FORCE'
*.db_block_size=8192
*.db_domain=''
*.db_name='DB11G'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DB11GXDB)'
*.log_archive_dest_1='LOCATION=/u01/Archive'
*.log_archive_format='arch_%t_%s'
*.memory_max_target=0
*.memory_target=0
*.open_cursors=1500
*.pga_aggregate_target=2097152000
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=1000
*.sga_target=3154116608
*.timed_statistics=TRUE
*.undo_tablespace='UNDOTBS1'

--------------------After update------------------------------------
DB11G.__db_cache_size=1979711488
DB11G.__java_pool_size=16777216
DB11G.__large_pool_size=16777216
DB11G.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DB11G.__pga_aggregate_target=2097152000
DB11G.__sga_target=3154116608
DB11G.__shared_io_pool_size=0
DB11G.__shared_pool_size=1073741824
DB11G.__streams_pool_size=33554432
*.audit_file_dest='/u01/app/oracle/admin/DB11G/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/DB11G/control01.ctl','/u01/app/oracle/oradata/DB11G/control02.ctl'
*.cursor_sharing='FORCE'
*.db_block_size=8192
*.db_domain=''
*.db_name='DB11G'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DB11GXDB)'
*.log_archive_dest_1='LOCATION=/u01/Archive'
*.log_archive_format='arch_%r_%t_%s'
*.memory_max_target=0
*.memory_target=0
*.open_cursors=1500
*.pga_aggregate_target=2097152000
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=1000
*.sga_target=3154116608
*.timed_statistics=TRUE
*.undo_tablespace='UNDOTBS1'


[oracle@dns1 dbs]$ sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Mar 3 01:32:10 2014

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

Enter user-name: /as sysdba
Connected to an idle instance.

SQL> startup pfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initDB11G.ora';
ORACLE instance started.

Total System Global Area 5261217792 bytes
Fixed Size                  2222560 bytes
Variable Size            3271558688 bytes
Database Buffers         1979711488 bytes
Redo Buffers                7725056 bytes
Database mounted.
Database opened.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/Archive
Oldest online log sequence     760
Next log sequence to archive   762
Current log sequence           762

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /
/
System altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/Archive
Oldest online log sequence     764
Next log sequence to archive   766
Current log sequence           766

work on autovacuum postgreSQL parameter

 In This blog, we are discussing the auto vacuum parameter on a small scale. we will understand the below parameters and will see how to mod...