create user rman identified by rman
default tablespace rcat temporary tablespace temp;
grant recovery_catalog_owner, connect, resource, dba to rman;
> rman catalog rman/rman@orcl1
> create catalog tablespace rcat mslog = catalog.log;
rman> connect target sys/oracle@orcl1
rman> connect catalog rman/rman@orcl2
rman> register database;
This
practice covers the BACKUP command in RMAN used to make backup sets of datafiles,
tablespaces and the whole database.
Assumptions
· This practice assumes that you have a target database available. A recovery catalog is not required.
Instructions
1.
Connect to the target database using RMAN and if necessary start the
target database.
RMAN>
connect target sys/change_on_install connected
to target database: ORCL (DBID=981440495) RMAN> |
2.
Use the SHOW ALL command to show the stored configuration for RMAN.
RMAN>
show all; using
target database controlfile instead of recovery catalog RMAN
configuration parameters are: CONFIGURE
RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE
BACKUP OPTIMIZATION OFF; # default CONFIGURE
DEFAULT DEVICE TYPE TO DISK; CONFIGURE
CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE
DEVICE TYPE DISK PARALLELISM 3; CONFIGURE
DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE
ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE
CHANNEL DEVICE TYPE DISK FORMAT
'D:\backup\%U' MAXPIECESIZE 50 M; CONFIGURE
MAXSETSIZE TO UNLIMITED; # default CONFIGURE
SNAPSHOT CONTROLFILE NAME TO 'D:\ORACLE\901\DATABASE\SNCFORCL.ORA'; # default RMAN> |
3.
If the stored configuration is correct, the only necessary step is the
command to back up your database.
RMAN>
backup database; Starting
backup at 08-MAR-02 allocated
channel: ORA_DISK_1 channel
ORA_DISK_1: sid=12 devtype=DISK allocated
channel: ORA_DISK_2 channel
ORA_DISK_2: sid=13 devtype=DISK allocated
channel: ORA_DISK_3 channel
ORA_DISK_3: sid=14 devtype=DISK channel
ORA_DISK_1: starting full datafile backupset channel
ORA_DISK_1: specifying datafile(s) in backupset input
datafile fno=00005 name=D:\ORACLE\ORADATA\ORCL\EXAMPLE01.DBF input
datafile fno=00006 name=D:\ORACLE\ORADATA\ORCL\INDX01.DBF input
datafile fno=00008 name=D:\ORACLE\ORADATA\ORCL\USERS01.DBF … |
4.
Verify the backup files using Operating System commands. If you do not specify a
format, RMAN uses
%U by
default, which guarantees a unique identifier. %U
specifies a convenient shorthand for
%u_%p_%c that
guarantees uniqueness in generated backup filenames. %u
specifies
an 8-character name constituted by compressed representations of the backup set
number and the time the backup set was created.
%p specifies
the piece number within the backup set.
%c specifies
the copy number of the backup piece within a set of duplexed backup pieces.
<D:\backup>dir Volume
in drive D has no label. Volume
Serial Number is 313A-16EC Directory
of D:\backup 03/04/2002
09:40p
<DIR>
. 03/04/2002
09:40p
<DIR>
.. 03/08/2002
11:00p
52,429,312 01DISFMQ_1_1 03/08/2002
11:00p
52,429,312 02DISFMQ_1_1 03/08/2002
11:00p
52,429,312 03DISFMS_1_1 03/08/2002
11:01p
52,429,312 01DISFMQ_2_1 03/08/2002
11:01p
52,429,312 02DISFMQ_2_1 03/08/2002
11:01p
42,160,640 01DISFMQ_3_1 03/08/2002
11:01p
52,429,312 03DISFMS_2_1 03/08/2002
11:02p
20,890,112 02DISFMQ_3_1 03/08/2002
11:02p
52,429,312 03DISFMS_3_1 03/08/2002
11:02p
52,429,312 03DISFMS_4_1 03/08/2002
11:03p
36,987,392 03DISFMS_5_1
11 File(s) 519,472,640
bytes
2 Dir(s) 5,082,882,048
bytes free D:\backup>> |
This
practice covers the configuration of automatic controlfile backup. This
configuration is stored in the controlfile and every time any backup or copy
command is issued, the controlfile is also backed up or copied.
Assumptions
·
The
target database needs to be mounted or open. A recovery catalog is not required.
Instructions
1.
Start RMAN and connect to your target database. Using the SHOW command
find the stored setting for the controlfile autobackup.
C:\WINNT>rman
target sys/oracle@orcl Recovery
Manager: Release 9.0.1.1.1 – Production ©
Copyright 2001 Oracle Corporation. All rights reserved. Connected
to target database: ORCL (DBID=981440495) RMAN>
show controlfile autobackup; RMAN
configuration parameters are: CONFIGURE
CONTROFILE AUTOBACKUP OFF; RMAN> |
2.
Use the configure command to automatically back up the controlfile after
any backup or copy command. Confirm the configuration.
RMAN>
configure controlfile autobackup on; New
RMAN configuration parameters: CONFIGURE
CONTROLFILE AUTOBACKUP ON; New
RMAN configuration parameters are successfully stored RMAN>
show controlfile autobackup; RMAN
configuration parameters are: CONFIGURE
CONTROLFILE AUTOBACKUP ON; RMAN> |
This completes this practice
In
this practice you will backup the controlfiles.
Assumptions
·
The
target database needs to be mounted or open.
A recovery catalog is not required.
Instructions
1.
Issue the backup command to backup all archivelog files and then delete
the input files.
RMAN>
BACKUP ARCHIVELOG ALL DELETE ALL INPUT; Starting
backup at 14-MAR-02 current
log archived using
channel ORA_DISK_1 using
channel ORA_DISK_2 using
channel ORA_DISK_3 channel
ORA_DISK_1: starting archive log backupset … |
This
completes this practice.
This
practice uses the copy command in RMAN to make image copies of files instead of
backup sets.
Assumptions
·
The
target database needs to be mounted or open.
A recovery catalog is not required.
Instructions
1.
Issue a Report command to find all of the data files in the database.
RMAN>
report schema; Report
of database schema File
K-bytes Tablespace Datafile
Name ----
------- ----------- ------------------------- 1 332800 SYSTEM D:\...\ORCL\SYSTEM01.DBF 2
204800 UNDOTBS
D:\...\ORCL\UNDOTBS01.DBF 3
20480 CWMLITE
D:\...\ORCL\CWMLITE01.DBF 4
20480 DRSYS
D:\...\ORCL\DRSYS01.DBF 5
156160 EXAMPLE
D:\...\ORCL\EXAMPLE01.DBF 6
25600 INDX
D:\...\ORCL\INDX01.DBF 7
10240 TOOLS
D:\...\ORCL\TOOLS01.DBF 8
25600 USERS
D:\...\ORCL\USERS01.DBF RMAN>
> |
2.
Issue the RMAN copy command to backup a single data file. If controlfile
autobackup is on, the control file will be backed up as well.
RMAN>
COPY DATAFILE "D:\ORACLE\ORADATA\ORCL\SYSTEM01.DBF" TO 2>
"D:\backup\system01.bak"; Starting
copy at 14-MAR-02 using
channel ORA_DISK_1 using
channel ORA_DISK_2 using
channel ORA_DISK_3 channel
ORA_DISK_1: copied datafile 1 output
filename=D:\BACKUP\SYSTEM01.BAK recid=2 stamp=456527729 Finished
copy at 14-MAR-02 Starting
Control File Autobackup at 14-MAR-02 piece
handle=D:\BACKUP\C-981440495-20020314-02 comment=NONE Finished
Control File Autobackup at 14-MAR-02 RMAN> |
3.
Issue the RMAN copy command to backup a single archivelog file.
COPY
archivelog 2>
"D:\oracle\oradata\orcl\arc1\arc00048.001" to 3>
"D:\backup\arc00048.001"; Starting
copy at 14-MAR-02 using
channel ORA_DISK_1 using
channel ORA_DISK_2 using
channel ORA_DISK_3 channel
ORA_DISK_1: copied archive log input
archive log thread=1 sequence=48 recid=68 stamp=456519020 output
filename=D:\BACKUP\ARC00048.001 recid=70 stamp=456527972 Finished
copy at 14-MAR-02 Starting
Control File Autobackup at 14-MAR-02 piece
handle=D:\BACKUP\C-981440495-20020314-03 comment=NONE Finished
Control File Autobackup at 14-MAR-02 RMAN> |
This
completes this practice.