Practice 10: Catalog Overview and Considerations

 

In this practice we will create an RMAN catalog, register the target database and verify that the target is

registered.

 

ASSUMPTIONS:

·         These practices are written for NT. Alternate solutions for UNIX will be noted but have not been tested.  File names and paths will need to be adjusted for use on UNIX platforms.

·         The database version for these practices is assumed to be 8.1.5 or higher. The solutions have been tested at 8.1.6.

·         These practices assume that two databases are available. A catalog database that will hold the RMAN catalog, and is referred to as CAT in the exercises. And a target database that will be called TGT. Please make the appropriate substitutions in the solutions for your database names.

·         These practices assume the NET8 connectivity to both the CAT and TGT databases  is already available.

 

 

INSTRUCTIONS:

 

1.       Prepare the CAT database for the installation of the RMAN catalog.

a.       Connect to the CAT database as a DBA user Note: a UNIX version of the solution follows

b.       Create a tablespace for the RMAN catalog schema

c.       Create the user to own the RMAN catalog.

d.       Grant privileges to the RMAN owner.

 

 

In an MS-DOS window

C:> set ORACLE_SID=CAT

C:> sqlplus /nolog

 

Connect as a dba privileged user

SQL> connect system/manager

 

Create a tablespace for the catalog

SQL> CREATE TABLESPACE rman_cat 

     DATAFILE ‘c:\oracle\oradata\CAT\rman01.dbf’ SIZE 20M

            DEFAULT STORAGE(INTIAL 100K NEXT 100K PCTINCREASE 0);

 

Create the user to own the RMAN catalog

SQL> CREATE USER rman IDENTIFIED BY rman

      DEFAULT TABLESPACE rman_cat

      TEMPORARY TABLESPACE temp

      QUOTA UNLIMITED ON rman_cat;

 

Grant privileges to the RMAN owner.

SQL> GRANT CONNECT, RECOVERY_CATALOG_OWNER TO rman;

SQL> EXIT;

 

In a UNIX command window using a bourne shell or compatible

$ set ORACLE_SID=CAT

$ export ORACLE_SID

$ sqlplus /nolog

 

Connect as a dba privileged user

SQL> connect system/manager

 

Create a tablespace for the catalog

SQL> CREATE TABLESPACE rman_cat 

     DATAFILE ‘/oracle/oradata/CAT/rman01.dbf’ SIZE 20M

            DEFAULT STORAGE(INTIAL 100K NEXT 100K PCTINCREASE 0);

 

Create the user to own the RMAN catalog

SQL> CREATE USER rman IDENTIFIED BY rman

      DEFAULT TABLESPACE rman_cat

      TEMPORARY TABLESPACE temp

      QUOTA UNLIMITED ON rman_cat;

 

Grant privileges to the RMAN owner.

SQL> GRANT CONNECT, RECOVERY_CATALOG_OWNER TO rman;

SQL> EXIT;

 

 

 

2.       Using RMAN command line, connect to the catalog database and create the catalog.

 

In an MS-DOS window

C:> SET ORACLE_SID=TGT

 

Connect to the catalog database.

C:> rman catalog rman/rman@CAT

 

Create the RMAN catalog

RMAN> CREATE CATALOG TABLESPACE rman_cat;

 

In an UNIX command window

$ set ORACLE_SID=TGT

$ export ORACLE_SID

 

Connect to the catalog database.

C:> rman catalog rman/rman@CAT

 

Create the RMAN catalog

RMAN> CREATE CATALOG TABLESPACE rman_cat;

 

 

 

3.       Register the Target database in the catalog.

 

Register the target database in the catalog.

RMAN> register database;

 

4.       Confirm that the target database is registered, issuing a command that prints the structure of the target database.

 

Issue a command that reports the structure of the target database.

Note: The structure of your database will be different than the report shown below.

 

RMAN> report schema;

RMAN-03022: compiling command: report

Report of database schema

File K-bytes    Tablespace           RB segs Name

---- ---------- -------------------- ------- -------------------

1        102400 SYSTEM               YES     C:\ORACLASS\DATA\DISK1\SYSTEM01.DBF

2         13888 RBS                  YES     C:\ORACLASS\DATA\DISK2\RBS01.DBF

3         20480 USER_DATA            YES     C:\ORACLASS\DATA\DISK3\USER01.DBF

