RMAN
Recovery Manager
rman target /
RMAN> list backup of archivelog all; ---zadnja backupovana archiva
deo skripte iz CRONTAB -L (30 22 * * 1-6 /home/oracle/scripts/rman/start_bkp_rman_L_1.sh >/dev/null 2>&1) koja se pusta iz RMAN-a za brisanje arhiva
RMAN>
RUN
{
crosscheck backup of database;
crosscheck backup of spfile;
crosscheck backup of controlfile;
crosscheck backup of archivelog all;
crosscheck archivelog all;
report obsolete;
delete force noprompt obsolete;
delete force noprompt archivelog until time 'sysdate - 1';
delete noprompt expired backupset;
delete noprompt expired archivelog all;
}
sysdate - 1 --- po defaultu je 3 dana
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[oracle@knjaz15 backup]$ rman target /
-- Check the RMAN configuration
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name KNJAZ15 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_knjaz15.f'; # default
-- The below command will backup archive logs and delete the originals that were backed up:
RMAN> backup archivelog all delete input;
-- The below command verifies that all required backups needed for recovery are in place:
RMAN> crosscheck backup;
-- The below will perform a full recovery:
RMAN> shutdown immediate;
RMAN> startup mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open;
-- The below will recover a specific tablespace; the datafile must be taken off line first if the database is up:
RMAN> restore tablespace users;
RMAN> recover tablespace users;
-- The below will recover a specific datafile; must be taken offline first if the database is up:
RMAN> restore datafile 'D:\oradata\UAT\users_01.dbf';
RMAN> recover datafile 'D:\oradata\UAT\users_01.dbf';
-- The below will perform point in time recovery:
run {
shutdown immediate;
startup mount;
set until time 'APR 15 2007 09:00:00';
# set until scn 1000; # alternatively, you can specify SCN --- 1000 will restore up to 999
# set until sequence 1234; # alternatively, you can specify log sequence number --- 1234 will restore up to 1233
restore database;
recover database;
alter database open resetlogs;
}
RMAN> list backup summary; --- lista backup baze radi kopiranja kontrol file koji nije bekapovan sa dbf fajlovima
RMAN> list backup of controlfile; --- pokazace gde je lokacija control backup file a
PRIMER:
===============================================================================================================
primarna - kopiraj
[oracle@knjaz15 dbs]$ scp c-260230255-20151020-00 oracle@10.1.11.132:/home/oracle/backup/
sekundarna
[oracle@tstby132 backup]$ rman target /
RMAN> restore controlfile from '/home/oracle/backup/c-260230255-20151020-00';
RMAN> alter database mount; --- baza u mount stanju
sada na primarnu
RMAN> list backup summary;
RMAN> list backup tag=KNJAZ15_FULL_DB_BACKUP;
sekundarna
RMAN> pusti skriptu
run
{
alocate channel ch1 type disk;
set until scn 2729630;
restore database;
recover database;
}
================================================================================================================
Vrati Arhivu/e
>rman target /
RMAN> restore archivelog sequence 55100 thread 1; --- trazi u backupu odredjenu arhivu
RMAN> restore archivelog from sequence 55100 until sequence 55200 ; --- vraca nekoliko arhiva od - do