Sunteți pe pagina 1din 6

backup incremental

modus operandi:
1. Mount primary .. take full backup
RMAN> startup mount;
RMAN> backup database plus archivelog;
2. start primary .. create a lot of tables
RMAN> shutdown immediate;
RMAN> startup;
SQL> create table table_dummy as select * from dba_tables;
SQL> insert into table_dummy select * from table_dummy; - rep t
his multiple times
3. switch lot of logfiles ..
this will happen automatically as the table gets large
just commit;
**** dont start the listeners just yet
4. now mount the standby and take a full backup
5. now check the current SCN of the standby
SQL> select current_scn from v$database;
6. take incremental backup on primary for standby
RMAN> backup incremental from scn <current_scn> database format
'/tmp/forStandby_%U' tag 'forStandby';
7. send over the files to the standby server
scp /tmp/forStandby_%U oracle@dg2:/tmp/
8. catalog the files using RMAN with standby as target
RMAN> catalog start with '/tmp/forStand';
9. recover standby database with noredo - recover the standby database w
ith cataloged incremental backup
RMAN> recover database noredo
10. this is in case changes to the database structure have been made:
with RMAN target as primary, backup current controlfile for stan
dby
RMAN> backup current controlfile for standby format '/tmp/forSta
ndbyCtrl.bkp'
11. send over the contrlfile backup to standby.
scp /tmp/forStandbyCtrl.bkp oracle@dg2:/tmp/

12. shutdown standby and start in nomount mode


RMAN> shutdown immediate;
RMAN> startup nomount;
13. connect RMAN with target as standby and restore the controlfile from
the standby controlfile just generated
RMAN> restore standby controlfile from '/tmp/forStandbyCtrl.bkp'
;
14. ensure that the db_file_name_convert and the log_file_name_convert p
arameters are set appropriately
15. clear the SRL groups on standby
alter
alter
alter
alter

database
database
database
database

clear
clear
clear
clear

logfile
logfile
logfile
logfile

group
group
group
group

4;
5;
6;
7;

16. toggle the flshback to invalidate the prior flshback logs (probly)
alter database flashback off;
alter database flashback on;
17. start the MRP.
---------------------------Physical Standby database has NOLOGGING changes on a subset of datafiles
To create this scenario we'll have to turn off force logging, th
en create a table without logging in the users tablespace.
1. create a table on primary and insert values
SQL> desc tmp_tab01
Name
Null?
Type
----------------------------------------- -------- --------------------------A

NUMB

ER
SQL> select * from tmp_tab01;
A
---------1
1
1
1
1
2. create another table on primary as CTAS as:
SQL> create table tmp_tab05 tablespace users nologging a
s select * from tmp_tab01;

Table created.
SQL> select * from tmp_tab05;
A
---------1
1
1
1
1

3. check the contents of this table at standby


SQL> desc tmp_tab05
Name
Null?
Type
----------------------------------------- -------- --------------------------A

NUMB

