Thursday, August 28, 2014

IO Bench Marking

1 dd
For a quick and dirty test of your disk performance, you can time writes performed by the dd command.

$ time sh -c "dd if=/dev/zero of=dd-test-file bs=8k count=1000000 && sync"

This is no reflection of how disk performance will look when being accessed by Oracle systems.


2 ORION
ORION (ORacle IO Numbers) mimics the type of I/O performed by Oracle databases, which allows you to measure I/O performance for storage systems without actually installing Oracle.
Step 1
Make disks as follows:
dd if=/dev/zero of=/u05/utilities/orion/disk1  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk2  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk3  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk4  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk5  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk6  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk7  bs=8192  count=10240
dd if=/dev/zero of=/u05/utilities/orion/disk8  bs=8192  count=10240
Step 2
Next, create a file to hold the LUN configuration. In this case I will call my test orion_test1, so my LUN configuration file must be called orion_test1.lun. Make sure it is in the same directory as the ORION executable. The file should contain a list of the luns used in the test.

/u05/utilities/orion/disk1
/u05/utilities/orion/disk2
/u05/utilities/orion/disk3
/u05/utilities/orion/disk4
/u05/utilities/orion/disk5
/u05/utilities/orion/disk6
/u05/utilities/orion/disk7
/u05/utilities/orion/disk8
Step 3
Verify that the all volumes specified in the input file, are accessible using the command dd as follows.
dd if=/u05/utilities/orion/disk1 of=/dev/null bs=32k count=1024
Step 4
Verify that your platform has the necessary libraries installed to do asynchronous I/Os. The Orion test is completely dependent on asynchronous I/O. On Linux and Solaris, the library libaio must be in the standard lib directories or accessible through the shell environment's library path variable (usually LD_LIBRARY_PATH or LIBPATH, depending on your shell).
Step 5
Run test as follows:
 ./orion -run oltp
./orion -run dss


3. DBMS_RESOURCE_MANAGER.CALIBRATE_IO
The CALIBRATE_IO is used to measure the IO bench marking after Oracle database is created.

There are a few restrictions associated with the procedure and execute the below noted script (as system user) to verify the prerequisites are satisfied.
SQL>@check_calibrate_io_prerequisites.sql.

Execute calibirate_io.sql (as system user) to calibrate:
SQL>@calibirate_io.sql.

Execute list_calibirate_io.sql (as system user) to list the calibrated values:
SQL>@list_calibirate_io.sql

Wednesday, February 12, 2014

Oracle数据库的不完全恢复方式

本文主要介绍以下四种oracle数据库的不完全恢复方式的含义与区别:

1. recover database using backup controlfile
如果丢失当前控制文件,用冷备份的控制文件恢复的时候,用来告诉oracle,不要以controlfile中的scn作为恢复的终点;
2. recover database until cancel

如果丢失current/active redo的时候,手动指定终点。
3. recover database using backup controlfile until cancel;

如果丢失当前controlfile并且current/active redo都丢失,会先去自动应用归档日志,可以实现最大的恢复;
4. recover database until cancel using backup controlfile;

如果丢失当前controlfile并且current/active redo都丢失,以旧的redo中的scn为恢复终点。因为没有应用归档日志,所有会丢失数据。
要理解recover database using backup controlfile,先理解 recover database,也就是说,不加using backup controlfile的情况。
在普通的recover database 或者 recover tablespace, recover datafile时, Oracle会以当前controlfile所纪录的SCN为准,利用archive log和 redo log的redo entry, 把相关的datafile 的 block恢复到“当前controlfile所纪录的SCN”
而某些情况下,Oracle需要把数据恢复到比当前controlfile所纪录的SCN还要靠后的位置(比如说,control file是backup controlfile , 或者 controlfile是根据trace create的。),这时候,就需要用using backup controlfile.   恢复就不会受“当前controlfile所记录的SCN”的限制。这时候的限制就来自于你的语句(until time , until scn),或者可用的archive log(until cancel) ...


本文地址:http://www.itpux.com/thread-112-1-1.html



Friday, January 17, 2014

ORA-16664: unable to receive the result from a database

Error Code: ORA-16664: unable to receive the result from a database


Case: You can see the redo shipping is working fine from Primary to standby DB. you can notice this error when you try to enable the DG broker.

Test the following:

1. connection to standby from Primary server - should be good if the redo shipping is fine
2. connection from standby to Primary server

