Saturday, August 8, 2015

RMAN Q & A Page - 9

RMAN INTERVIEW QUESTIONS AND ANSWERS
                                                                     
         Page – 9

81. My database was terminated while  in BACKUP MODE  can I do  the recover?

If the database was terminated while one of its tablespace was in BACKUP MODE(ALTER TABLESPACE  xyz  BEGIN  BACKUP;) it will tell you that media   recovery is required  when you try to restart the database. The DBA is then required  to recover the database and apply all archived logos to the database.
ALTER DATABASE DATAFILE  ‘path/filename’  END BACKUP;
One can  select from  V$BACKUP to see which datafiles are in backup mode. This normally saves a significant amount of database down time.
ALTER DATABASE END BACKUP;
This  command must be issued  when  the database is mounted, but not yet opened

82. How can one to  clone / duplicate a database with RMAN?

This first step to clone or duplicate  a database with RMAN is to create a new INIT.ORA and password file on the machine.  Review  the all parameters and make the required   to change.
EXAMPLE-  DB_NAME  parameter to the new database’s name
Secondly  you  need  to change  your environment variables, and  do  a STARTUP NOMOUNT  from sqlplus. This database is referred  to the AUXILIARY.
Finally  write a RMAN script like this to do the cloning, and call it with “rman cmdfile dupdp.rcv”
Connect target sys / secure@origdb
Connect catalog rman/rman@catdb
Connect  auxiliary /
Run{
set newname for datafile 1 to ‘/ORADATA/u01/system01.dbf’;
set newname for datafile 2  to ‘/ORADATA/u02/undotbs01.dbf’;
set newname for datafile 3  to ‘/ORADATA/u03/users01.dbf’;
set newname for datafile 4  to ‘/ORADATA/u03/index01.dbf’;
set newname for datafile 1 to ‘/ORADATA/u01/example01.dbf’;
allocate auxillary channel  dudp1 type disk;
set until sequence  2  thread 1;
duplicate target database to dupdp
logfile
GROUP 1 (‘/ORADATA/u02/redo01.log’) SOZE 200K REUSE;
GROUP 2 (‘/ORADATA/u03/redo02.log’) SIZE 200K  REUSE;
}
The above script  will connect  to the  “target “ (database that will be cloned), the recovery catalog  and  the auxiliary database(new duplicate DB) previous will  be restored and the database  recovered to the  “set until time” specification in the script.
NOTES
“set new name”  commands are only required if your datafile names will different from the target database.
The new cloned DB will have its own unique DBID

83. What are  the various  tape backup solution available in  the market?

A). EMC’ Legato Networker Module for Oracle
B). Symantec’s  Netback up database agent for Oracle
C). IBM’s Tivoli  storage management RMAN and the traditional  backup methods.

84. How  to verify the integrity of the  image copy of the RMAN?

RMAN>catalog datafile  copy  ‘f:testsystem.dbf’;
RMAN>backup  validate check  logical datafile ‘f:testsystem.dbf’;
SQL> select * from v$database_block_corruption;

85. How to generate the begin   backup script?

SQL> set  head off
SQL>spool beginbackup.sql
SQL>select  ‘alter  tablespace ‘ tablespace_name ‘begin backup’ from dba_tablespace;
SQL>spool off
This will create  the file beginbackup.sql with entry for all tablespace, remove any unnecessary  lines & then execute  this script into SQL like
SQL>@beginbackup.spl;

Once  execute the above script  this will put all the tablespace in to    begin backup mode.

Now create backup of your control file in human readable  format like..
Alter database backup control file to trace as ‘/some/path’
 You can reuse it by removing  comment at beginning & replace them with connect / as sysdba
Then copy all your datafiles, redo logs and control file from your database sever backup location. After datafiles  are copied  don’t’ forget to end backup for all tablespace here is  the scripts
SQL>set head off;
SQL>spool endbackup.spqql;
SQL>select ‘alter tablespace ‘tablespace_name’ end backup’ from tablespace;
SQL>spool  off;
This will create  file  endbackup.sql with entry for all tablespaces, remove any unnecessary lines and then  execute this script into SQL like..
SQL>@endbackup.sql;
Once  you execute this script this will  put all tablespace in to  end backup

86. what is the auxiliary  channel in RMAN?  When we need this?

An auxiliary  channel is  a  like to auxiliary instance. If you do not have automatic channels configured, then before issuing  the DUPLICATE command, manually allocate at least channel within the same RUN command.
When  a Duplicate  database   created or  tablespace   point in time recovery is performed auxiliary  database  is used  this  database can either  on the same host or a different host.
RUN
{
ALLOCATE AUIXILARY CHANNEL ch  DEVICE TYPE SBT;
ALLOCATE AUXILIARY CHANNEL AUX1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL AUX2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL AUX3 DEVICE TYPE DISK;
DUPLIACATE TARGET DATABASE TO dupdb;
}

87. How to  setup the physical  standby database with RMAN?

You can use either  manual  techniques or  the  RMAN DUPLICATE command to create  a standby database from  backup of your primary database. Creating  a standby database with RMAN has  the  following advantages over manual techniques.

A). RMAN can create a standby database by copying the  files currently in  use  by the primary  database. No backups are required.

B). RMAN can create a  standby  database by restoring backup of the  primary  database to the standby site. Thus  the  primary  database is  not  affected during  the creation of the standby  database.

C).  RMAN automates renaming  of files, including  oracle management files (OMF) and directory structures.

D). RMAN restores archived redolog files from backups and performs media  recovery so that the standby and primary database are synchronized

88. How to create a tablespace?

SQL> create tablespace RTBS datafile ‘D\ORACLE\ORADATA\RTBS01.DBF’ size 200m 
extent management local  uniform size 5m;

89.  How to create  the catalog user?

SQL> create user CATALOG indentified by CATALOG default tablespace RTBS quota unlimited on RTBS;

90. How to connect the catalog  and target database?

%rman target sys/oracle@target_db

RMAN> connect  catalog RMAN_USER/RMAN_PASSWORD@cat_db;

No comments:

Post a Comment