2016年7月29日 星期五

OCP 11gR2: Administration II 練習筆記 (三)

Lession 03
=================================================
01. backup as backupset
- RMAN backup method are [backupset | copy] default is backupset.
- backup command run by serial

- Whole database backup command is "backup database plus archivelog"
  plus archivelog purpose is maintain log folder size.

- backup as copy [datafile|tablespace|database|archivelog];
  only on disk and not in FRA
  show records by "list copy"
  it support incremental backup



02. RMAN backup types
- backup database; <- Whole database backup.
- backup incremental level 0 database; <- Full database backup.

- backup incremental level 1 database; <- Incremental backup base on level 0.
  Level 1 with 2 types [differential  | cumulative] default is defferential


SUN
MON
TUE
WED
THU
FRI
SAT

LV0
LV1
LV1
LV1
LV1
LV1
LV1

D
<------
<------
<------
<------
<------
<------
24HR/DAY
C
<------





24HR/DAY
C
<--------------------




48HR/DAY
C
<----------------------------------



72HR/DAY
C
<------------------------------------------------


96HR/DAY
C
<--------------------------------------------------------------

120HR/DAY
C
<-----------------------------------------------------------------------------
148HR/DAY



03. Fast incremental backup
- not support save log in FRA
- block change tracking default is off
- enable command "alter database enable block change tracking using file 'location';
  after enable, it will not affect on coming incremental backup, it effective on next.

- OMF, parameter db_create_file_dest
  include [datafile, tempfile, redo, controlfile, block change tracking]



04. Proxy copy (OCP exam not test)
- backup to SAN via MML (media manage libarary)



05. create duplexed backup
- duplex support disk and sbt
- duplex not support image
- duplex cannot backup in FRA, must use "FORMAT"
  backup as backup set copies 2 database format '/tmp';
  or by configure



06. backup the backupset and FRA
- move all backupset to sbt by command "backup device type sbt backupset all;"
- backup FRA by command "backup recovery area;" or "backup recovery files;"


07. backup readonly tablespace (do not use this function)
- consider retention policy with backup optimization
- skip readonly no relationship with optimization
  the command is "backup database skip readonly;"



08. Multisection backup
- if datafile very large, use multisection to limited backuppiece size
- fast complete backup with parallel (common use)
- use multisection with parallel command as below:

RMAN> configure device type disk parallelism 4;
run {
allocate channel ch1 device type disk format '/tmp/bak1_%U';
allocate channel ch2 device type disk format '/tmp/bak2_%U';
allocate channel ch3 device type disk format '/tmp/bak3_%U';
allocate channel ch4 device type disk format '/tmp/bak4_%U';
backup section size 500M database; }

- if you have only 1 disk and config parallel to 4, the performance will be affect.



09. Archival backup
- backupset not affect by retention policy
- cannot use on FRA
- change backupset to archival backup as below:
  change backup tag 'name' keep forever;



10. RMAN report & dynamic view
report schema;
report need backup;
report obsolete
v$backup_set;
v$backup_piece;
v$datafile_copy;
v$backup_files;




11. Recovery Non-critical & critical recovery
Tempfile lost:
- Cannot sort table from "order by", also EM will have error
- automatic re-create of tempfile when restart <- if file corrupted, restart cannot fix
- manual re-create:
 "alter tablespace temp add tempfile '/location/temp02.dbf' size 500M autoextend on;"
 "alter tablespace temp drop tempfile '/location/temp01.dbf';"

Loss of a redo log group:
- current log corrupted and instance crashed, need cancel-based point in time recovery.
- current log corrupted but instance not crash. Perform alter log switch and checkpoint.
- inactive & active log corrupted, use clear log command.
        Below command for reference:
        "alter database clear logfile group [1|2|3];"  <- inactive status run, no data loss.
        "alter database clear unarchived logfile group [1|2|3];" <- active status run, when recovery will data loss.
        "alter database clear unarchived logfile group [1|2|3] unrecoverable datafile;" <- if the datafile offline and     need to clear unarchived logfile you need to add unrecoverable datafile

Index tablespace recovery:
- if datafile lose only contains indexes, no need perform recover task.
 Drop datafile, drop the tablespace(index only), re-create the index tablespace, re-create indexes that in tablespace.
- use parallel to reduce time for re-create index
 create index 'name' on 'schema.table'('column') parallel 4;

all controlfile loss
- open resetlogs

Readonly tablespace
- take tablespace offline
- restore tablespace
- bring tablespace online

No logging object
- drop it and re-create
 Use report unrecoverable
 Drop table 'table_name';
 Create table 'table_name' nologging;
 Insert /*+ append */ into 'table_name' select * from 'source_table';

Authentication for database
- SYS can use O/S auth but other role cannot, they are maintenance by password file.
 Recovery or reset
 orapwd filename='/location/name.ora' password='password' enries=10
 re-grant role to user


12. Complete & Incomplete recovery
- complete recovery - no data loss
                                - need datafile, archivelog, redo log and undo tablespace apply
- incomplete recovery - bring database to point in time recovery
                                - no need redo log and some archive missing

                                - undo tablespace apply and resetlogs to open db.


OCP 11gR2: Administration II 練習筆記 (四)

OCP 11gR2: Administration II 練習筆記 (二)

沒有留言:

張貼留言