This could be the cause - As during normal redo shipping we don't need the vice versa connection from standby to Primary but when you enable the DG Broker it needs that for the auto switchover, fail over.


Some other causes for the same issue:
The logon trigger was preventing the connection from the standby database during a switchover.
Fix: disable the logon trigger in primary database.  (Metalink id 1530881.1)
Check the non default port used in connect string of both primary and standby(tnsnames.ora). Metalink id 1228797.1

Monday, September 9, 2013

RAC Check Tool

RACcheck is a RAC Configuration Audit tool  designed to audit various important configuration settings within a Real Application Clusters (RAC), Oracle Clusterware (CRS), Automatic Storage Management (ASM) and Grid Infrastructure environment.

Installation
1.       Log in to the system as the Oracle RDBMS software installation owner (if Oracle products installed, otherwise log in as root)
2.       Stage the appropriate raccheck.zip kit in its own directory the node
3.       Unzip raccheck.zip kit, leaving the script and driver files together in the same directory
4.       Validate the permissions for raccheck are 755 (-rwxr-xr-x).

Running RACcheck
$ ./raccheck

 Follow the prompts while reading and understanding all messages.
1.      Provide crs_home
2.      Choose the database, or select 1 for All or comma separated number like 1,2 etc [1-2][1].1
3.      Provide root password, or skip the root privileged collections
4.      View output location and upload the zip file to metalink.

Reference
RACcheck - RAC Configuration Audit Tool (Doc ID 1268927.1)

Thursday, April 18, 2013

How To Verify If DNFS Is Enabled Before The Database Instance Is Started In 11.2 Release?

Before the Database Instance is started, you can verify if DNFS (Direct NFS) is enabled (“ON”) or disabled (“OFF”) as follows:  (Doc ID 1551909.1)

 1) When DNFS is not linked with the Oracle kernel, the next command will report the “ODM ERR: Calling stubbed version” error example:
 [oracle@asmlnx1 lib]$ make -f ins_rdbms.mk dnfs_off
rm -f /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so; cp /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/libodm11.so.dummy /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so
[oracle@asmlnx1 lib]$ 
[oracle@asmlnx1 lib]$ strings /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so | grep -i odm
odm_deregisternic
odm_registernic
odm_destroy
…………….. 
odm_discover
ODM ERR: Calling stubbed version
Stubbed ODM Library, Version: 1.0


2) But if DNFS is linked with the Oracle kernel, then the “ODM ERR: Calling stubbed version” error will not be reported, example:

[oracle@asmlnx1 lib]$ make -f ins_rdbms.mk dnfs_on
rm -f /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so; cp /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnfsodm11.so /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so
[oracle@asmlnx1 lib]$ 
[oracle@asmlnx1 lib]$ 
[oracle@asmlnx1 lib]$ strings /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so | grep -i odm
kgodm_deregisternic
……………………….
kgodm event %u set to level %u

Tuesday, February 12, 2013

Creating a 11gR2 DB with the create statement

export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export ORACLE_SID=pantst01
export PATH=$PATH:$ORACLE_HOME/bin
export NLA_LANG=american.AL32UTF8
export NLS_DATA_FORMAT=yyyy-mm-dd:hh24:mi:ss


cd /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs
cat init.ora|grep -v ^#>initpantst01.ora

mkdir -p /u01/app/oracle/admin/pantst01/adump
mkdir -p /u02/oradata/PANTST01/controlfile/
mkdir -p /u02/oradata/PANTST01/flash_recovery_area
mkdir -p /u02/oradata/tbl/PANTST01/datafile/
mkdir -p /u02/oradata/undo/PANTST01/tempfile/
mkdir -p /u02/oradata/undo/PANTST01/undofile/
mkdir -p /u02/oradata/redo/PANTST01/onlinelog/

cat initpantst01.ora

db_name='pantst01'
memory_max_target=3g
memory_target=2147483648
processes = 150
audit_file_dest='/u01/app/oracle/admin/pantst01/adump'
audit_trail ='db'
control_files='/u02/oradata/PANTST01/controlfile/control_01.ctl','/u02/oradata/PANTST01/controlfile/control_02.ctl'
db_block_size=8192
db_domain='moh.ad.gov.on.ca'
db_recovery_file_dest='/u02/oradata/PANTST01/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
open_cursors=150
remote_login_passwordfile='EXCLUSIVE'
compatible ='11.2.0'
global_names=true
service_names='pantst01.moh.ad.gov.on.ca'
undo_management='auto'
undo_retention=7200
undo_tablespace='undotbs1'

