Tuesday, June 12, 2012

VI EDITOR

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





Top 5 AIX performance tools used are:
1.       Vmstat
2.       Topas
3.       Iostat
4.       Netstat
5.       Ps
Vmstat:
Gives:
i.      Traps
ii.      Virtual memory
iii.      Paging
iv.      CPU
v.      Number of interrupts per second
vi.      Kernel threads
Iostat:
Gives:
i.      CPU usage
ii.      i/o of disk, adapter, ttys
iii.      i/o subsystem
topas:
Gives:
i.      logical partition information (# topas -L)
ii.      processes(# topas -P)
iii.      file system(# topas -F)
iv.      disks(# topas -D)
For CPU Monitoring,
Admin can make use of:
netpmon
sar (sar -u)
topas
For memory monitoring,
Admin can make use of:
svmon
netpmon
filemon
Svmon and filemon are perfagent tools.
For I/O subsystem,
Admin can make use of:
fileplace
filemon
For Network,
tcpdump
netpmon
For processors and threads,
svmon
kdb
fuser
prof
truss
nmon will give entire OS performance information.
Mpstat: this command displays performance statistics of all logical CPU in system.
Lparstat: reports LPAR related information and statistics.
Traced based commands:
CPU Monitoring: tprof, trace, trcrpt
Memory: trace, trcrpt
i/o subsystem: trace, trcrpt
network: iptrace, trace, trcrpt
processes and threads: tprof, trace, trcrpt
SAR: System Activity Records: it collects reports and saves system activity information.
Happy Learning!

Thursday, May 17, 2012

CREATE PHYICAL STANDBY DABASE



RAC PRIMARY DATABASE 105 AND 106----SFXDB

work on 105 (sfxdbs1) host(sfxprod1.safexpress.com)

alter system set log_archive_dest_4='SERVICE=testdb ASYNC DB_UNIQUE_NAME=testdb VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE)'

alter system set log_archive_dest_state_4='DEFER';

alter system set log_archive_config='DG_CONFIG=(SFXDBS,SFXDB,SFXSDB,TESTDB)';

alter system set fal_server='sfxdb,sfxsdb,testdb'

add following entry in tnsora file

TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =TESTDB)
    )
  )



work on 106 (sfx2) host (sfxprod2.express.com)

alter system set log_archive_dest_4='SERVICE=testdb ASYNC DB_UNIQUE_NAME=testdb VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE)'

alter system set log_archive_dest_state_4='DEFER';

alter system set log_archive_config='DG_CONFIG=(SFXDBS,SFXDB,SFXSDB,TESTDB)';

alter system set fal_server='sfxdb,sfxsdb,testdb'

add following entry in tnsora file

TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =TESTDB)
    )
  )




WORK ON STANDBY DATABASE 166

1-CREATE PFILE------initTESTDB.ora

*.cluster_database=false
*.compatible='11.2.0.0.0'

*.control_files='/d01/oradata/testdb/control01.ctl','/d01/oradata/testdb/control02.ctl'

*.db_file_name_convert='+SFXDATA/sfxdbs/datafile','/d01/oradata/testdb/',
'+SFXDATA/sfxdbs/tempfile','/oracle/flash_recovery_area/testdb/'

*.db_name='sfxdb'
*.db_unique_name='testdb'
*.fal_client='testdb'
*.fal_server='sfxdbs'
*.log_archive_config='DG_CONFIG=(sfxdbs,testdb)'
*.log_archive_dest_1='LOCATION=/oracle/flash_recovery_area/testdb valid_for=(ALL_LOGFILES,ALL_ROLES) db_unique_name=testdb'
*.log_archive_dest_2='SERVICE=sfxdbs ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=sfxdbs'

*.log_file_name_convert='+SFXDATA/sfxdbs/onlinelog','/d01/oradata/testdb/'



2-Add following entry in tnsora file

TESTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =testdb)
    )
  )


SFXDBS2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = sfxprod2-vipi111)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sfxdbs)
    )
  )

SFXDBS1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = sfxprod1-vipi111)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sfxdbs)
    )
  )

SFXDBSCAN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = propeldb1_scan1.safexpress1.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = sfxdb)
    )
  )


sqlplus> startup nomount pfile='--------';

rman target sys/.....@sfxdb auxiliary /

rman>duplicate target database for standby;








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;



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%’;


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;






Tuesday, May 15, 2012

archive


run{
backup
format '/abc/log_%t_%sp%p'
archivelog from logseq =4 until logseq =11 thread 1;
}


run
{
 set archivelog destination to '/ddd';
restore archivelog from logseq=4 until logseq=10;
}