Grab A Meat (Learning Day by Day)

Just another WordPress.com weblog

Posts Tagged ‘Backup’

Oracle RMAN Backup

Posted by grabameat on July 10, 2009

RMAN

Recovery Manager commands.

  BACKUP     Back up database files, archive logs, backups, or copies.
  CHANGE     Update the status of a backup in the RMAN repository.
  CONFIGURE  Persistent RMAN settings.
  CROSSCHECK Check whether backup items still exist.
  DELETE     Delete backups from disk or tape
  EXIT       Exit the RMAN console
  LIST       List backups and copies
  RECOVER    Apply redo logs or incremental backups to a restored backup set
              (or copy) in order to update it to a specified time.
  REPORT     Report backup status: database, files, backups
  RESTORE    Restore files from an RMAN backup (or copy)
  RUN        Some RMAN commands are only valid inside a RUN block.
  SET        Settings for the current RMAN session.
  SHOW       Display the current configuration
  SHUTDOWN   Shutdown the database
  SQL        Execute a PL/SQL procedure or SQL statement(not SELECT)
  STARTUP    Startup the database

Syntax:
   Start RMAN without connecting to a database
         % rman

   Start RMAN with a command file to run
         % rman @/my_dir/my_commands.txt  

   Connect to a target database without using a recovery catalog:
         % rman TARGET SYS/pwd@target_str 

   Connect to a target database and export to a log file
         % rman TARGET SYS/pwd@target_str LOG $ORACLE_HOME/dbs/log/my_log.log APPEND

   Connect to a target database and a recovery catalog:
         % rman TARGET SYS/pwd@target_str CATALOG cat_usr/pwd@cat_str

Run a command file from the RMAN prompt
RMAN> @/my_dir/my_command_file.txt

In interactive mode, RMAN displays an “RMAN>" prompt
The commands above may be entered directly at the RMAN> prompt or used within a command file. To quit, type EXIT
RMAN records it’s backup activity in the database control file.

Optional Components of RMAN:

The recovery catalog database, a separate database used to record RMAN activity against one or more target databases. RMAN’s LISTREPORT, and SHOW commands display information from this repository. It is also possible for one database to store both the RMAN repository and other data. Typically this would be a Test or Train instance (with the repository data in a separate RMAN schema.)

The flash recovery area, a disk location in which the database can store and manage files related to backup and recovery.

Media management software, for interface with tape drives/libraries.

Initialization Parameters

Set the flash recovery area size and location, using DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE.

CONTROL_FILE_RECORD_KEEP_TIME controls how long backup records are kept in the control file before those records are re-used to hold information about more recent backups.

Versions
For simplicity the syntax on this page does not cover every command available;
it is based on commands that are common to both Oracle 9.2 and Oracle 10g (10.1)
10g has greatly improved RMAN data dictionary views for reporting.
RMAN was first introduced in Oracle 8.0

“We don’t want to go back to tomorrow, we want to go.. forward” – Dan Quale

Related Views:

RC_DATABASE             V$DATABASE
RC_DATABASE_INCARNATION V$DATABASE_INCARNATION

Equivalent SQL Server command:

BACKUP

Posted in Database Administration | Tagged: , , | Leave a Comment »

Oracle DBA Interview Questions & Answers

Posted by grabameat on July 10, 2009

DBA JOB Duties

1) check all the Databases are up and running
2) check for any Urgent Tickets with high priority
3) check for allocated storage space
4) check all the backup jobs have executed properly
5) check for the DBSNMP running or not
6) RMAN Backup = Recovery Manager

**Savepoint**

A savepoint is a special mark inside a transaction that allows all commands that are executed after it was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint.

Backup (hot and cold backup)

Hot backup will be done when the Database is Running and Archivelogmode is On.
Coldbackup will be done when the Database is shutdown and Backup Database then Start Database.

ArchiveLog Mode

So, if you wish to avoid the wrath of the CEO and angry end-users, you will want to run Oracle in ARCHIVELOG mode. In ARCHIVELOG mode, the database will make copies of all online redo logs after they are filled. These copies are called archived redo logs. The archived redo logs are created via the ARCH process. The ARCH process copies the archived redo log files to one or more archive log destination directories.

The use of ARCHIVELOG mode requires some configuration of the database. First you must put the database in ARCHIVELOG mode and you must also configure the ARCH process, and prepare the archived redo log destination directories.

There are some down sides to running the database in ARCHIVELOG mode. For example, once an online redo log has been filled, it cannot be reused until it has been archived. If Oracle cannot archive the online redo log (for example, the destination directory for the archived redo logs is filled up), it will switch to the next online redo log and keep working. At the same time, Oracle will continue to try to archive the log file.

**redo log files**

all Database transactions will be written to log files which are called redo log files

which log a history of all changes made to the database. Each redo log file consists of redo records. A redo record, also called a redo entry, holds a group of change-vectors, each of which describes or represents a change made to a single block in the database.

DATAFILES

Control files

The control files of a database store the status of the physical structure of the database. The control file is absolutely crucial to database operation. It contains (but is not limited to) the following types of information:
Database information (RESETLOGS SCN and their time stamp)
Archive log history
Tablespace and datafile records (filenames, datafile checkpoints, read/write status, offline or not)
Redo threads (current online redo log)
Database’s creation date
database name
current archive log mode
Log records (sequence numbers, SCN range in each log)
RMAN catalog
Database block corruption information
Database ID, which is unique to each DB
The location of the control files is specified through the control_files init param.

transactional files
flat files
RMAN BACKUP
oRACLE RAC

archiver
background process in oracle

steps in 2 phase commit

what are psuedo columns in Oracle,

0) OBJECT_ID
00) OBJECT_VALUE, ORA_ROWSCN (ROWS SCAN)
1) ROWNUM
2) CURRVAL
3) NEXTVAL
4) USER
5) SYSDATE

co-related sub query

DBCA – Database Configuration Assistant
Create Database

Posted in Database Administration, MySql, Oracle, Sql Server | Tagged: , , , , , , , | Leave a Comment »