4         30720 TEMP                 YES     C:\ORACLASS\DATA\DISK1\TEMP01.DBF

5          5120 INDX                 YES     C:\ORACLASS\DATA\DISK3\INDX_01.DBF

6          2048 DATA01               YES     C:\ORACLASS\DATA\DISK3\DATA01.DBF

7          1500 DATA02               YES     C:\ORACLASS\DATA\DISK5\DATA02.DBF

8          5120 DATA                 YES     C:\ORACLASS\DATA\DISK4\DATA_01.DBF

9          1024 INDX01               YES     C:\ORACLASS\DATA\DISK2\INDX01.DBF

10         1024 QUERY_DATA           YES     C:\ORACLASS\DATA\DISK1\QUERY01.DBF

 

 

Practice 11: Catalog commands/maintenance

 

In this practice we will do an OS backup of a datafile and add the information to the catalog

 

ASSUMPTIONS:

·         These practices are written for NT.  Alternate solutions for UNIX will be noted but have not been tested.  File names and paths will need to be adjusted for use on UNIX platforms.

·         The database version for these practices is assumed to be 8.1.5 or higher. The solutions have been tested at 8.1.6.

·         These practices assume that two databases are available. A catalog database that will hold the RMAN catalog, and is referred to as CAT in the exercises. And a target database that will be called TGT. Please make the appropriate substitutions in the solutions for your database names.

·         These practices assume the NET8 connectivity to both the CAT and TGT databases  is already available.

 

 

INSTRUCTIONS:

 

1.       Make a backup of a datafile on the target database using OS copy commands ( Assume that the target database in in NOARCHIVELOG mode.) For Unix, replace “copy” with “cp” in the HOST command below and make the required changes to the filenames.

 

C:> SET ORACLE_SID=TGT

C:> rman target / catalog rman/rman@CAT

RMAN> shutdown immediate;

   NOTE: change the file names below to match your files and directories

RMAN> HOST ‘copy c:\oraclass\data\disk3\data01.dbf c:\oraclass\backup\data01.bkp’;

RMAN> startup;

 

 

2.       Add this backup to the catalog

 

RMAN> catalog datafilecopy 'c:\oraclass\backup\data01.bkp';

 

RMAN-03022: compiling command: catalog

RMAN-03023: executing command: catalog

RMAN-08050: cataloged datafile copy

RMAN-08513: datafile copy filename=C:\ORACLASS\BACKUP\DATA01.BKP recid=33 stamp=426253348

RMAN-03023: executing command: partial resync

RMAN-08003: starting partial resync of recovery catalog

RMAN-08005: partial resync complete

 


 

3.       Verify that the information has been added to the catalog.

 

RMAN> list copy of datafile 'C:\oraclass\data\disk3\data01.dbf';

 

RMAN-03022: compiling command: list

 

List of Datafile Copies

Key     File S Completion time Ckp SCN    Ckp time   Name

------- ---- - --------------- ---------- ---------- ------

167     6    A 05-APR-01       463945     05-APR-01  C:\ORACLASS\BACKUP\DATA0

1.BKP

 

 

4.       Delete this backup from the catalog. Use operating system commands e.g. Windows explorer, to verify that the backup file exists before you delete it and that it no longer exists after the delete operation.

 

RMAN> allocate channel for delete type disk;

 

RMAN-03022: compiling command: allocate

RMAN-03023: executing command: allocate

RMAN-08030: allocated channel: delete

RMAN-08500: channel delete: sid=9 devtype=DISK

 

RMAN> change datafilecopy 'c:\oraclass\backup\data01.bkp' delete;

 

RMAN-03022: compiling command: change

RMAN-08070: deleted datafile copy

RMAN-08513: datafile copy filename=C:\ORACLASS\BACKUP\DATA01.BKP recid=33 stamp=426253348

 

RMAN> release channel;

 

RMAN-03022: compiling command: release

RMAN-03023: executing command: release

RMAN-08031: released channel: delete

 

5.    Verify that the information has been deleted from the catalog. Notice that the list command does not produce a report.

 

RMAN> list copy of datafile 'c:\oraclass\data\disk3\data01.dbf';

 

RMAN-03022: compiling command: list

RMAN-03025: performing implicit partial resync of recovery catalog

RMAN-03023: executing command: partial resync

RMAN-08003: starting partial resync of recovery catalog

