Monday, December 17, 2012

Impact of NOLOGGING on an Oracle Dataguard Standby


Impact of NOLOGGING on an Oracle Dataguard Standby


In below we will run few of the test cases NOLOGGING  option at dataguard environment.
Oracle recommended  for Dataguard Standby databases is to run "alter database force logging;" to make sure all database transactions on the primary database are logged which will be applied to the standby.

NOLOGGING is valid for the following operations :-

direct load (SQL*Loader)
direct load INSERT (using APPEND hint)
CREATE TABLE ... AS SELECT
CREATE INDEX
ALTER TABLE ... MOVE PARTITION
ALTER TABLE ... SPLIT PARTITION
ALTER INDEX ... SPLIT PARTITION
ALTER INDEX ... REBUILD
ALTER INDEX ... REBUILD PARTITION
INSERT, UPDATE, and DELETE on LOBs in NOCACHE NOLOGGING mode stored out of line

NOLOGGING  results indicate :-
1. significant reduction in redo (there will still be UNDO REDO generated)
2. logical corruption in the tables in the standby database which will stop select statements until the table data is reloaded (e.g drop and recreate)

##  At primary database ##
# check logging

select force_logging from v$database;
select tablespace_name from dba_tablespaces where logging = 'NOLOGGING';
select logging from user_tables where table_name = 'NOLOG';

SQL> truncate table nolog;
Table truncated.
SQL> alter database force logging;
Database altered.
SQL> alter tablespace users logging;
Tablespace altered.
SQL> alter table nolog logging;
Table altered.
SQL> set autotrace ON statistics
SQL> insert /*+ APPEND */
into nolog select 'this is a nologging NOLOG' from dual nologging; 2

1 row created.


Statistics
----------------------------------------------------------
165 recursive calls
7 db block gets
21 consistent gets
2 physical reads
8624 redo size
820 bytes sent via SQL*Net to client
780 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
6 sorts (memory)
0 sorts (disk)
1 rows processed

SQL> set autotrace off
SQL> select file#, unrecoverable_change#, to_char(unrecoverable_time,'hh:mi') from v$datafile where UNRECOVERABLE_CHANGE# > 0;

FILE# UNRECOVERABLE_CHANGE# TO_CH
---------- --------------------- -----
26 2.4329E+10 02:48

SQL> alter database no force logging;

Database altered.

SQL> alter tablespace users nologging;

Tablespace altered.

SQL> alter table nolog nologging;

Table altered.

SQL> truncate table nolog;

Table truncated.

SQL> set autotrace ON statistics
SQL> insert /*+ APPEND */
into nolog select 'this is a nologging nolog' from dual nologging; 2

1 row created.


Statistics
----------------------------------------------------------
3 recursive calls
7 db block gets
2 consistent gets
2 physical reads
448 redo size
820 bytes sent via SQL*Net to client
780 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
1 rows processed

SQL> select file#, unrecoverable_change#, to_char(unrecoverable_time,'hh:mi') from v$datafile where UNRECOVERABLE_CHANGE# > 0;

FILE# UNRECOVERABLE_CHANGE# TO_CH
---------- --------------------- -----
26 2.4329E+10 02:51



# On the Physical Standby ##