orapwd file=orapwpantst01 password=oracle entries=20

cat createDatabase.sql

CREATE DATABASE pantst01
   USER SYS IDENTIFIED BY pantst01
   USER SYSTEM IDENTIFIED BY pantst01
   LOGFILE GROUP 1 ('/u02/oradata/redo/PANTST01/onlinelog/redo01.log') SIZE 100M,
           GROUP 2 ('/u02/oradata/redo/PANTST01/onlinelog/redo02.log') SIZE 100M,
           GROUP 3 ('/u02/oradata/redo/PANTST01/onlinelog/redo03.log') SIZE 100M
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   CHARACTER SET AL32UTF8
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '/u02/oradata/tbl/PANTST01/datafile/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/u02/oradata/tbl/PANTST01/datafile/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/u02/oradata/tbl/PANTST01/datafile/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u02/oradata/undo/PANTST01/tempfile/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs1
      DATAFILE '/u02/oradata/undo/PANTST01/undofile/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

---create process
$> export ORACLE_SID=pantst01
[10.69.11.141:ontpand0bav121:oracle@pantst01]/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs
$> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri May 15 15:22:36 2015

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

Connected to an idle instance.

SQL> create spfile from pfile;

File created.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 3207790592 bytes
Fixed Size                  2185840 bytes
Variable Size            2332034448 bytes
Database Buffers          855638016 bytes
Redo Buffers               17932288 bytes

SQL> @createDatabase.sql

Database created.

SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/sqlplus/admin/pupbld.sql


Tuesday, December 11, 2012

rebuild physical standby databse with missed archivelog files

SQL> ALTER DATABASE recover managed standby DATABASE disconnect FROM SESSION;

DATABASE altered.

SQL>

alert log is below:
Tue Nov 13 14:45:26 2012
MRP0: Background Managed Standby Recovery process started (test)
Managed Standby Recovery NOT USING REAL TIME Apply
 parallel recovery started WITH 2 processes
Tue Nov 13 14:45:31 2012
Waiting FOR ALL non-CURRENT ORLs TO be archived...
Media Recovery Waiting FOR thread 1 SEQUENCE 383
Tue Nov 13 14:45:32 2012
Completed: ALTER DATABASE recover managed standby DATABASE disconnect FROM SESSION
Tue Nov 13 14:45:59 2012
Redo Shipping Client Connected AS PUBLIC
-- Connected User is Valid
RFS[2]: Assigned TO RFS process 9542
RFS[2]: IDENTIFIED DATABASE TYPE AS 'physical standby'
RFS[2]: Archived Log: '/arch2/1_385_726529113.dbf'
Tue Nov 13 14:46:02 2012
Fetching gap SEQUENCE IN thread 1, gap SEQUENCE 383-384
Tue Nov 13 14:47:02 2012
FAL[client]: Failed TO request gap SEQUENCE
 GAP - thread 1 SEQUENCE 383-384
 DBID 2024668720 branch 726529113
FAL[client]: ALL defined FAL servers have been attempted.
-------------------------------------------------------------
CHECK that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter IS defined TO a VALUE that IS sufficiently LARGE
enough TO maintain adequate log switch information TO resolve
archivelog gaps.

------------------------------------------------------------------------
--find scn
SQL> SELECT SEQUENCE#,FIRST_CHANGE#,NEXT_CHANGE# FROM v$archived_log WHERE SEQUENCE# > 382 ORDER BY 1;

 SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#
---------- ------------- ------------
       383        740638       740911
       384        740911       740915
       385        740915       740917
       385        740915       740917


------------------------------------------------------------------------
--backup based on scn number
[oracle@primarydb ~]$ cd $ORACLE_HOME/bin
[oracle@primarydb bin]$ ./rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Wed Oct 10 18:51:57 2012

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

connected to target database: TEST (DBID=2024668720)

RMAN> backup device type disk incremental from scn 740638 database format '/tmp/test_db_incre.bbk';

