Вы находитесь на странице: 1из 6

How to do Archiving to new destination :

SQL> show parameter recovery


NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------db_recovery_file_dest
string
+RECO
db_recovery_file_dest_size
big integer 2G
recovery_parallelism
integer 0
SQL> alter system set db_recovery_file_dest_size=4G;
SQL> show parameter recovery
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------db_recovery_file_dest_size
big integer 4G
recovery_parallelism
integer 0
SQL> show parameter log_archive_dest
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------log_archive_dest
string
log_archive_dest_1
string
LOCATION=+DATA/

SQL> alter system set log_archive_dest_1='location=+RECO';


System altered.
SQL> select log_mode from v$database;
LOG_MODE
-----------ARCHIVELOG
SQL> select archiver from v$instance;
ARCHIVE
------STARTED

SQL> alter system switch logfile;


System altered.
SQL> select name from v$archived_log;
NAME
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+DATA/orcl/archivelog/2011_10_31/thread_1_seq_45.324.766005737
+DATA/orcl/archivelog/2011_10_31/thread_1_seq_46.325.766005749
+DATA/orcl/archivelog/2011_10_31/thread_1_seq_47.326.766006261
+RECO/orcl/archivelog/2011_10_31/thread_1_seq_48.264.766006611
19 rows selected.

We can see above that 1 new file have come after log switch, to new destination

RMAN Basics :
$ rman
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jan 24 22:24:50 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target /
connected to target database: ORCL (DBID=1278825270)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
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 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/11.1.0/db_1/dbs/snapcf_orcl.f'; # default

Configuring RMAN parameters:


RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;
RMAN> configure retention policy to recovery window of 3 days;
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
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 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO


'/u01/app/oracle/product/11.1.0/db_1/dbs/snapcf_orcl.f'; # default

Default location of backup:


$ sqlplus "/as sysdba"
SQL> show parameter recovery
Changing backup location:
SQL> alter system set db_recovery_file_dest="/u01";
System altered.
SQL> alter system set db_recovery_file_dest_size=6G;
System altered.
SQL> show parameter recovery
NAME
TYPE
VALUE
------------------------------------ ----------- -----------------------------db_recovery_file_dest
string
/u01
db_recovery_file_dest_size
big integer 6G
recovery_parallelism
integer 0

Connecting to RMAN :
[coredba@coredbatrn u02]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sat Jan 24 22:56:41 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1278825270)

Taking online backup of database:


RMAN> backup database plus archivelog delete input;
Rman commands :
RMAN> report schema;
RMAN> list backup;
RMAN> validate backupset 4;
Starting validate at 31-OCT-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece
+RECO/orcl/autobackup/2011_10_31/s_766007889.260.766007899
channel ORA_DISK_1: piece
handle=+RECO/orcl/autobackup/2011_10_31/s_766007889.260.766007899
tag=TAG20111031T195809
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
Finished validate at 31-OCT-11
Taking an incremental backup:
$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jan 25 00:03:51 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1278825270)
RMAN> backup incremental level 1 database;
Removing all the datafiles to generate a crash situation. Also the controlfile is gone.
To do this in ASM shutdown the database.
Not able to locate controlfile during recovery :
Starting recovery :

$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Sun Jan 25 01:05:52 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
Nomounting the database:
RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> alter database mount;
First we should restore the database and bring up the full backed up files.
RMAN> restore database;
Now we will recover the database where all the archivelog files will be called and
finally the redo log files.
RMAN> recover database;
Fresh incarnation of the database. Database opened with resetlog options to have
fresh set of log files.
RMAN> alter database open resetlogs;
Recovery Manager complete.

Вам также может понравиться