Thursday, March 21, 2013

RRMAN Configure and backup a NOARCHIVELOG database

1. check archivelog mode orarac2poc:TTS:/home/oracle/ops/exp> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Mar 21 13:51:05 2013

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SYS@TTS> select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

2. startup database in mounted mode for RMAN cold backup.

orarac2poc:TTS:/home/oracle/ops/exp> rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Mar 21 13:39:09 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TTS (DBID=1769654909)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name TTS 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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_2/dbs/snapcf_TTS.f'; # default

#Use basic compression to save disk space for backupset

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO compressed backupset;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters for database with db_unique_name TTS are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
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 COMPRESSED BACKUPSET;
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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_2/dbs/snapcf_TTS.f'; # default

RMAN> shutdown immediate

database closed
database dismounted
Oracle instance shut down

RMAN> startup mount;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     663908352 bytes

Fixed Size                     2229440 bytes
Variable Size                251661120 bytes
Database Buffers             402653184 bytes
Redo Buffers                   7364608 bytes

RMAN> backup database;

Starting backup at 21-MAR-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u02/oradata/TTS/system01.dbf
input datafile file number=00002 name=/u02/oradata/TTS/sysaux01.dbf
input datafile file number=00003 name=/u02/oradata/TTS/undotbs01.dbf
input datafile file number=00005 name=/u02/oradata/TTS/tts1_01.dbf
input datafile file number=00004 name=/u02/oradata/TTS/users01.dbf
channel ORA_DISK_1: starting piece 1 at 21-MAR-13
channel ORA_DISK_1: finished piece 1 at 21-MAR-13
piece handle=/u01/app/oracle/product/11.2.0/db_2/dbs/01o536r8_1_1 tag=TAG20130321T134928 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 21-MAR-13

Starting Control File and SPFILE Autobackup at 21-MAR-13
piece handle=/u01/app/oracle/product/11.2.0/db_2/dbs/c-1769654909-20130321-00 comment=NONE
Finished Control File and SPFILE Autobackup at 21-MAR-13

RMAN> alter database open;

database opened

RMAN> exit


Recovery Manager complete.


3. The backupset and controlfile autobackup

orarac2poc:TTS:/u02/oradata> ls -lrt /u01/app/oracle/product/11.2.0/db_2/dbs/
total 992368
...
-rw-r----- 1 oracle asmadmin 200278016 Mar 21 13:50 01o536r8_1_1
-rw-r----- 1 oracle asmadmin   9748480 Mar 21 13:50 snapcf_TTS.f
-rw-r----- 1 oracle asmadmin   9830400 Mar 21 13:50 c-1769654909-20130321-00
-rw-rw---- 1 oracle asmadmin      1544 Mar 21 13:51 hc_TTS.dat

4. about DBID
Note that from controlfile autobackup , we know the dbid is 1769654909, which will be use for recovery in next post.
%F     Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name. This variable translates into c-IIIIIIIIII-YYYYMMDD-QQ, where:

    IIIIIIIIII stands for the DBID. The DBID is printed in decimal so that it can be easily associated with the target database.

    YYYYMMDD is a time stamp in the Gregorian calendar of the day the backup is generated

    QQ is the sequence in hexadecimal number that starts with 00 and has a maximum of 'FF' (256)

We can also verify this from opened source database.


SYS@TTS> select dbid from v$database;

      DBID
----------
1769654909