RMAN config for primary
## keep all backups for at least 7 days
rman> configuration retention policy to recovery window of 7 days;
## chose one of the following depending on when you want the archives to be deleted after shipping or after being applied
rman> configure archivelog deletion policy to shipped to all standby;
rman> configure archivelog deletion policy to applied to all standby;
## configure the connect identifiers for all datbases
rman> configure db_unique_name prod1 connect identifier 'prod1';
rman> configure db_unique_name prod1dr connect identifier 'prod1dr';
rman> list db_unique_name of database;
RMAN config for standby
## enable automatic backups of the control file and server parameters
rman> configure controlfile autobackup on;
## skip backing up datafiles which a valid backup alrady exists with the same checkpoint
rman> configure backup optimization;
## configure tape or disk channels as required by the media software
rman> configure channel device type sbt params '<channel parameters>';
## Since the logs are backed up at the standby you can specify none
rman> configure deletion policy to none;
## delete the archive logs once they have been applied
rman>
configure archivelog deletion policy to applied to standby;
loss of a data file on a primary database
connect to the primary database as the target
# rman target / catalog rman/<password>@RCAT
alter the datafile online
rman> sql "alter database datafile 1 offline";
restore and recover the datafile
rman> restore datafile 1;
rman> recover datafile 1;
rman> sql "alter database datafile 1 online";
Using a standby datbase to recover the data file
connect to the standby database as the target database and to the primary as the auxiliary database
# rman targt sys/<pwd>@prod1dr catalog rman/<pwd>@RCAT auxiliary /
backup the datafile on the standby and transfer it to the primary
rman> backup as copy datafile 1 auxiliary format '/u01/oradata/prod1dr/users.dbf';
start rman and conect to the primary database as the target and to the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
using the catalog datafilecopy command to catalog this datafile so that rman can use it
rman> catalog datafilecopy '/u01/oradata/prod1dr/users.dbf';
use the switch datafile command to switch the datafile copy so that this file becomes the current datafile
run {
set newname for datafile 1 to '/u01/oradata/prod1/users.dbf';
switch datafile 1;
}
Loss of a datafile on a standby database
stop the SQL Apply using the alter database command
sql> alter database recover managed standby database cancel;
start rman and connect both to the standby and the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
issue the following command to restore and recover the data files
rman> restore datafile 1;
rman> recover datafile 1;
restart SQL Apply
sql> alter database recover managed standby database using current logfile disconnect;
Loss of a standby controlfile
start rman and connect both to the standby and the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
Choose one of the below, the last option is the most recent
rman> restore controlfile from autobackup;
rman> restore controlfile from '/backup_dir/piece_name';
rman> restore controlfile;
Loss of a primary controlfile
You can restore the control file from a backup by executing the restore controlfile and the database recover commands.
Loss of a online redo
shutdown the database
copy the existing multiplexed member over the missing or damaged member
# cp red03a.rdo red03b.rdo
startup the database
incomplete recovery of a primary database
Mount the database exclusive
sql> startup mount exclusive
flash back the database
sql> flashback database to '<timestamp>';
open the database reset logs;
sql> alter database open resetlogs;
Recovering from a dropped table
drop the table
sql> drop table test;
flashback the table
sql> flashback table test to before drop;
## keep all backups for at least 7 days
rman> configuration retention policy to recovery window of 7 days;
## chose one of the following depending on when you want the archives to be deleted after shipping or after being applied
rman> configure archivelog deletion policy to shipped to all standby;
rman> configure archivelog deletion policy to applied to all standby;
## configure the connect identifiers for all datbases
rman> configure db_unique_name prod1 connect identifier 'prod1';
rman> configure db_unique_name prod1dr connect identifier 'prod1dr';
rman> list db_unique_name of database;
RMAN config for standby
## enable automatic backups of the control file and server parameters
rman> configure controlfile autobackup on;
## skip backing up datafiles which a valid backup alrady exists with the same checkpoint
rman> configure backup optimization;
## configure tape or disk channels as required by the media software
rman> configure channel device type sbt params '<channel parameters>';
## Since the logs are backed up at the standby you can specify none
rman> configure deletion policy to none;
## delete the archive logs once they have been applied
rman>
configure archivelog deletion policy to applied to standby;
loss of a data file on a primary database
connect to the primary database as the target
# rman target / catalog rman/<password>@RCAT
alter the datafile online
rman> sql "alter database datafile 1 offline";
restore and recover the datafile
rman> restore datafile 1;
rman> recover datafile 1;
rman> sql "alter database datafile 1 online";
Using a standby datbase to recover the data file
connect to the standby database as the target database and to the primary as the auxiliary database
# rman targt sys/<pwd>@prod1dr catalog rman/<pwd>@RCAT auxiliary /
backup the datafile on the standby and transfer it to the primary
rman> backup as copy datafile 1 auxiliary format '/u01/oradata/prod1dr/users.dbf';
start rman and conect to the primary database as the target and to the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
using the catalog datafilecopy command to catalog this datafile so that rman can use it
rman> catalog datafilecopy '/u01/oradata/prod1dr/users.dbf';
use the switch datafile command to switch the datafile copy so that this file becomes the current datafile
run {
set newname for datafile 1 to '/u01/oradata/prod1/users.dbf';
switch datafile 1;
}
Loss of a datafile on a standby database
stop the SQL Apply using the alter database command
sql> alter database recover managed standby database cancel;
start rman and connect both to the standby and the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
issue the following command to restore and recover the data files
rman> restore datafile 1;
rman> recover datafile 1;
restart SQL Apply
sql> alter database recover managed standby database using current logfile disconnect;
Loss of a standby controlfile
start rman and connect both to the standby and the recovery catalog
# rman target / catalog rman/<pwd>@RCAT
Choose one of the below, the last option is the most recent
rman> restore controlfile from autobackup;
rman> restore controlfile from '/backup_dir/piece_name';
rman> restore controlfile;
Loss of a primary controlfile
You can restore the control file from a backup by executing the restore controlfile and the database recover commands.
Loss of a online redo
shutdown the database
copy the existing multiplexed member over the missing or damaged member
# cp red03a.rdo red03b.rdo
startup the database
incomplete recovery of a primary database
Mount the database exclusive
sql> startup mount exclusive
flash back the database
sql> flashback database to '<timestamp>';
open the database reset logs;
sql> alter database open resetlogs;
Recovering from a dropped table
drop the table
sql> drop table test;
flashback the table
sql> flashback table test to before drop;
No comments:
Post a Comment