Вы находитесь на странице: 1из 5

04 Configuring RMAN Backup Specifications.

avi ############################################# - xem v tr lu ca control file, logfile v data file select name from v$controlfile; show parameter control_files; select member from v$logfile; select name from v$datafile; - backup controlfile RMAN> alter database backup controlfile to trace as 'D:\backup\controlfiel.bkp'; RMAN> backup database; hay backup database plus archivelog; RMAN> run { 2> allocate channel c1 device type disk format 'E:\backup1\%U'; 3> allocate channel c2 device type disk format 'E:\backup2\%U'; 4> backup database; 5> } - bt RMAN> RMAN> RMAN> tnh nng optimization ln v config show all; configure backup optimization on; configure device type disk backup type to compressed backupset;

- reset optimization v gi tr mc nh RMAN> configure device type disk clear; 05 Using the RMAN Recovery Catalog.avi ############################################# - backup OS> rman target / catalog rman/rman@oradb - to script RMAN> create script backup_db {backup database plus archivelog;} - chy script RMAN> run {execute script backup_db;} - xem ni dung script cha ci g trong RMAN> print script backup_db; - export script file to file name *.rman RMAN> print script backup_db to file 'backup_db.rman'; + Maintenance RC - synchronize Catalog vi controlfiel RMAN> resync catalog; - Thng xuyn backup Recovery Catalog (RC) - Reporting: OS> sqlplus / as sysdba SQL> conn rman/rman@oradb Contain Views: rc_store_script, rc_rman_status, rc_rman_configuration, rc_datab ase + Vitual Private Catalog: - Procedures:

. . . .

create delegate user in RC database grant recovery_catalog_owner create Virtual Catalog grant catalog (using RMAN) for specified db to user

- Example: [cmd1] OS> sqlplus / as sysdba SQL> create tablespace catalogts 2 datafile 'E:\recovery\catalogts_01.dbf' size 500M; SQL> create user rman identified by rman 2 temporaty tablespace temp 3 default tablespace catalogts 4 quota unlimited on catalogts; SQL> grant recovery_catalog_owner to rman; OS> rman catalog rman/rman@oradb hema) RMAN> create catalog; RMAN> exit (only backup catalog database/sc

OS> rman target / catalog rman/rman@oradb (connect vo targe t db v catalog lun) RMAN> register database; ( register database vo catalog, -> full sync of recovery catalog) RMAN> create script backup_db 2 {backup database plus archivelog;} RMAN> run{execute script bacup_db;} RMAN> list all script names; ) RMAN> print script backup_db; cript ra mn hnh) RMAN> delete script backup_db; RMAN> replace script backup_db 2 {backup database plus archivelog delete input;} archive redolog file sau khi backup seccessful) (list all script (show ni dung ca s (xa script) (delete

ngoi ra ta c th to 1 file cha cc cmd trong file v dng lnh run script RMAN> create script rmansettings from file 'E:\rman.txt'; RMAN> run {execute script rmansettings;} ni dung ca file rman.txt l run {show all;} (bt 1 ca s cmd khc ln, run cmd [cmd2]) OS> sqlplus /nolog SQL> conn rman/rman@oradb SQL> desc rc_stored_script; Name Null? Type -----------------------------------------------------DB_KEY Number DB_NAME Varchar2(8) SCRIPT_NAME NOT NLUL Varchar2(100) SCRIPT_COMMENT Varchar2(225) SQL> desc rc_rman_status; SQL> desc rc_rman_configuration; SQL> desc rc_database;

06 Using RMAN to Create Backups.avi ############################################# SQL> show paramter recovery; recovery parallelism ca db recovery) (show ch lu, size,

SQL> rman target / RMAN> report schema; (show info permanent dat afile: v tr ..) RMAN> configure maxsetsize to 2Gb; (default unlimited) RMAN> configure device type disk parallelism 3; (chnh ln chy multiplexed l 3 channel cng lc) RMAN> configure controlfile autobackup on; (bt tnh nng t ng backu p controlfile) RMAN> configure retention policy to redundancy 2; ( RMAN> configure device type disk backup type to compressed backupset; (backup dng nn tit kim dung lng)

RMAN> report schema; ( list ra cc tablespace (TS) trong db) -> show ra dc STT ca cc TS vd: STT 4 l TS " Users " RMAN> backup as copy datafile 4; (mc d dc set bc trn parallelism l 3 n g khi backup datafile ch c 1 channel chy thi) RMAN> backup incremental level 0 database tag Backup_Level1; (sau khi backup INCREMENTAL th n to ra tn file dng ***Backup_Level1_***.bkp) RMAN> backup incremental level 1 database tag Backup_Diff; (sau khi backup DIFFERENTIAL th n to ra tn file dng ***Backup_Diff_***.bkp) tng t c th to backup cumulative backup RMAN> list backup summary; (show thng tin danh sch cc ln backup)

- duplexed backup - redundancy backup/copy RMAN> backup device type disk copies 2 database (lnh ny s backup nhn g chia ra lu 2 bn 2 folder l backup1 v backup2 - redundancy backup/copy) 2> format 'E:\backup1\%U', 'E:\backup2\%U'; - multiplexed backup RMAN> run { (nh vd ny khi chy th channel c1 s backup redolog cn channel c2 s backup datafile) 2> allocate channel c1 device type disk maxopenfiles 4; 3> allocate channel c2 device type disk maxopenfiles 4; 4> backup filesperset 4 database; 5> } - multi-section backup to backup large datafile | tng tc backup Logon vo Oracle Enterprise Manager OEM -> tab Server -> Datafiles -> Create FileName: USERS_02.DBF | File Directory: ch n ni lu | TableSpace: USERS, file size ?M B, autoextend ?M, maxsize unlimited Nhn Show SQL xem: alter tablespace 'USERS' add datafile 'D:\app\Administrator\Oradata\ORCL \USERS_02.DBF' size 1500M autoextend next 100M maxsize unlimited RMAN> report schema; (xem thng tin TS mi dc add vo cha)

RMAN> run { 2> allocate channel c1 3> allocate channel c2 4> allocate channel c3 5> backup section size 6> }

device type disk; device type disk; device type disk; 500M datafile 6;

OCA Restoration ############################## select name from v$controlfile; shutdown copy cf startup nomount SQL> show parameter control_files SLQ> shutdown immedaite; SQL> show parameter diagnostic n nm u)

(show HOME PATH ca Oracle

move control file i ch khc gi lp controlfiel b crash SQL> startup < bo li xem log db\oradb\trace\alert_oradb.log OS> rman target / catalog=rman@oradb adb(not mounted) RMAN-00554, 04004 OS> RMAN target / RMAN> startup nomount; RMAN> restore controlfile from autobackup;

C:\oracle\diag\rdbms\ora

( bo li: connected to database: or

( retstore li controlfile)

-Sau khi restore xong th khi mnh start Oradb ln th s b bo li do inconsistence control e OS> sqlplus / as sysdba SQL> shutdown immediate; SQL> startup; (error: ORA-01589: must use RESETLOGS or NOTRESE TLOGS option for db open) SQL> recover datafile 'C:\Oracle\oradata\oradb\system01.dbf';

Оценить