SQL> select * from nolog;
ERROR:
ORA-01578: ORACLE data block corrupted (file # 26, block # 42)
ORA-01110: data file 26:
'/u01/oradata/orcl/datafile/o1_mf_users_3vty8wdy_.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option

SQL> analyze table nolog validate structure cascade;
analyze table nolog validate structure cascade
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 26, block # 31)
ORA-01110: data file 26:
'/u01/oradata/orcl/datafile/o1_mf_users_3vty8wdy_.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option

!oerr ora 26040
26040, 00000, "Data block was loaded using the NOLOGGING option\n"
//* Cause: Trying to access data in block that was loaded without
//* redo generation using the NOLOGGING/UNRECOVERABLE option
//* Action: Drop the object containing the block. 

Saturday, December 1, 2012

How to check MAXDATAFILES, MAXLOGHISTORY, MAXLOGFILES




SQL> Select '-- MAXDATAFILES -- ' || records_total  from v$controlfile_record_section where type = 'DATAFILE';

-- MAXDATAFILES --  256


SQL> Select '-- MAXLOGHISTORY -- ' || records_total  from v$controlfile_record_section where type = 'LOG HISTORY';

-- MAXLOGHISTORY -- 584

SQL> Select '-- MAXINSTANCES -- ' || records_total  from v$controlfile_record_section where type = 'DATABASE';


-- MAXINSTANCES -- 1

SQL> Select '-- MAXLOGFILES -- ' || records_total  from v$controlfile_record_section where type = 'REDO LOG';

-- MAXLOGFILES -- 255

SQL> Select '--> MAXLOGMEMBERS ' || dimlm from x$kccdi;

-- MAXLOGMEMBERS -- 5

Tuesday, November 27, 2012

redo log generation per hour basis


Redo generation ratio/per hour 



SELECT day,A "00",B "01",C "02",D "03",E "04",F "05",G "06",H "07",I "08",J "09",K "10",
L "11",M "12",N "13",O "14",P "15",Q "16",R "17",S "18",T "19",U "20",V "21",W "22",X "23",
A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X DAY_SUM FROM (
select to_char(first_time,'YYYY.MM.DD') day,
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'00',1,0)),'999') "A",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'01',1,0)),'999') "B",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'02',1,0)),'999') "C",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'03',1,0)),'999') "D",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'04',1,0)),'999') "E",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'05',1,0)),'999') "F",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'06',1,0)),'999') "G",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'07',1,0)),'999') "H",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'08',1,0)),'999') "I",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'09',1,0)),'999') "J",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'10',1,0)),'999') "K",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'11',1,0)),'999') "L",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'12',1,0)),'999') "M",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'13',1,0)),'999') "N",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'14',1,0)),'999') "O",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'15',1,0)),'999') "P",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'16',1,0)),'999') "Q",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'17',1,0)),'999') "R",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'18',1,0)),'999') "S",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'19',1,0)),'999') "T",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'20',1,0)),'999') "U",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'21',1,0)),'999') "V",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'22',1,0)),'999') "W",
to_char(sum(decode(substr(to_char(first_time,'DDMMYYYY:HH24:MI'),10,2),'23',1,0)),'999') "X"
from v$log_history
group by to_char(first_time,'YYYY.MM.DD')
order by to_char(first_time,'YYYY.MM.DD')) ;

Sunday, November 18, 2012

Redolog resizing at dataguard environment


 Steps 01: Stop/Shutdown standby database
===========================================

SQL> Alter database recover managed standby database cancel;
SQL> Shutdown immediate;

 Steps 02: delete redolog file and standby file using rm command in standby side
====================================================================================


Steps: 3. Drop online redologfiles in primary database
========================================================
SQL> alter system switch logfile;
SQL> alter system checkpoint;
SQL> alter database drop logfile group 1;

SQL> ALTER DATABASE ADD LOGFILE GROUP 1 ('/oradata1/redo1/redo01a.log',
'/oradata1/redo2/redo01b.log') SIZE 300M;

SQL> alter database drop logfile group 2;


SQL> ALTER DATABASE ADD LOGFILE GROUP 2 ('/oradata1/redo1/redo02a.log',
'/oradata1/redo2/redo02b.log') SIZE 300M;

SQL> alter database drop logfile group 3;


SQL> ALTER DATABASE ADD LOGFILE GROUP 3 ('/oradata1/redo1/redo03a.log',
'/oradata1/redo2/redo03b.log') SIZE 300M;

SQL> alter database drop logfile group 4;

SQL> ALTER DATABASE ADD LOGFILE GROUP 4 ('/oradata1/redo1/redo04a.log',
'/oradata1/redo2/redo04b.log') SIZE 300M;

==========================================================================================

Steps 04:  Drop standby logs in primary database and add standby logs in primary

SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 5;

SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 6;

SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 7;

SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 8;

SQL> ALTER DATABASE DROP STANDBY LOGFILE GROUP 9;


===========================================================================================

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 ('/oradata1/redo1/standbyredo05a.log',
'/oradata1/redo2/standbyredo05b.log') SIZE 300M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 ('/oradata1/redo1/standbyredo06a.log',
'/oradata1/redo2/standbyredo06b.log') SIZE 300M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 ('/oradata1/redo1/standbyredo07a.log',
'/oradata1/redo2/standbyredo07b.log') SIZE 300M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 8 ('/oradata1/redo1/standbyredo08a.log',
'/oradata1/redo2/standbyredo08b.log') SIZE 300M;

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 9 ('/oradata1/redo1/standbyredo09a.log',
'/oradata1/redo2/standbyredo09b.log') SIZE 300M;

Steps 05:  create standby controlfile- and move it on standby db side
===========================================================================================

SQL> alter database create standby controlfile as '/oradata1/standby01.ctl';

Move Control file to standby remote destination
============================
Steps 06: Startup standby database--
============================

SQL> startup nomount

SQL> alter database mount standby database;

SQL> alter database recover managed standby database disconnect from session

Steps 07:  Open read-only mode and real-time redo apply
========================================================
SQL> startup
SQL> alter database recover managed standby database disconnect using current logfile;

Wednesday, November 14, 2012

