Oracle ipuçları -3- RMAN
İpucu | Hakan Bayraktar | October 10, 2009 at 3:32 pm
Yeni bir katalog oluşturma
create a tablespace
create a user
grant connect, resource, recovery_catalog_owner to user
rman catalog user/pass@db
create catalog tablespace “<tablespace_name>”;
Database kayıt etme(register)
rman catalog user/pass@rmandb target user/pass@db
register database;
Databese’den kayıt iptalı (Un-register)
sqlplus user/pass@rmandb
select * from rc_database;
select db_key, db_id from db;
Katalog bilgilerini resetleme
reset database;
Katalog ile control file arasında senkronize etme
resync catalog;
Backup silme
allocate channel…
delete backuppiece <number>;
release channel;
Backup alma
backup database plus archivelog format ‘/u01/ora_backup/rman/%d_%u_%s’;
run {
allocate channel t1 type disk;
backup current controlfile format ‘/u01/ora_backup/rman/%d_%u_%s’;
backup database format ‘/u01/ora_backup/rman/%d_%u_%s’;
backup archivelog all delete input format ‘/u01/ora_backup/rman/arch_%d_%u_%s’;
release channel t1;
}
Cold backup
run {
allocate channel t1 type disk;
shutdown immediate;
startup mount;
backup database include current controlfile format ‘/u01/ora_backup/rman/%d_%u_%s’;
alter database open;
}
run {
allocate channel t1 type disk;
backup archivelog all delete input;
}
Restore/recover a database
Full restore and recovery
startup nomount;
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
restore controlfile;
restore archivelog all;
alter database mount;
restore database;
recover database;
}
sql ‘alter database open resetlogs’;
Belirli bir zamana restore etme
startup nomount;
run {
set until time =”to_date(’30/08/2006 12:00′,’dd/mm/yyyy hh24:mi’)”;
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
restore controlfile;
restore archivelog all;
alter database mount;
restore database;
recover database;
}
sql ‘alter database open resetlogs’;
Eğer archive logs hazırda varsa
startup mount;
run {
set until time =”to_date(’08/02/2007 14:00′,’dd/mm/yyyy hh24:mi’)”;
allocate channel t1 type disk;
allocate channel t2 type disk;
allocate channel t3 type disk;
allocate channel t4 type disk;
restore database;
recover database;
}
sql ‘alter database open resetlogs’;
startup mount;
run {
allocate channel t1 type disk;
recover database;
}
Controlfile backup kayıtlarını görmek için
set pages 999 lines 100
col name format a60
break on set_stamp skip 1
select set_stamp
, to_char(ba.completion_time, ‘HH24:MI DD/MM/YY’) finish_time
, df.name
from v$datafile df
, v$backup_datafile ba
where df.file# = ba.file#
and ba.file# != 0
order by set_stamp, ba.file#
/
Eski archive logları silmek için
DELETE NOPROMPT ARCHIVELOG UNTIL TIME “SYSDATE-5″
Kullanılabileceğimiz archivelogları görmek için.
change archivelog all crosscheck;
Tags: backup, Oracle, Oracle 10g, Oracle 11G, rman, VERITABANI

Tweet This
Digg This
Save to delicious
Stumble it



