Archive for October, 2008

RMAN ile Backup &Restore

Friday, October 24th, 2008

 RMAN (Recovery Manager), Oracle veritabanının yedeğinin alınmasını ve yedekten dönülebilmesini sağlayan en önemli seçeneklerden birisidir. RMAN ile Hot(online) backup, incremental backup,Full backup alınabilir. Spfile ve controlfile’ların yedeğini alabildiğimiz gibi alınan backuplardan  Partial(PIT-Point in Time-Herhangi zamandaki bir noktaya) veya complete recovery yapabiliriz. Ancak RMAN ile sağlıklı bir şekilde yedek alabilmemiz için, veritabanımızın mutlaka ARCHIVELOG modunda olması gerekmektedir.

Veritabanımızı Archivelog’a geçirmek için; 

$ sqlplus “/ as sysdba”

SQL> ALTER SYSTEM SET log_archive_start=TRUE SCOPE=SPFILE;

SQL> shutdown immediate;

SQL> STARTUP MOUNT;

SQL> ALTER DATABASE ARCHIVELOG;

SQL> ALTER DATABASE OPEN;

Artık RMAN ile database ile ilgili tüm yedekleri alabiliriz.Öncelikle rman konsoluna yetkili user ve password ile bağlanalım.

$ rman target username/password

Veritabanın online yedeğini almak için

RMAN>BACKUP DATABASE;

Veritbanı+ archivelogların yedeğini almak için

RMAN>BACKUP DATABASE PLUS ARCHIVELOG;

Yedeği alınmış archivelogları, yedek alınırken silmek için;

RMAN>BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;

Yedeğin düzgün alınıp alınmadığını kontrol etmek için

RMAN>RESTORE DATABASE VALIDATE;

Control file dosyasını restore etmek için

RMAN> RESTORE CONTROLFILE;

Database restore etme

$ rman target / catalog rman/rman001@oracle2

RMAN> startup mount

RMAN> RESTORE DATABASE;

RMAN> RECOVER DATABASE;

RMAN> ALTER DATABASE OPEN;

Sık Kullanılan RMAN Komutları

Command

Description

@

Runs an RMAN script at the pathname specified after @. Default is current path.

BACKUP

Performs an RMAN backup with or without archived redo log files. Backs up datafiles, datafile copies, or performs incremental level 0 or level 1 backup. Also validates blocks to backed up with the VALIDATE clause.

CHANGE

Changes status of backup in RMAN repository – used to exclude a backup from a restore/recovery operation. Also used to notify RMAN that a backup file was removed by an operating system command outside of RMAN.

CONFIGURE

Configures RMAN persistent parameters. These parameters are available for subsequent sessions unless explicitly cleared/modified.

CREATE CATALOG

Creates a repository catalog with RMAN metadata for one (or more) target databases.

CROSSCHECK

Checks records of RMAN repository against actual disk or tape files.

DELETE

Deletes backup files or copies – removes the record of the backup file from the repository.

FLASHBACK

Performs a Flashback Database operation such as restoration to a point in time by SCN or log sequence.

LIST

Displays information about backupsets and image copies.

RECOVER

Performs complete or incomplete recovery on a datafile, tablespace, or entire database. Can apply incremental backups to roll forward.

REGISTER DATABASE

Registers a target database in the RMAN repository.

REPORT

Provides a detailed analysis of the RMAN repository.

RESTORE

Restores files from image copies or backupsets to disk – usually after a media failure. Can also be used to validate a restore operation without actually performing the restore by specifying the PREVIEW option.

RUN

Runs sequence of RMAN statements as a group between { and } – allows overriding RMAN parameters for the group of statements executed.

SET

Sets RMAN configuration settings for the duration of a RMAN session – not the same as CONFIGURE.

SHOW

Shows all or individual RMAN configured settings.

SHUTDOWN

Shuts down the target database with RMAN – same as SHUTDOWN within SQLPlus.

STARTUP

Starts up the target database with RMAN – same as STARTUP within SQLPlus.

SQL

Runs SQL commands – example: sql ‘ALTER TABLESPACE data01 OFFLINE IMMEDIATE’; — before a restore/recover operation.

 

Tags: , , ,
Posted in Oracle | 7 Comments »


system tablespace mutalaka backup alınmalı

Friday, October 24th, 2008

Eğer system tablespace tablespacelerinin düzenli backuplarını almazsanız; sisteminizdeki bu dosyanın bozulması durumunda veritabanınızdaki tüm datafile dosyalarını yedek almış olsanız bile bu data fileları backuptan geri dönemezsiniz….

Tags: ,
Posted in Oracle, ipucu | No Comments »


Oracle Database Servere yeni control file dosyası nasıl eklenir

Friday, October 24th, 2008

1-Öncelikle instance shut down edilir

2-Mevcut conrol file lardan birisi yeni bir isimde yeni lokasyona kopyalanır.

3-init.ora dosyasına conrol file değişiklikleri eklenir

4-Database açılır.

Tags: ,
Posted in Oracle, ipucu | No Comments »