RAC privet interconnect IP address change


Oracle RAC user isolate network connectivity for privet interconnect.
Bellow steps will describe how to change privet interconnect.

Make sure full cluster or service downtime


Step 1: Determine current private IP address

[grid@rac1 ~]$ oifcfg getif
eth0  192.168.20.0  global  public
eth1  10.0.0.0  global  cluster_interconnect

Step 2: Determine current configure Ethernet/NIC card name

[grid@rac1 ~]$ oifcfg iflist
eth0  192.168.20.0
eth1  10.0.0.0

Step 3: Add new interface Subnet ID:

[grid@rac1 ~]$ oifcfg setif -global eth1/172.20.0.0:cluster_interconnect

Step 4 : Verify the modification:

[grid@rac1 ~]$ oifcfg getif
eth0  192.168.20.0  global  public
eth1  10.0.0.0  global  cluster_interconnect
eth1  172.20.0.0  global  cluster_interconnect

Step 5: Stop cluster on all node:

[grid@rac1 ~]# su - root
[root@rac1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@rac1 ~]#  ./crsctl stop cluster -all

Step 6: Modify netwrok address on network adapter of each box:

[root@rac1 ~]# ifconfig eth1 172.20.0.10 netmask 255.255.0.0 broadcast 172.20.255.255
[root@rac2 ~]# ifconfig eth1 172.20.0.11 netmask 255.255.0.0 broadcast 172.20.255.255

Step 7: Change /etc/hosts file on each node.

