Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: problem with RMAN

Re: problem with RMAN

From: Yass Khogaly <ykhogaly_at_us.oracle.com>
Date: Sat, 27 Nov 1999 22:02:11 -0800
Message-ID: <81qctd$3g0$1@inet16.us.oracle.com>

The recovery catalog


   From the Oracle8 Server Backup & Recovery Guide '..the recovery catalog    is a repository of information that is used and maintained by RMAN. RMAN    uses the information in the recovery catalog to determine how to execute    requested backup and restore actions..'.

   The recovery catalog can be in a schema of an existing Oracle8 database.    However if RMAN is being used to backup multiple databases, it is probably

   worth creating a dedicated recovery catalog database. THE RECOVERY CATALOG
   DATABASE CANNOT BE USED TO CATALOG BACKUPS OF ITSELF.    The Oracle8 Server Backup & Recovery Guide p.6-3 lists typical space    requirements for the recovery catalog.

   To set up the recovery catalog, firstly ensure that catalog and catproc    have been run, then execute the following:

     SVRMGR> spool create_rman.log
     SVRMGR> connect internal
     SVRMGR> create user rman identified by rman
             temporary tablespace temp
             default tablespace rcvcat quota unlimited on rcvcat;
     SVRMGR> grant recovery_catalog_owner to rman;
     SVRMGR> connect rman/rman
     SVRMGR> @?/rdbms/admin/catrman

   Check create_rman.log for errors. The above commands assume that the    TEMP and RCVCAT tablespaces have been created.

   Also ensure that catproc has been run on the target database; RMAN makes    extensive use of RPCs.

   It is very important that the recovery catalog database is backed up    regularly and frequently.

   Note: Although you are not required to use a recovery catalog with RMAN,    it is recommended. Because most of the information in the recovery catalog

   is available via the target database's controlfile, RMAN can use this    information for recovery purposes. For more information and limitations    on using RMAN without a recovery catalog, please see the Oracle8 Server    Backup & Recovery Guide pp.7-8, 7-8.

Starting RMAN


   RMAN has a command line interface, or can be run from Enterprise Manager.    For the purposes of this document, only the CLI will be covered.

   For the purposes of the following examples, assume that

   o. the target database is called "targdb" and has the same TNS alias
   o. "targdba" has been granted SYSDBA privileges
   o. the recovery catalog database is called "rcat" and has the same TNS
alias

   o. the schema containing the recovery catalog is "rman" (same password)

   Before invoking RMAN, set the NLS_DATE_FORMAT and NLS_LANG environment    variables. Much of the RMAN LIST output is date/time related. It is often    necessary to have this information displayed as accurately as possible    when performing time-based recovery. Example NLS settings:

     NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
     NLS_DATE_FORMAT=DD-MON-YYYY HH24:MI:SS

   For RMAN to connect to the recovery catalog and the target database, the    recovery catalog database must be OPEN, while the target instance must be    at least STARTED. If not, RMAN will give an error. To perform backups with

   the target database open, the target MUST be in archivelog mode.

Connecting to RMAN without a recovery catalog


        Set ORACLE_SID to be the target database, and issue the following:

% rman nocatalog

        RMAN> connect target
          or if the target database uses a password file,
        RMAN> connect target targdba/<password>@targdb


Connecting to RMAN with a recovery catalog


% rman rcvcat rman/rman_at_rcat

        RMAN> connect target
          or if the target database uses a password file,

% rman rcvcat rman/rman_at_rcat target targdba/<password>@targdb

Using RMAN


        Once connected to the target database, you can specify RMAN commands
        either interactively or by using stored scripts. An example of
        using RMAN interactively would be:

        RMAN> resync catalog;

        An example of calling a stored script would be:

        RMAN> execute script alloc_1_disk;

        To create/replace a stored script:

        RMAN> replace script alloc_1_disk

        2> allocate channel d1 type disk;
        3> }


