Thursday, 28 June 2012

RMAN BACKUP

weekly incremental backup
run
{
backup as compressed backupset
incremental level=0 cumulative
device type disk
tag "weekly_cum_database"
format '+backup/weekly_cum_database_%d_t%t_c%c_s%s_p%p'
database;
backup as backupset
device type disk
tag "ARCHIVELOGS"
format '+backup/daily_archivelog_%d_t%t_c%c_s%s_p%p'
archivelog all;
}


daily incremental backup
run
{
backup as compressed   backupset
incremental level=1 cumulative
device type disk
tag "daily_cum_database"
format '+backup/daily_cum_database_%d_t%t_c%c_s%s_p%p'
database;
backup as backupset
device type disk
tag "ARCHIVELOGS"
format '+backup/daily_archivelog_%d_t%t_c%c_s%s_p%p'
archivelog all;
}

RMAN Performance

Monitoring RMAN Job Progress

select sid, serial#, sofar, totalwork, opname,
round(sofar/totalwork*100,2) "% Complete"
from v$session_longops
 where opname LIKE 'RMAN%'
and opname NOT LIKE '%aggregate%'
 and totalwork != 0
and sofar <> totalwork;

 set lines 300 
set operation format a10 
alter session set optimizer_mode=RULE; 
alter session set nls_date_format = 'dd/mm/yyyy hh24:mi:ss'; 
select distinct p.tag,r.object_type,r.SESSION_RECID,r.START_TIME,r.END_TIME,(r.END_TIME-r.START_TIME)*24 "ET(Hr)", 
r.OUTPUT_BYTES/1048576/1024 "SIZE (GB)",r.status,r.OUTPUT_DEVICE_TYPE,r.input_bytes/1048576 "input (MB)",INPUT_BYTES_PER_SEC/1048576 "read (MB/sec)",r.output_bytes/1048576 "output (MB)",OUTPUT_BYTES_PER_SEC/1048576 "output (MB/sec)" 
from v$backup_piece p,v$rman_status r, v$rman_backup_job_details d 
where p.RMAN_STATUS_RECID=r.RECID and p.RMAN_STATUS_STAMP=r.STAMP 
and r.status like '%COMPLETED%' and r.OPERATION like '%BACKUP%' 
and r.object_type like 'DB%' 
and d.SESSION_RECID=r.SESSION_RECID;



SQL>alter session set nls_date_format=’dd/mm/yy hh24:mi:ss’;
select sid, totalwork, sofar, (sofar/totalwork) * 100 per_done,start_time, sysdate + time_remaining/3600/24 end_at
from v$session_longops
where totalwork > sofar
and lower(opname) not like ‘%aggregate%’
and lower(opname) like ‘rman%’;
For Export:

SQL>alter session set nls_date_format=’dd/mm/yy hh24:mi:ss’;

SQL>
select sid, totalwork, sofar, round((sofar/totalwork) * 100) done,start_time,sysdate + time_remaining/3600/24 end_at
from v$session_longops
where totalwork > sofar
and upper(message) like ‘%EXPORT%’;

For Import:
SQL>alter session set nls_date_format=’dd/mm/yy hh24:mi:ss’;

SQL>
select sid, totalwork, sofar, round((sofar/totalwork) * 100) per_done,start_time,sysdate + time_remaining/3600/24 end_at
from v$session_longops
where totalwork > sofar
and upper(message) like ‘%IMPORT%’;

scripts to check backup status and timings of database backups -
This script will be run in the database, not the catalog.

Login as sysdba -

This script will report on all backups – full, incremental and archivelog backups -
col STATUS format a9
col hrs format 999.99

select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;

This script will report all on full and incremental backups, not archivelog backups -
col STATUS format a9
col hrs format 999.99

select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
order by session_key;

Saturday, 23 June 2012

vi Editor on AIX

VI Editor

A: append at the end of line.

I: insert at begin of line.

i: insert at cursor.

a: at next cursor.

G: end of the file.

1G: Go to first line.

nG: goes to nth line.

G: end of file.

M: Middle of the screen.

H: HOME, ie, top left of the current screen.

nG: go to line n.

To search a word :?wordname

h: move cursor left one character

j: move cursor down one line

k: move cursor up one line

l: move cursor right one character

vi -r filename: recover filename that was being edited when system crashed.

o: open and put text in a new line below current line

O: open and put text in a new line above current line

r: replace single character under cursor

R: replace characters, starting with current cursor position

C: change (replace) the characters in the current line

cc: change (replace) the entire current line

dgg: delete above lines

dG: delete below lines

Command mode

Editing mode

Insert mode

Four ways of insert

i at the same cursor position

Capital A

To the end of the line.

Capital I

Begin of the line.
Small a

Next to the cursor position

To copy a single line
yy

5yy

for five lines copy

nyy
n number of lines can copy.

1G
Goes to first line

10G
Goes to tenth line

11G
Goes to eleventh line

nG
Goes to the nth position

1H
Goes up to the current screen

Capital G
Goes to the end of the page

yw
To copy a word

nyw
n number of words can be copied

x
One character delete

dw
One word delete

dd
Delete a line

ndd
n number of lines can be deleted

To replace a character

Type small r and then type character.

To replace many characters from the cursor position Type capital R

Thursday, 21 June 2012

Clear cache in oracle R12

Unable to authenticate session. --Oracle apps R12
Bring down services of application then complile jsps

cd $FND_TOP/patch/115/bin
perl ojspCompile.pl --compile --flush -p 2

Run autoconfig on both db and apps tiers

Bring up the services and test login
Cleared internet cache(browser cache)..