[root@rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1    localhost.localdomain    localhost

#10.10.10.10       rac1-priv
172.16.0.10        rac1-priv

#10.10.10.11   rac2-priv
172.20.0.11    rac2-priv

Step 8: Start cluster all node

[grid@rac1 ~]# su - root
[root@rac1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@rac1 ~]#  ./crsctl start cluster -all

Step 9: Remove old private interconnect entry from cluster registry

[grid@rac1 ~]$ oifcfg delif -global eth1/10.0.0.0:cluster_interconnect

Step 10: Verify the changes:

[grid@rac1 ~]$ oifcfg getif
eth0  192.168.20.0  global  public
eth1  172.20.0.0  global  cluster_interconnect

[grid@rac1 ~]$ ping rac1-priv
PING test1-priv.localdomain (172.20.0.10) 56(84) bytes of data.
64 bytes from test1-priv.localdomain (172.20.0.10): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from test1-priv.localdomain (172.20.0.10): icmp_seq=2 ttl=64 time=0.018 ms

Diagnostics Collection Script for Grid Infrastructure


Diagnostics Collection Script for Grid Infrastructure

####################################



We suggest to  use diagcollection.pl script  for collecting t diagnostic information of  Oracle Grid Infrastructure ( Oracle clusterware )

Script locate at
$GRID_HOME/bin/

/u01/app/11.2.0/grid/bin/diagcollection.pl

./diagcollection.pl --collect --all

log on as  root user then run above mention script.


When invoked script
•crsData_hostname_date.tar.gz contains log files
•coreData_host_name_date.tar.gz contains core files
•ocrData_hostname_date.tar.gz files contains ocrdump and ocrcheck also show OCR backups.
•osData_hostname_date.tar.gz contains operating system logs

To remove file from local director ..

/u01/app/11.2.0/grid/bin/diagcollection.pl –clean



Tuesday, October 30, 2012

OCM config & collect for single Instance


Step 1:

Remove the mentioned Old/if availabe earlier CCR directory.

   $ORACLE_HOME/ccr

Step 2:

Copy the unzip software on this location

$ORACLE_HOME/ccr

Step 3: 

Run the following from a command prompt:

    export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
    export ORACLE_SID=< SID NAME>

Step 4:

Go to location $ORACLE_HOME/ccr/bin then run the bellow command
   
 ./setupCCR -s CSI NUMBER email@test.com
./configCCR -s -d

Step 5:

Go to location:
 /u01/app/oracle/product/11.2.0/db_1/ccr/admin/scripts

then run the bellow command
      ./installCCRSQL.sh collectconfig -s <SID> -r sys

Step 6:
Go to location
cd $ORACLE_HOME/ccr/bin then run the bellow command

   ./emCCR collect


After collected the information, need to upload of the file ocmconfig.jar to Metalink


output location
================
/u01/app/oracle/product/11.2.0/db_1/ccr/hosts/ibdb1/state/upload/ocmconfig.jar

Sunday, October 28, 2012

12.1.0.2 oracle http server showing down

12.1.0.2 oracle HTTP server showing down

 

Oracle Cloud Control 12c (12.1.0.2) OMS home HTTP service show up and down so frequently.
we found that it is bug for oracle weblogic server 11.1.
Need to apply patch "13490778 PS5:REF2: INSTANCE STATUS SHOWN INCORRECTLY IN EM WITH RC4-REFRESH-2 "and bounce OMS service.

Steps are  belows:


 Pr-Installation Instructions 
-----------------------------------

- Set the ORACLE_HOME environment variable to MW_HOME/oracle_common directory.

export ORACLE_HOME=/u01/app/oracle/product/mh/oracle_common

 Installation Instructions
--------------------------------

To install the patch, follow the instructions given in this section: 

1. Unzip the patch zip file into the PATCH_TOP. 
$unzip -d PATCH_TOP p13490778_111160_Generic.zip 
 
unzip -d /home/oracle/PATCH_TOP p13490778_111160_Generic.zip

2. Set your current directory to the directory where the patch is located. 
 
cd /home/oracle/PATCH_TOP/13490778

3. Run OPatch to apply the patch.

   /u01/app/oracle/product/mh/Oracle_WT/OPatch/opatch apply

 Post-Installation Instructions 
---------------------------------------

- Restart all servers (AdminServer and all Managed server(s)) that shares the oracle_common home.
cd /u01/app/oracle/product/mh/oms/bin 
./emctl stop oms -all
./emctl start oms 
 
Note: If  emctl stop oms -all  is not working, try force command 
 
./emctl stop oms -all -force  
 
 
 Deinstallation Instructions
-----------------------------------

If you experience any problems after installing this patch, remove the patch as follows:

1. Make sure to follow the same Pre-installation steps when deinstalling a patch. 
   This includes verifying the inventory and shutting down any services running from the 
ORACLE_HOME / machine before rolling the patch back. 
 
cd /u01/app/oracle/product/mh/oms/bin
./emctl stop oms -all 
 
 
 2. Change to the directory where the patch was unzipped. 
 
cd /export/home/oracle/PATCH_TOP/13490778 

3. Run OPatch to deinstall the patch.
    
 /u01/app/oracle/product/mh/Oracle_WT/OPatch/opatch rollback -id 13490778 
  
4. Start oms home 

./emctl start oms 


MOS Note :  1496775.1

Saturday, October 27, 2012

Log Sequence in Archive Filename Wrapped

Log Sequence in Archive Filename Wrapped



Your database is running in archivelog mode and you notice the following  error sequence in the Alert file:


ARC1: Warning.  Log sequence in archive filename wrapped
to fix length as indicated by %S in LOG_ARCHIVE_FORMAT.
Old log archive with same name might be overwritten.
Sat Oct 27 13:39:51 2012
Reason behind  log_archive_format parameter value '%S'.
Explanation:

  • %S Specifies the log sequence number. This number is padded to the left by zeroes. The default value is one with a range of up to five characters.
  • %s Specifies the log sequence number. The number is not padded. The defaultvalue is one with no range limit on characters.  
Solution:

Modify the LOG_ARCHIVE_FORMAT parameter value in your init.ora file
to replace the uppercase %S with a lowercase %s.

Example:

Change this line in your init.ora file:
FROM:
log_archive_format = ARC_%S_%R_%T.ARC
TO:
log_archive_format = ARC_%s_%R_%T.ARC


MOS Note: 125146.1

Friday, September 7, 2012

RMAN backup at NFS mount point

RMAN backup at NFS mount point

To take rman backup at NFS mount point on Linux Platform from Oracle Database 11.2 add few rule:

Listing of required NFS options for 11.2.0.2 RMAN disk backup directory

The following NFS options must be specified for 11.2.0.2 RMAN disk backup directory:
Mount Options for Linux systems

Single Instance NFS Mount Options
---------------------------------
Mount options for Oracle Binaries

rw,bg,hard,rsize=32768,wsize=32768,vers=3,nointr,timeo=600,tcp

Mount options for Oracle Datafiles

rw,bg,hard,rsize=32768,wsize=32768,vers=3,nointr,timeo=600,tcp


RAC NFS Mount options
---------------------

Mount options for Oracle Binaries

rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp, vers=3,timeo=600, actimeo=0


Mount options for Oracle Datafiles

rw,bg,hard,nointr,rsize=32768,wsize=32768,proto=tcp,noac,forcedirectio, vers=3,suid

The above values are starting recommendations as a starting point you can tune further
as required. To test which value of rsize/wsize is optimal for your system you can run
the testing outlined below.

First, we'll try transfers of 16384 blocks of 16k each from a unique file called /dev/zero
(when you read it, it's all zeroes, put out very quickly) to the test file. The time it takes to do this is our measure. From the client, command:

time dd if=/dev/zero of=/<mounted partition>/testfile bs=16k count=16384



MOS Note : ID 1117597.1