Register the target database


   Database status:

     Recovery catalog: open
     Target:           mounted or open

   The target database must be registered with the recovery catalog before    using RMAN against the database for the first time:

   RMAN> register database;

Adding existing backups to the recovery catalog


   Database status:

     Recovery catalog: open
     Target:           mounted or open

   If user-created backups existed under version 8.x prior to registering with

   the target database, these can be added to the recovery catalog as follows:

   RMAN> catalog datafilecopy '/supp/ .... /systargdb.dbf';

   To view this file in the catalog, use the following command:

   RMAN> list copy of database;

Backing up in noarchivelog mode


   Database status:

     Recovery catalog: open
     Target:           instance started or database mounted

   Recovery catalog database is OPEN, target database is started (optionally    mounted). Because the target database is not in archivelog mode, it must    not be open when performing backups of datafiles. This would be equivalent

   of making filesystem copies of datafiles without putting tablespaces into    hot backup mode. If the database is open and not in archivelog mode, RMAN    will generate an error when you attempt to perform a datafile backup

Example of how to back up a complete database


      RMAN> run {
      2> # backup the complete database to disk
      3> allocate channel dev1 type disk;
      4> backup
      5>   full
      6>   tag full_db_sunday_night
      7>   format '/oracle/backups/db_t%t_s%s_p%p'
      8>   (database);
      9> release channel dev1;
      10> }

      Line#
         2: Comment line (anything after the '#' is a comment)
         3&9: See section 15 - Channels
         5: Full backup (default if full or incremental not specified)
         6: Meaningful string (<=30 chars)
         7: Filename to use for backup pieces, including substitution
variables.
            Oracle8 Backup & Recovery Guide p8-26 explains these variables
         8: Indicates all files including controlfiles are to be backed up

      To view this backup in the catalog, use the following command:

      RMAN> list backupset of database;


Example of how to back up a tablespace


      RMAN> run {
      2> allocate channel dev1 type disk;
      3> backup
      4>   tag tbs_users_read_only
      5>   format '/oracle/backups/tbs_users_t%t_s%s'
      6>   (tablespace users);
      7> release channel dev1;
      10> }

      Line#
         6: Specifying only the USERS tablespace for backup

      To view this tablespace backup in the catalog, use the following
command:

      RMAN> list backupset of tablespace users;

      If for example the USERS tablespace is going to be put READ ONLY after
      being backed up, subsequent full database backups would not need to
      backup this tablespace. To cater for this, specify the 'skip readonly'
      option in subsequent backups.

      Note that although this is a tablespace backup, the target database
      does NOT have to be open, only mounted. This is because tablespace
      information is stored in the controlfile in o8.


Example of how to backup individual datafiles


      RMAN> run {
      2> allocate channel dev1 type 'SBT_TAPE';
      3> backup
      4>   format '%d_%u'
      5>   (datafile '/oracle/dbs/sysbigdb.dbf');
      6> release channel dev1;
      7> }

        Line#
          2: Allocates a tape drive using the media manager layer (MML)
          Note that no tag was specified and is therefore null.

      To view this tablespace backup in the catalog, use the following
command:

      RMAN> list backupset of datafile 1;

Copying datafiles


      RMAN> run {
      2> allocate channel dev1 type 'SBT_TAPE';
      3>   copy datafile '/oracle/dbs/temp.dbf' to
'/oracle/backups/temp.dbf';
      4> release channel dev1;
      5> }

      To view this file copy in the catalog, use the following command:

      RMAN> list copy of datafile '/oracle/dbs/temp.dbf';

      Copying a datafile is different to backing up a datafile. A datafile
copy
      is an image copy of the file. A backup of the file creates a
backupset.

Backing up the controlfile


      RMAN> run {
      2> allocate channel dev1 type 'SBT_TAPE';
      3> backup
      4>   format 'cf_t%t_s%s_p%p'
      5>   tag cf_monday_night
      6>   (current controlfile);
      7> release channel dev1;
      8> }

      Note that a database backup will automatically back up the
