This
practice covers using RMAN to perform a
cross-check to ensure that data about backup sets and image copies in the RMAN
repository is synchronized with corresponding data on disk or in the media
management catalog.
INSTRUCTIONS:
1. Connect to your database in the
default NOCATALOG mode..
$ rman target / Recovery
Manager: Release 9.0.0.0.0 – Beta (c) Copyright 2000 Oracle Corporation. All
rights reserved. connected to
target database: DB01 (DBID=1121888154) |
2. Use the RMAN REPORT command to generate a listing of your database structure.
RMAN> REPORT SCHEMA; using target database
controlfile instead of recovery catalog Report of database schema File K-bytes Tablespace RB Datafile Name ---- ------- ---------- ---
------------------- 1 102400 SYSTEM ***
/…/ORADATA/u01/system01.dbf 2 30720 UNDOTBS ***
/…/ORADATA/u02/undotbs.dbf 3 51200 USERS ***
/…/ORADATA/u03/users01.dbf 4 5120 INDX ***
/…/ORADATA/u03/indx01.dbf 5 1024 QUERY_DATA *** /…/ORADATA/u01/querydata01.dbf 6 10240 SAMPLE ***
/…/ORADATA/u02/sample01.dbf |
3. Use the RMAN LIST
command to generate a listing of
the backup sets..
RMAN> LIST BACKUP; List of Backup Sets =================== BS Key Type LV SizeDevice Type Elapsed Time Completion Time ------ ---- -- ---------- ---- ------------ --------------- 1 Full 1M DISK 00:00:01 21-MAR-01 BP Key: 1 Status:
AVAILABLE Tag: Piece Name: /databases/db01/BACKUP/RMAN/df_DB01_1_1.bus Controlfile Included: Ckp SCN: 66090
Ckp time: 21-MAR-01 List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time
Name ---- -- ---- ------- --------- --------------------------- 6 Full 66091
21-MAR-01 /…/ORADATA/u03/sample01.dbf |
4. Use the RMAN CROSSCHECK
command to generate a listing of
the status of the files.
RMAN> CROSSCHECK BACKUPSET 1; using channel ORA_DISK_1 crosschecked backup piece: found to be 'AVAILABLE‘ backup piece handle=/databases/db01/BACKUP/RMAN/df_DB01_1_1.bus recid=1
stamp=46 |
5. Using an operating system command, copy the backup file
belonging to the SAMPLE tablespace to your BACKUP
directory and then remove it from
the RMAN directory to simulate a loss of the backup.
$cp $HOME/BACKUP/RMAN/df_DB01_1_1.bus $HOME/BACKUP $rm $HOME/BACKUP/RMAN/df_DB01_1_1.bus |
6. Use the RMAN CROSSCHECK
command to update the repository
with the status of the datafile backup that you moved in the previous step. Be
sure to specify the backup set that you moved in the previous step.
RMAN> CROSSCHECK BACKUPSET 1; using target database controlfile instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=9 devtype=DISK crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/databases/db01/BACKUP/RMAN/df_DB01_1_1.bus recid=1
stamp=46 |
7. Issue the LIST
EXPIRED command to check the
status of your files. Are any of your files expired?
RMAN> LIST EXPIRED BACKUP; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Tim ------ ---- -- ---- ----------- ------------ -------------- 1 Full 1M
DISK 00:00:01 21-MAR-01 BP Key: 1 Status: EXPIRED Tag: Piece Name: /databases/db01/BACKUP/RMAN/df_DB01_1_1.bus Controlfile Included: Ckp SCN: 66090
Ckp time: 21-MAR-01 List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time
Name ---- -- ---- ------- ---------
----------------------- |
This ends this
practice.
In
this practice you will use RMAN to update
the repository..
Instructions:
1. Use RMAN to back up the datafiles belonging to the EXAMPLE tablepspace (or SAMPLE tablespace depending on your install). Your backups should be placed in the $HOME/BACKUP/RMAN directory and should use the format df_%d_%s_%p.bus for the file names.
$ rman target / Recovery Manager: Release 9.0.1.0.0 - Production (c)Copyright 2001 Oracle Corporation. All rights reserved. connected to target database: U45 (DBID=2607302401) RMAN> BACKUP TABLESPACE sample FORMAT
'$HOME/BACKUP/RMAN/df_%d_%s_%p.bus'; Starting backup at 11-MAR-02 using target database controlfile instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: 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=/home1/user45/ORADATA/u02/sample_01.dbf channel ORA_DISK_1: starting piece 1 at 11-MAR-02 channel ORA_DISK_1: finished piece 1 at 11-MAR-02 piece handle=/home1/user45/BACKUP/RMAN/df_U45_1_1.bus comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 Finished backup at 11-MAR-02 |
2. Create an image copy of the datafiles belonging to the SYSTEM tablespace.
The copy should be placed in the $HOME/BACKUP/RMAN
directory with the name of sys0101.cpy.
RMAN> COPY DATAFILE
‘$HOME/ORADATA/u01/system_01.dbf’ 2> TO ‘$HOME/BACKUP/RMAN/sys0101.cpy’; Starting copy at 11-MAR-02 using channel ORA_DISK_1 channel ORA_DISK_1: copied datafile 1 output filename=/home1/user45/BACKUP/RMAN/sys0101.cpy recid=1
stamp=456258052 Finished copy at 11-MAR-02 |
3. Use the RMAN LIST command to generate a listing of the backup set that you just made.
RMAN> LIST BACKUPSET; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Tim ------ ---- -- ---- ----------- ------------ ------------ 1 Full 106M DISK
00:00:14 11-MAR-02 BP Key: 1 Status:
AVAILABLE Tag: Piece Name: /home1/user45/BACKUP/RMAN/df_U45_1_1.bus List of Datafiles in backup set 1 File LV Type Ckp SCN Ckp
Time Name ---- -- ---- ---------- --------- ---- 5 Full 91009 11-MAR-02
/home1/user45/ORADATA/u02/sample_01.dbf
|
4. Use the RMAN LIST command to list the copy of the datafile created in step 2 above.
RMAN> LIST COPY; List of Datafile Copies Key File S Completion Time Ckp SCN
Ckp Time Name --- ---- - --------------- ---------- --------------- ---- 1 1 A 11-MAR-02 91016
11-MAR-02
/home1/user45/BACKUP/RMAN/sys0101.cpy |
5. Use the DELETE command within RMAN to delete the files in the backupset created in step 1 above.
RMAN> delete backupset 1; using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp#
Status Device Type Piece Name ------ ------- --- --- --------- ----------- ---------- 1 1 1
1 AVAILABLE DISK /home1/user45/BACKUP/RMAN/df_U4s Do you really want to delete the above objects (enter YES or NO)? yes deleted backup piece backup piece handle=/home1/user45/BACKUP/RMAN/df_U45_1_1.bus recid=1
stamp=45626 |
6. Use the DELETE command within RMAN to delete the data file copies created in step 02 above.
RMAN> delete datafilecopy '/home1/user45/BACKUP/RMAN/sys0101.cpy'; released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=14 devtype=DISK List of Datafile Copies Key File S Completion Time
Ckp SCN Ckp Time Name ------- ---- - --------------- ---------- --------------- - 1 1 A 11-MAR-02 91016
11-MAR-02 /home1/user45/BACKUP/RMAN/sys0101.cpy
Do you really want to delete the above objects (enter YES or NO)? yes deleted datafile copy datafile copy filename=/home1/user45/BACKUP/RMAN/sys0101.cpy recid=1
stamp=45622 |
This
ends this practice.
This practice covers the cataloging of backups within RMAN.
Instructions:
1. Connect as the user SYSTEM
and place the USERS tablespace
in hot backup mode. Determine the files
making up the USERS tablespace by querying
the DBA_DATA_FILES
view. Next, create an operating system backup copy of the datafiles
making up the USERS tablespace.
SQL> CONNECT system/manager Connected. SQL> alter
tablespace users begin backup; Tablespace altered. SQL> select
file_name from dba_data_files where 2>
tablespace_name = 'USERS'; FILE_NAME --------------------------------------------------------- /home1/user45/ORADATA/u03/users_01.dbf SQL> HOST user45 ksh
> cp /home1/user45/ORADATA/u03/users_01.dbf /home1/user45/BACKUP/UMAN |
2. Use the catalog command in RMAN to catalog the datafile copy
that you created at the operating system level.
user45 ksh > rman
target / Recovery Manager:
Release 9.0.1.0.0 - Production (c) Copyright 2001
Oracle Corporation. All rights
reserved. connected to target
database: U45 (DBID=2607302401) RMAN> catalog
datafilecopy'/home1/user45/BACKUP/UMAN/users_01.dbf'; using target database
controlfile instead of recovery catalog cataloged datafile copy datafile copy
filename=/home1/user45/BACKUP/UMAN/users_01.dbf recid=2 stamp=4561 |
3. Use the RMAN list command to list the datafile copies.
RMAN> list copy; List of Datafile Copies Key File S Completion Time Ckp SCN Ckp Time Name ------- ---- -
--------------- ---------- --------------- 2 3
A 11-MAR-02 91033 11-MAR-02 /home1/user45/BACKUP/UMAN/users_01.dbf |
4. Use the uncatalog command in RMAN to remove a copy of a datafile from the
catalog.
user45 ksh > rman
target / Recovery Manager:
Release 9.0.1.0.0 - Production (c) Copyright 2001
Oracle Corporation. All rights
reserved. connected to target
database: U45 (DBID=2607302401) RMAN> change
datafilecopy '/home1/user45/BACKUP/UMAN/users_01.dbf' uncatalog; uncataloged datafile
copy datafile copy
filename=/home1/user45/BACKUP/UMAN/users_01.dbf recid=2 stamp=4561 |
5. Use the RMAN list command to list the datafile copies. Note you may have other files listed here.
RMAN> list copy; RMAN> |
This
ends this practice.