ER
SQL> select * from tmp_tab05;
select * from tmp_tab05
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block
# 235)
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl1/u
sers01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING opt
ion
In Alert Log file at standby
Errors in file /u01/app/oracle/diag/rdbms/orcl1/orcl1/tr
ace/orcl1_ora_4775.trc (incident=25353):
ORA-01578: ORACLE data block corrupted (file # 4, block
# 235)
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl1/u
sers01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING opt
ion
Incident details in: /u01/app/oracle/diag/rdbms/orcl1/or
cl1/incident/incdir_25353/orcl1_ora_4775_i25353.trc
Errors in file /u01/app/oracle/diag/rdbms/orcl1/orcl1/tr
ace/orcl1_ora_4775.trc (incident=25354):
ORA-01578: ORACLE data block corrupted (file # 4, block
# 235)
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl1/u
sers01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING opt
ion
Incident details in: /u01/app/oracle/diag/rdbms/orcl1/or
cl1/incident/incdir_25354/orcl1_ora_4775_i25354.trc
Only the following operations can make use of nologging:
SQL*Loader in direct mode

INSERT /*+APPEND*/ ...


CTAS
ALTER TABLE statements (move/add/split/merge partitions)
CREATE INDEX
ALTER INDEX statements (move/add/split/merge partitions)
4. check the nologging scn from the standby
select file#, name, first_nonlogged_scn, unrecoverable_c
hange#, unrecoverable_time from v$datafile;
FILE# NAME
FIRST_NONLOGGED_SCN UNRECOVERABLE_CHANGE# UNRECOVER
---------- --------------------------------------------------------------- --------------------- --------1 /u01/app/oracle/oradata/orcl1/system01.dbf
0
0
2 /u01/app/oracle/oradata/orcl1/sysaux01.dbf
0
0
3 /u01/app/oracle/oradata/orcl1/undotbs01.dbf
0
0
4 /u01/app/oracle/oradata/orcl1/users01.dbf
1037043
0
5 /u01/app/oracle/oradata/orcl1/tmp_perm01.dbf
0
0
5. cancel the standby managed recovery aka redo apply
6. Offline the datafiles on standby that have the nologging chan
ges
The FOR DROP keywords mark the datafile for subsequent d
ropping. Such a datafile can no longer be brought back online.
Note:
This operation does not actually drop the datafile.
It remains in the data dictionary, and you must drop it
yourself using one of the following methods:
An ALTER TABLESPACE ... DROP DATAFILE statement.
After an OFFLINE FOR DROP, this method works for dic
tionary managed tablespaces only.
A DROP TABLESPACE ... INCLUDING CONTENTS AND DATAFILES
statement
If the preceding methods fail, an operating system com
mand to delete the datafile.
This is the least desirable method, as it leaves refer
ences to the datafile in the data dictionary and control files.
alter database datafile 4 offline for drop;
7. start redo apply on standby
8. rman connect to primary as target, create incremental backup
for the file with nologging changed from the first nologging scn
backup incremental from scn 1037043 datafile 4 format '/

tmp/forStandbyUsers%U' tag 'forStandbyUsers';


9. transfer incremental backups to the standby site
10. catalog incremental backups at standby site
catalog start with '/tmp/forStandyUsers';
11. stop redo apply
12. recover the datafile from the incremental backup
recover datafile 4 noredo;
SQL> select file#, name, first_nonlogged_scn, unrecovera
ble_change#, unrecoverable_time from v$datafile;
FILE# NAME
FIRST_NONLOGGED_SCN UNRECOVERABLE_CHANGE# UNRECOVER
---------- --------------------------------------------------------------- --------------------- --------1 /u01/app/oracle/oradata/orcl1/system01.dbf
0
0
2 /u01/app/oracle/oradata/orcl1/sysaux01.dbf
0
0
3 /u01/app/oracle/oradata/orcl1/undotbs01.dbf
0
0
4 /u01/app/oracle/oradata/orcl1/users01.dbf
0
0
5 /u01/app/oracle/oradata/orcl1/tmp_perm01.dbf
0
0
SQL> select file#, name, status from v$datafile;
FILE# NAME
STATUS
---------- --------------------------------------------------1 /u01/app/oracle/oradata/orcl1/system01.dbf
SYSTEM
2 /u01/app/oracle/oradata/orcl1/sysaux01.dbf
ONLINE
3 /u01/app/oracle/oradata/orcl1/undotbs01.dbf
ONLINE
4 /u01/app/oracle/oradata/orcl1/users01.dbf
RECOVER
5 /u01/app/oracle/oradata/orcl1/tmp_perm01.dbf
ONLINE
alter database datafile 4 online;
SQL> select file#, name, status from v$datafile;
FILE# NAME
STATUS
---------- --------------------------------------------------1 /u01/app/oracle/oradata/orcl1/system01.dbf
SYSTEM
2 /u01/app/oracle/oradata/orcl1/sysaux01.dbf

ONLINE
3 /u01/app/oracle/oradata/orcl1/undotbs01.dbf
ONLINE
4 /u01/app/oracle/oradata/orcl1/users01.dbf
RECOVER
5 /u01/app/oracle/oradata/orcl1/tmp_perm01.dbf
ONLINE
alter database recover managed standby database using cu
rrent logfile disconnect;
SQL> select file#, name, status from v$datafile;
FILE# NAME
STATUS
---------- --------------------------------------------------1 /u01/app/oracle/oradata/orcl1/system01.dbf
SYSTEM
2 /u01/app/oracle/oradata/orcl1/sysaux01.dbf
ONLINE
3 /u01/app/oracle/oradata/orcl1/undotbs01.dbf
ONLINE
4 /u01/app/oracle/oradata/orcl1/users01.dbf
ONLINE
5 /u01/app/oracle/oradata/orcl1/tmp_perm01.dbf
ONLINE
----------------------------

S-ar putea să vă placă și