21 November, 2010

Oracle VM Templates released

Oracle has released a number of VM Templates, for different product/technology stacks. See http://www.oracle.com/technetwork/server-storage/vm/templates-101937.html

.
.
.

Some Common Errors - 7 - "We killed the job because it was hung"

Continuing the "Common Errors" series ...

I have come across occasions when a Developer or a DBA has "killed" a job only because "it was hung". If your user or Developer points you to a job that "seems to be 'hung'", as a DBA, it is your responsibility to determine the status of the job from the database instance perspective, not from the user's perspective. Besides the GUI Enterprise Manager screens, Oracle provides numerous views that you can use to monitor the job. Learn to make use of V$SESSION, V$SESS_IO, V$SESSTAT, V$SESSION_WAIT, V$SESSION_EVENT, V$ACTIVE_SESSION_HISTORY to monitor a session.

Never kill and restart a job without at least determining (or to a reasonable degree of confidence) what caused the job to appear to be 'hung' and what action you need to take to ensure that the behaviour doesn't repeat the next time the job is re-run.
If you merely kill a job and expect it to perform better when it is restarted, without determining and fixing the causes, you are likely to incur the displeasure of the user.

As a professional, one of the attributes expected of you is "being able to diagnose a cause for a symptom".

.
.
.

15 November, 2010

"SET TIME ON" in RMAN

"SET TIME ON" in SQLPlus is a SQLPlus client command. It displays the system time from the SQLPlus client program.

If you want RMAN to display "time" you can use NLS_DATE_FORMAT as below :

[oracle@localhost ~]$ env |grep NLS
[oracle@localhost ~]$ NLS_DATE_FORMAT=DD_MON_YYYY_HH24:MI:SS;export NLS_DATE_FORMAT
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Nov 15 06:45:50 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1229390655)

RMAN> backup database;

Starting backup at 15_NOV_2010_06:45:55
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=54 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=47 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/addtl/oracle/oradata/orcl/users01.dbf
input datafile file number=00002 name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/home/oracle/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00006 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1046101119510758.dbf
input datafile file number=00007 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1146416395631714.dbf
input datafile file number=00008 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1170420963682633.dbf
channel ORA_DISK_1: starting piece 1 at 15_NOV_2010_06:45:58
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00014 name=/addtl/oracle/oradata/orcl/hemant01.dbf
input datafile file number=00015 name=/addtl/oracle/oradata/orcl/hemant02.dbf
input datafile file number=00016 name=/addtl/oracle/oradata/orcl/hemant03.dbf
input datafile file number=00009 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1194425963955800.dbf
input datafile file number=00010 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1218408858999342.dbf
input datafile file number=00011 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1242310449730067.dbf
input datafile file number=00012 name=/home/oracle/app/oracle/oradata/orcl/FLOW_1266412439758696.dbf
input datafile file number=00013 name=/home/oracle/app/oracle/oradata/orcl/APEX_1295922881855015.dbf
channel ORA_DISK_2: starting piece 1 at 15_NOV_2010_06:45:58
channel ORA_DISK_2: finished piece 1 at 15_NOV_2010_06:46:01
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_nnndf_TAG20101115T064557_6g2kx70g_.bkp tag=TAG20101115T064557 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 15_NOV_2010_06:46:03
channel ORA_DISK_2: finished piece 1 at 15_NOV_2010_06:46:06
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_ncnnf_TAG20101115T064557_6g2kxcc6_.bkp tag=TAG20101115T064557 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: starting piece 1 at 15_NOV_2010_06:46:07
channel ORA_DISK_2: finished piece 1 at 15_NOV_2010_06:46:08
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_nnsnf_TAG20101115T064557_6g2kxh4q_.bkp tag=TAG20101115T064557 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
...



Notice how the RMAN output shows the Tmestamp in DD_MON_YYYY_HH24:MI:SS format. You could specify an alternate format as well.

[oracle@localhost ~]$ NLS_DATE_FORMAT=DD/MM/YYYY_HH24_MI_SS;export NLS_DATE_FORMAT
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Nov 15 06:50:47 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1229390655)

RMAN> backup datafile 1 ;

Starting backup at 15/11/2010_06_50_53
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=47 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=49 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: starting piece 1 at 15/11/2010_06_50_56
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_2: starting piece 1 at 15/11/2010_06_51_00
channel ORA_DISK_2: finished piece 1 at 15/11/2010_06_51_16
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_ncnnf_TAG20101115T065055_6g2l6obt_.bkp tag=TAG20101115T065055 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:16
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_2: starting piece 1 at 15/11/2010_06_51_17
channel ORA_DISK_1: finished piece 1 at 15/11/2010_06_51_32
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_nnndf_TAG20101115T065055_6g2l6jdx_.bkp tag=TAG20101115T065055 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
channel ORA_DISK_2: finished piece 1 at 15/11/2010_06_51_32
piece handle=/addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_nnsnf_TAG20101115T065055_6g2l763s_.bkp tag=TAG20101115T065055 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:15
Finished backup at 15/11/2010_06_51_32

RMAN>


Thus, I can change the format of the time display with NLS_DATE_FORMAT.

I can also display backup timestamps etc in the desired format :

[oracle@localhost ~]$ NLS_DATE_FORMAT=DD_MON_RR_HH24_MI_SS
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Nov 15 06:54:15 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (DBID=1229390655)

RMAN> list backup of datafile 1;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
21 Full 666.52M DISK 00:00:48 26_OCT_10_07_17_31
BP Key: 21 Status: AVAILABLE Compressed: NO Tag: TAG20101026T071642
Piece Name: /addtl/oracle/flash_recovery_area/ORCL/backupset/2010_10_26/o1_mf_nnndf_TAG20101026T071642_6dfrpcdn_.bkp
List of Datafiles in backup set 21
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 5323127 26_OCT_10_07_16_43 /home/oracle/app/oracle/oradata/orcl/system01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
27 Full 953.77M DISK 00:04:42 26_OCT_10_07_23_15
BP Key: 27 Status: AVAILABLE Compressed: YES Tag: TAG20101026T071833
Piece Name: /addtl/oracle/flash_recovery_area/ORCL/backupset/2010_10_26/o1_mf_nnndf_TAG20101026T071833_6dfrst78_.bkp
List of Datafiles in backup set 27
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 5323217 26_OCT_10_07_18_33 /home/oracle/app/oracle/oradata/orcl/system01.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ------------------
34 Full 668.63M DISK 00:00:34 15_NOV_10_06_51_30
BP Key: 34 Status: AVAILABLE Compressed: NO Tag: TAG20101115T065055
Piece Name: /addtl/oracle/flash_recovery_area/ORCL/backupset/2010_11_15/o1_mf_nnndf_TAG20101115T065055_6g2l6jdx_.bkp
List of Datafiles in backup set 34
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------ ----
1 Full 5442510 15_NOV_10_06_50_56 /home/oracle/app/oracle/oradata/orcl/system01.dbf

RMAN>


This is useful when you are looking for backups within a particular time range and yo uhave had multiple backups done on the same day. The format can be modified to show Hours_Minutes_Seconds as well.
.
.
.

01 November, 2010

Most Popular Posts - Oct 10

Blogger's "Stats" feature shows that the 3 most popular posts in the past 30 days have been :

3. AUTOEXTEND ON Next Size : 198 pageviews

.
.
.