Rman backup recovery genel önemli özellikler

Database dbid:
databasein dbisi database bazında controlfile ve spfile dönüşü yapacaksanız ve recovery catalog kullanmıyorsanız önemlidir.

Datafileların yapısı ve fiziksel yerleride bizim için önemlidir. unutulmamalıdırki controlfile database’in fiziksel yapısını tutar

Controlfile record keep time parameterisi defualt özelliği 7 gündür. Recovery catalog olmayan bir databasede rman yedek bilgileri controlfile saklanır. O yüzden bu parametereye dikkat etmemiz gerekir.

Controlfile autobackup özelliğini açmak son derece önemlidir. Bu sayese controlfile ilgilendiren her türlü değişiklikte yedeği otomatik alınır.

Daha ufak backup pieces daha etkilidir.

Rman dbms_backup_restore packagenı kullanır.

7/24 çalışmak için database archive moda almak gerekir.

SQL>shutdown immediate
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;

rmande controlfile otomatik backup alması

RMAN> connect target /
RMAN>Show all;
RMAN>configure controlfile autobackup on ;

basit bir backup örneği burada archiveloglarında yedeği alınacaktır.

RMAN> run
{
Allocate channel d1 type disk format
‘/u01/backup/orcl_full_%T_%s_%p.bkp’;
Backup database plus archivelog;
}
RMAN> list backup summary;

report komutları sayesinde veritabanından rman bazında sorgulama yapabiliriz.

RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
—- ——– ——————– ——- ————————
1 620 SYSTEM YES /u02/oradata/orcl/system01.dbf
2 255 UNDOTBS1 YES /u02/oradata/orcl/undotbs01.dbf
3 460 SYSAUX NO /u02/oradata/orcl/sysaux01.dbf
5 100 Zekeriya NO /u03/oradata/orcl/zekeriya.dbf
6 200 HTML_DB NO /u02/oradata/orcl/html_db_01.dbf
7 50 FLOW_1 NO /u02/oradata/orcl/FLOW_1.dbf
8 100 COLLAB07 NO /u03/oradata/orcl/deneme.dbf
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
—- ——– ——————– ———– ——————–
1 41 TEMP 32767 /u03/oradata/orcl/temp07.dbf

Örnek seneryo.

Controlfile 2 numarayı ve zekeriya.dbf kaybettik diyelim.

Shutdown abort ile database kapatıp.
Diğer çalışan controlfilelardan bir tanesini 2.controlfile lokasyonuna kopyalayıp rename ederiz.
daha sonra database’i mount duruma alırız.

run
{
allocate channel d1 type disk format
‘/u01/backup/orcl_%T_%s_%p.bkp’;
restore datafile ‘/u03/oradata/orcl/zekeriya.dbf’;
}

daha sonra

sqlplus “/ as sysdba”
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: ‘/u03/oradata/orcl/zekeriya.dbf’
SQL> recover database ;
Media recovery complete.
SQL> alter database open;
Database altered.

databasein açılması için butun fileların SCN numaraların aynı olmaları gerekir. O yuzdende recover yapmak zorundayız.

Controlfile yedekten dönme similasyonu

eğer controlfilelarımızı kaybetmissek database en iyi nomount duruma gelir.

RMAN> list backup of controlfile;

RMAN> restore controlfile from autobackup to
‘/yeni/control02.ctl’;

yada

controlfile spesific bir zaman dönmek

RMAN> restore controlfile from autobackup until time
“to_date(’04/12/2008 08:00:00’,’MM/DD/YYYY
HH24:MI:SS’);

Otomatik backupdan değilde spesific bir backuptan controlfile dönmek

RMAN> Run
{ allocate channel device type disk;
restore controlfile
from ‘/u01/oradata/backup/backup_piece_name’;
}