controlfile.

Backing up in archivelog mode


   Database status:

     Recovery catalog: open
     Target:           instance started, database mounted or open

   The commands are identical to those in section 7 except that the target    database is in archivelog mode.

   Backing up archived logs


      The following script backs up all archive logs:

      RMAN> run {
      2> allocate channel dev1 type disk;
      3> backup
      4>   format '/oracle/backups/log_t%t_s%s_p%p'
      5>   (archivelog all);
      6> release channel dev1;
      7> }

      The following script backs up archive logs from sequence# 90 to 100:

      RMAN> run {
      2> allocate channel dev1 type disk;
      3> backup
      4>   format '/oracle/backups/log_t%t_s%s_p%p'
      5>   (archivelog from logseq=90 until logseq=100 thread 1);
      6> release channel dev1;
      7> }

      The following script backs up all archive logs generated in the past
      24 hours. Furthermore it actually deletes the logs after backing them
      up. If the backup fails, logs will NOT be deleted:

      RMAN> run {
      2> allocate channel dev1 type disk;
      3> backup
      4>   format '/oracle/backups/log_t%t_s%s_p%p'
      5>   (archivelog from time 'sysdate-1' all delete input);
      6> release channel dev1;
      7> }

      To view the archive logs in the catalog, use the following command:

      RMAN> list backupset of archivelog all;

      Note that RMAN will backup specified logs if it finds them. If it
can't
      find a log, it does not issue a warning.

   Backing up the online logs


      Online logs CANNOT be backed up using RMAN; they must be archived first.

      To do this, you can issue SQL commands from RMAN e.g.

      RMAN> run {
      2> allocate channel dev1 type disk;
      3> sql "alter system archive log current";
      4> backup
      5>   format '/oracle/backups/log_t%t_s%s_p%p'
      6>   (archivelog from time 'sysdate-1' all delete input);
      7> release channel dev1;
      8> }

      The above script might be run after performing a full 'database open'
      backup. It would ensure that all redo to recover the database to a
      consistent state would be backed up.

   Note, you cannot tag archive log backupsets.

      As can be seen from an earlier example, it is possible to direct an SMR

      server session to delete archived redo logs once they have been backed
      up. This option should obviously be used with extreme caution! Only
      ever delete archivelogs if you are 100% satisfied that you have good
      copies/backups elsewhere.

    18.3. Keep it simple

      As with all backup & recovery strategies, they should be as simple as
      possible, and should be tested thoroughly.

      A few simple stored scripts should be adequate for the vast majority
      of backup & recovery requirements.

    18.4. RMAN errors

      When RMAN goes wrong it's spectacular! The error stacks are usually
      very long. If an error is reported, it is worth getting the complete
      stack sent to support as most of the errors will not help in
diagnosing
      the problem.


"The Views expressed here are my own and not necessarily those of Oracle Corporation"

Norman Mueller <nm_at_berlin.snafu.de> wrote in message news:38408919.E640355B_at_berlin.snafu.de...

> Hello,
>
> I want to setup rman for backup and recovery. The problem is that I
> can't start
> it on our Solaris box. We use Oracle 8.0.5. I always get the following
> message:
>
> RMAN-00569: ================error message stack follows================
> RMAN-00552: syntax error in command line arguments
> RMAN-01005: syntax error: found "identifier": expecting one of:
> "allocate,
> beginline, catalog, change, connect, create,
> delete, exit, endinline, host, {, library, list, print, register,
> release,
> replace, report, reset, resync, rman, rpctest
> , run, set, sql, test"
> RMAN-01008: the bad identifier was: rman
> RMAN-01007: at line 2 column 1 file: command line arguments
>
> I have tried to start rman with and without command line arguments but
> the
> result is always the same. Does anyone know why????
>
> thanx for your help.


Received on Sun Nov 28 1999 - 00:02:11 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US