RMAN-08005: partial resync complete

 

RMAN>

 

Practice 12: Recovery Catalog Report and List

 

In this practice, you will take a backup of datafiles

 

ASSUMPTIONS:

·         These practices are written for NT. Alternate solutions for UNIX will be noted but have not been tested.  File names and paths will need to be adjusted for use on UNIX platforms.

·         The database version for these practices is assumed to be 8.1.5 or higher. The solutions have been tested at 8.1.6.

·         These practices assume that two databases are available. A catalog database that will hold the RMAN catalog, referred to as CAT in the exercises, and a target database that will be called TGT. Please make the appropriate substitutions in the solutions for your database names.

·         These practices assume the NET8 connectivity to both the CAT and TGT databases is already available.

·         These exercises assume the target database is in NOARCHIVELOG mode.

 

 

INSTRUCTIONS:

 

1.       Create a script in the catalog.

 

Create the following script on your system as a file named backup_tst1.rman

 

Create script whole_backup_NA {

        shutdown immediate;

        startup mount;

        allocate channel d1 type disk;

        backup

                filesperset 4

                format'c:\oraclass\backup\TEST_%d_%s_%p.bkp'

                ( database include current controlfile);

        alter database open;

}

 

Start rman

 

C:\>rman target / catalog rman/rman@CAT

 

Recovery Manager: Release 8.1.6.0.0 - Production

 

RMAN-06005: connected to target database: TGT (DBID=1171165975)

RMAN-06008: connected to recovery catalog database

 

RMAN> @backup_tst1.rman

 

RMAN> Create script whole_backup_NA {

2>         shutdown immediate;

3>         startup mount;

4>         allocate channel d1 type disk;

5>         backup

6>              filesperset 4

7>              format'c:\oraclass\backup\TEST_%d_%s_%p.bkp'

8>              ( database include current controlfile);

9>         alter database open;

10> }

RMAN-03022: compiling command: create script

RMAN-03023: executing command: create script

RMAN-08085: created script whole_backup_NA

 

RMAN> **end-of-file**

 

 

2.       Run the script that you just created – WARNING This script does a whole database backup to disk! Make sure there is sufficient disk space in the destination directory before you run the script.

 

RMAN> run {execute script whole_backup_NA;}

 

RMAN-03021: executing script: whole_backup_NA

 

RMAN-03022: compiling command: shutdown

RMAN-06405: database closed

RMAN-06404: database dismounted

RMAN-06402: Oracle instance shut down

 

RMAN-03022: compiling command: startup

RMAN-06193: connected to target database (not started)

RMAN-06196: Oracle instance started

RMAN-06199: database mounted

 

Total System Global Area      26014988 bytes

 

Fixed Size                       70924 bytes

Variable Size                 24842240 bytes

Database Buffers               1024000 bytes

Redo Buffers                     77824 bytes

 

RMAN-03022: compiling command: allocate

RMAN-03023: executing command: allocate

RMAN-08030: allocated channel: d1

RMAN-08500: channel d1: sid=9 devtype=DISK

 

RMAN-03022: compiling command: backup

RMAN-03023: executing command: backup

RMAN-08008: channel d1: starting full datafile backupset

RMAN-08502: set_count=41 set_stamp=426265458 creation_time=05-APR-01

RMAN-08010: channel d1: specifying datafile(s) in backupset

RMAN-08522: input datafile fno=00004 name=C:\ORACLASS\DATA\DISK1\TEMP01.DBF

RMAN-08522: input datafile fno=00005name=C:\ORACLASS\DATA\DISK3\INDX_01.DBF

RMAN-08522: input datafile fno=00006 name=C:\ORACLASS\DATA\DISK3\DATA01.DBF

RMAN-08522: input datafile fno=00007 name=C:\ORACLASS\DATA\DISK5\DATA02.DBF

RMAN-08013: channel d1: piece 1 created

RMAN-08503: piece handle=C:\ORACLASS\BACKUP\TEST_DB02_41_1.BKP comment=NONE

RMAN-08525: backup set complete, elapsed time: 00:00:08

RMAN-08008: channel d1: starting full datafile backupset

RMAN-08502: set_count=42 set_stamp=426265466 creation_time=05-APR-01

RMAN-08010: channel d1: specifying datafile(s) in backupset