Block corruption seneryosu
–ORA-01578: ORACLE data blockcorrupted (file # 5, block # 24222)
–ORA-01110: data file 5:‘/u03/oradata/orcl/zekeriya.dbf’

SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS
CORRUPTION_CHANGE# CORRUPTIO
———- ———- ———- —————— ———
5 24222 1 0 FRACTURED

Bu corruption hangi blocktan kaynaklanıyor ve hangi objelere karsılık geliyor?

SELECT tablespace_name, segment_type, owner,
segment_name
FROM dba_extents
WHERE file_id = 5
and 24222 between block_id AND block_id + blocks – 1

yapılması gereken rman komutu

run
{
allocate channel d1 type disk format
‘/u01/backup/orcl_%T_%s_%p.bkp’;
blockrecover datafile 5 block 24222;
}

Farklı bir lokasyona inmek

RMAN> run
{
allocate channel d1 type disk format
‘/u01/backup/orcl_%T_%s_%p.bkp’;
set newname for datafile 5 to ‘/u03/oradata/orcl/zekeriya.dbf’;
restore database ;
switch datafile all;
recover database ;
}
Select * from v$datafile;

Restore işlemini PLSQLden yapmak

SQL> alter database datafile
‘/u03/oradata/orcl/zekeriya.dbf’ offline

DECLARE
devtype varchar2(256);
done boolean;
BEGIN
devtype:=sys.dbms_backup_restore.deviceAllocate
sys.dbms_backup_restore.restoreSetDatafile;
sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>6,
toname=>’/u03/oradata/orcl/zekeriya.dbf’);
sys.dbms_backup_restore.restoreBackupPiece(done=>done,
handle=>’/u01/backup/orcl_20081208_15_p.bkp’,
params=>null);
sys.dbms_backup_restore.deviceDeallocate;
END;

üzerine
SQL> recover datafile ‘/u03/oradata/orcl/collab07.dbf’;
Media recovery complete.
SQL> alter database datafile
‘/u03/oradata/orcl/zekeriya.dbf’ online;
Database altered

Nevar ne yoksa geri dönmek. ilk önce database nomount duruma alınır.

RMAN> run
{
allocate channel d1 type disk format
‘/u01/backup/orcl_%T_%s_%p.bkp’;
restore controlfile;
restore database;
}

$ sqlplus “/ as sysdba“
SQL> alter database mount;
SQL> recover database using backup
controlfile;

SQL>alter database open resetlogs

RMAN işimizin durumunu gösteren sql komutu

select l.SID, l.SERIAL#, l.CONTEXT, l.SOFAR, l.TOTALWORK,
round(l.SOFAR/l.TOTALWORK*100,2) “% Complete”,
s.client_info
from v$session_longops l,
v$session s,
v$process p
where l.opname like ‘RMAN:%’
and l.totalwork > 0
and p.addr = s.paddr
and s.sid = l.sid
and s.serial# = l.serial#
and l.opname not like ‘RMAN: aggregate%’
and s.client_info like ‘id=rman_%’
SQL> /
SID SERIAL# CONTEXT SOFAR TOTALWORK % Complete CLIENT_INFO
—– ——- ——- ———- ———- ———- ——————————
47 2201 1 492180 492180 100.00 id=rman_rac_full_backup,rman channel=t1

Advertisements

About oracledocuments

Zekeriya Beşiroğlu, It joined the Bilginc IT Academy in July 2000. In the meantime, the Oracle Education, Oracle Data Base Management System and Oracle Internet Technologies, Oracle development technologies such as the training of Oracle products is responsible for training as consultants. During this task, since 1 April 2008 with 293 Oracle training in total, in 2150 Oracle customers successfully submitted. Oracle 10g New York in November 2002 have received training and education in Turkey was the first time the consultants. 20 April 2008 on education in Turkey 11g is the first who was a consultant. Oracle Real Application Cluster Expert advisor is certified is the first . Http://zekeriyabesiroglu.blogspot.com and Http://www.oracleforum.info owner and manager of the site. Its own has more than one hundred articles. In addition, creation and improvement of training materials are also related to work. Oracle products are used, database management and reporting Academy eruditely It also is working on. From the date of 1 January 2009 will continue to work as the Technical Director
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s