Starting backup at 10-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/oracle/product/oradata/test/test01.dbf
input datafile fno=00007 name=/oracle/product/oradata/test/sysaux01.dbf
input datafile fno=00009 name=/oracle/product/oradata/test/test03.dbf
input datafile fno=00006 name=/oracle/product/oradata/test/undo02.dbf
input datafile fno=00001 name=/oracle/product/oradata/test/system01.dbf
input datafile fno=00005 name=/oracle/product/oradata/test/perfstat.dbf
input datafile fno=00003 name=/oracle/product/oradata/test/rman.dbf
input datafile fno=00002 name=/oracle/product/oradata/test/undo01.dbf
input datafile fno=00008 name=/oracle/product/oradata/test/test02.dbf
input datafile fno=00010 name=/oracle/product/oradata/test/test04.dbf
input datafile fno=00011 name=/oracle/product/oradata/test/test05.dbf
channel ORA_DISK_1: starting piece 1 at 10-OCT-12

channel ORA_DISK_1: finished piece 1 at 10-OCT-12
piece handle=/tmp/test_db_incre.bbk tag=TAG20121010T185204 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03:26
Finished backup at 10-OCT-12

RMAN>

--copy backup piece to standby server
[oracle@primarydb bin]$ cd /tmp
[oracle@primarydb tmp]$ scp test_db_incre.bbk 192.168.3.176:/tmp/backup
The authenticity of host '192.168.3.176 (192.168.3.176)' can't be established.
RSA key fingerprint is a4:54:6b:bf:12:34:42:73:f5:ba:5f:38:c7:28:9c:b5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.3.176' (RSA) to the list of known hosts.
oracle@192.168.3.176's password:
test_db_incre.bbk                             100%  736KB 736.0KB/s   00:00  
[oracle@primarydb tmp]$

------------------------------------------------------------------------
--recover standby database
oracle@standbydb bin]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.4.0 - Production ON Tue Nov 13 15:03:46 2012

Copyright (c) 1982, 2007, Oracle.  ALL Rights Reserved.


Connected TO:
Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - Production
WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options

SQL> ALTER DATABASE recover managed standby DATABASE cancel;

DATABASE altered.

SQL> exit
Disconnected FROM Oracle DATABASE 10g Enterprise Edition Release 10.2.0.4.0 - Production
WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options
[oracle@standbydb ~]$ cd $ORACLE_HOME/bin
[oracle@standbydb bin]$ ./rman target /

Recovery Manager: Release 10.2.0.4.0 - Production ON Tue Nov 13 14:58:25 2012

Copyright (c) 1982, 2007, Oracle.  ALL rights reserved.

connected TO target DATABASE: TEST (DBID=2024668720, NOT OPEN)

RMAN> catalog backuppiece '/tmp/backup/test_db_incre.bbk';

USING target DATABASE control file instead OF recovery catalog
cataloged backuppiece
backup piece handle=/tmp/backup/test_db_incre.bbk recid=49 stamp=799253957

RMAN>  recover DATABASE noredo;

Starting recover at 13-NOV-12
USING target DATABASE control file instead OF recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=97 devtype=DISK
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) TO restore FROM backup SET
destination FOR restore OF datafile 00001: /oracle/product/oradata/test/system01.dbf
destination FOR restore OF datafile 00002: /oracle/product/oradata/test/undo01.dbf
destination FOR restore OF datafile 00003: /oracle/product/oradata/test/rman.dbf
destination FOR restore OF datafile 00004: /oracle/product/oradata/test/test01.dbf
destination FOR restore OF datafile 00005: /oracle/product/oradata/test/perfstat.dbf
destination FOR restore OF datafile 00006: /oracle/product/oradata/test/undo02.dbf
destination FOR restore OF datafile 00007: /oracle/product/oradata/test/sysaux01.dbf
destination FOR restore OF datafile 00008: /oracle/product/oradata/test/test02.dbf
destination FOR restore OF datafile 00009: /oracle/product/oradata/test/test03.dbf
destination FOR restore OF datafile 00010: /oracle/product/oradata/test/test04.dbf
destination FOR restore OF datafile 00011: /oracle/product/oradata/test/test05.dbf
channel ORA_DISK_1: reading FROM backup piece /tmp/backup/test_db_incre.bbk
channel ORA_DISK_1: restored backup piece 1
piece handle=/tmp/backup/test_db_incre.bbk tag=TAG20121010T185204
channel ORA_DISK_1: restore complete, elapsed TIME: 00:00:01
Finished recover at 13-NOV-12

RMAN>