RMAN-08522: input datafile fno=00003 name=C:\ORACLASS\DATA\DISK3\USER01.DBF

RMAN-08522: input datafile fno=00002 name=C:\ORACLASS\DATA\DISK2\RBS01.DBF

RMAN-08522: input datafile fno=00008 name=C:\ORACLASS\DATA\DISK4\DATA_01.DBF

RMAN-08522: input datafile fno=00009 name=C:\ORACLASS\DATA\DISK2\INDX01.DBF

RMAN-08013: channel d1: piece 1 created

RMAN-08503: piece handle=C:\ORACLASS\BACKUP\TEST_DB02_42_1.BKP comment=NONE

RMAN-08525: backup set complete, elapsed time: 00:00:15

RMAN-08008: channel d1: starting full datafile backupset

RMAN-08502: set_count=43 set_stamp=426265482 creation_time=05-APR-01

RMAN-08010: channel d1: specifying datafile(s) in backupset

RMAN-08522: input datafile fno=00001 name=C:\ORACLASS\DATA\DISK1\SYSTEM01.DBF

RMAN-08011: including current controlfile in backupset

RMAN-08522: input datafile fno=00010 name=C:\ORACLASS\DATA\DISK1\QUERY01.DBF

RMAN-08013: channel d1: piece 1 created

RMAN-08503: piece handle=C:\ORACLASS\BACKUP\TEST_DB02_43_1.BKP comment=NONE

RMAN-08525: backup set complete, elapsed time: 00:00:37

RMAN-03023: executing command: partial resync

RMAN-08003: starting partial resync of recovery catalog

RMAN-08005: partial resync complete

 

RMAN-03022: compiling command: alter db

RMAN-06400: database opened

RMAN-08031: released channel: d1

 

3.        Verify the backup has completed. Run the list command for the SYSTEM tablespace. Your report will vary.

 

RMAN> list backup of tablespace;

 

RMAN-03022: compiling command: list

 

List of Backup Sets

Key     Recid      Stamp      LV Set Stamp  Set Count  Completion Time

------- ---------- ---------- -- ---------- ---------- ----------------------

128     30         425663733  0  425663700  40         29-MAR-01

 

    List of Backup Pieces

    Key     Pc# Cp# Status      Completion Time        Piece Name

    ------- --- --- ----------- ---------------------- ------------------------

    135     1   1   AVAILABLE   29-MAR-01              C:\ORACLASS\BACKUP\NA_DB0

2_40_1.BKP

 

    List of Datafiles Included

    File Name                                  LV Type Ckp SCN    Ckp Time

    ---- ------------------------------------- -- ---- ---------- -------------

    1    C:\ORACLASS\DATA\DISK1\SYSTEM01.DBF   0  Full 403781     29-MAR-01

 

List of Backup Sets

Key     Recid      Stamp      LV Set Stamp  Set Count  Completion Time

------- ---------- ---------- -- ---------- ---------- ----------------------

175     33         426265514  0  426265482  43         05-APR-01

 

    List of Backup Pieces

    Key     Pc# Cp# Status      Completion Time        Piece Name

    ------- --- --- ----------- ---------------------- ------------------------

    179     1   1   AVAILABLE   05-APR-01              C:\ORACLASS\BACKUP\TEST_D

B02_43_1.BKP

 

    List of Datafiles Included

    File Name                                  LV Type Ckp SCN    Ckp Time

    ---- ------------------------------------- -- ---- ---------- -------------

    1    C:\ORACLASS\DATA\DISK1\SYSTEM01.DBF   0  Full 463969     05-APR-01

 

RMAN>

 

4.        Report files that do not meet redundancy requirements. Your report will vary.

 

RMAN> Report need backup redundancy 3;

 

RMAN-03022: compiling command: report

Report of files with less than 3 redundant backups

File #bkps Name

---- ----- -----------------------------------------------------

2    2     C:\ORACLASS\DATA\DISK2\RBS01.DBF

4    2     C:\ORACLASS\DATA\DISK1\TEMP01.DBF

5    2     C:\ORACLASS\DATA\DISK3\INDX_01.DBF

8    2     C:\ORACLASS\DATA\DISK4\DATA_01.DBF

9    2     C:\ORACLASS\DATA\DISK2\INDX01.DBF

10   0     C:\ORACLASS\DATA\DISK1\QUERY01.DBF

 

RMAN>

 

1