Skip to main content

Posts

Showing posts from December, 2012

RMAN - List and Report

RMAN> list backup; List of Backup Sets =================== BS Key  Type LV Size       Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1       Full    281.02M    DISK        00:02:23     21-DEC-12              BP Key: 1   Status: AVAILABLE  Compressed: YES  Tag: TAG20121221T014321         Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_12_21/o1_mf_nnndf_TAG20121221T014321_8f7d5blz_.bkp   List of Datafiles in backup set 1   File LV Type Ckp SCN    Ckp Time  Name   ---- -- ---- ---------- --------- ----   1       Full 923674   ...

RMAN - backup, restore and recover

@  backup as compressed backupset database RMAN> backup as compressed backupset database; Starting backup at 21-DEC-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=34 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=/u01/app/oracle/oradata/orcl/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 21-DEC-12 channel ORA_DISK_1: finished piece 1 at 21-DEC-12 piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_12_21...

RMAN - Retention Policy

Retention Policy Setting to specify how long to keep backups Any backups that are not needed to support this recovery window are marked as OBSOLETE and are automatically removed by RMAN if you are using a flash recovery area, if you are no user FRA  the deletion need to be done Manually  Applies to full back up only (level 0) not to level 1 Backups can be automatically retained and managed using one of two methods:  Redundancy :  X number of backups Default !! Recovery Window :  X number of days Recommended by Oracle How to .. RMAN> show all; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name ORCL are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP O...

RMAN - Configuration, Metadata and Catalogues

Control file In this post I approach RMAN Configuration, Metadata, Catalogues RMAN always stores its metadata in the target database  control file Whether you use or not the Recovery Catalog Oracle stores metadata into the targer database control file RMAN info on control file is is aged based on CONTROL_FILE_RECORD_KEEP_TIME Single point control ( control file) Does not required another DB Recovery Catalog keep info for long time single point to store many databases RESYNC CATALOG, syncronize the control file metadata with the recover catalog Can store "RMAN backup scripts" in the catalog ... is not possible do it on the control file Recovery Catalog control views RC_* Allow history commands BACKUP .. KEEP UNTIL TIME - keep the backup until point that referrers the configured retention police  BACKUP ... KEEP FOREVER - keep the backup forever, until manually removed REPORT SCHEMA ... AT - show the structure at specific time period Create a RMAN Catalog --1 create tablespace...

RMAN - Metadata

Control file RMAN always stores its metadata in the target database  control file Whether you use or not the Recovery Catalog Oracle stores metadata into the targer database control file RMAN info on control file is is agedbased on CONTROL_FILE_RECORD_KEEP_TIME Single point control ( control file) Does not required another DB How to .. [oracle@oracle ~]$ rman target / Recovery Manager: Release 11.2.0.1.0 - Production on Sun Feb 3 17:46:29 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORCL (DBID=1272537938) Recovery Catalog keep info for long time single point to store many databases RESYNC CATALOG, syncronize the control file metadata with the recover catalog Can store "RMAN backup scripts" in the catalog ... is not possible do it on the control file Recovery Catalog control views RC_* Allow history commands BACKUP .. KEEP...

DB - Archive log mode

English Version Este post saiu da preparacao para o OCP - Oracle Certified Professional . Isto e simples , Oracle trabalha com logs, todos os DMS/DDL vao para a log. chamados redo logs, que sao escritos de forma circular. Para evitar perda de informacao podem ser archivados antes da re-escrita. Entre outras razoes, no caso de necessidade de recuperar a base de dados the forma tradicional sao necessarios 2 passos : 1) Restore - restaurar os data files e control files 2) Recover - Aplicar logs, neste caso convem ter os "archives" De seguida mostro como fazer isso, nota importante, isto deve ser feito com a base de dados em estado consitente. Exemplo, apos um "shutdown immediate". SQL> select startup_time from  v$instance; STARTUP_Time --------- 19-DEC-12 SQL> select dbid,name,log_mode,flashback_on from  v$database;       DBID        NAME       LOG_MODE          FLASHBACK_ON ----------          ---------      ------------               ------------------ 1272...

Set Archive log mode

Set Archive log SQL> select startup_time from  v$instance; STARTUP_Time --------- 19-DEC-12 SQL> select dbid,name,log_mode,flashback_on from  v$database;       DBID        NAME       LOG_MODE          FLASHBACK_ON ----------          ---------      ------------               ------------------ 1272537938   ORCL          NOARCHIVELOG    NO SQL>  archive log list; Database log mode              No Archive Mode Automatic archival             Disabled Archive destination  ...

DB - Setup the environment

Versao Portuguesa Quick Summary This post was initially written for 11g - how to setup the database environment to start the database instance. Post revised for 12c, in this case added some validations related with new functionalities related with conatiner databases . Some assumptions, the database was created with dbca , or if manually the installation was completed with the /etc/oratab registration. The easiest way to setup the environmnt variables is to run " . oraenv " in command line , let see the output: 11g - Setup environment variables [oracle@oracle ~]$ . oraenv ORACLE_SID = [orcl] ? The Oracle base for ORACLE_HOME=/u01/app/oracle/Database/11.2.0/orcl is /u01/app/oracle [oracle@oracle ~]$ echo $ORACLE_SID orcl 11g - Start the server Start the database instance, mount and open the database [oracle@oracle ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 19 20:02:16 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connect...

DB – Archive log mode

Versao Portuguesa This post comes out from the practice to learn and preparation the subjects for OCP - Oracle Certified Professional . In simple words, Oracle works with logs, all DMS/DDL are written in log file, know as redo logs, the written happens in circular way. So the files are redo file contents will be replaced, with the transactions. In order to keep that info, Oracle allows to archive the contents. It has a few reasons to archive the redo log, for now let focus on one, teh need of recover the database. I mean some thing happened and is need to put the database back. The traditional method is done in two steps. 1) Restore - restore data files and control files 2) Recover - Apply logs, in this case the archive logs .. and eventually redo log Let's see how to do that, but for now a note, the database should be in mount state and in a consistent manner, eg after a "shutdown immediate". SQL> select startup_time from  v$instance; STARTUP_Time --...