Akhir akhir ini, saya sedang melakukan riset kecil kecilan mengenai metode backup yang ada di Oracle.
Salah satu yang saya temukan adalah menggunakan RMAN. RMAN atau Recovery Manager adalah tools bawaan Oracle yang berguna untuk membackup dan sekaligus merecovery data yang ada di Oracle. Perbedaannya dengan offline backup biasa yaitu kita tidak perlu menshutdown database sebelum melakukan copy datafile yang ada. Jadi proses full backup dapat dilakukan secara online berikut control filenya.
Berikut adalah cara backup database oracle dengan menggunakan RMAN yang saya sadur dari internet,
RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;
1. Melihat Konfigurasi RMAN saat ini
$ rman target / Recovery Manager: Release 10.2.0.3.0 - Production on Sat Aug 10 11:21:29 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: DEVDB (DBID=821773) RMAN>
RMAN> SHOW ALL; using target database control file instead of recovery catalog RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO "/backup/rman/ctl_%F"; CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 2; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT "/backup/rman/full_%u_%s_%p" MAXPIECESIZE 2048 M; CONFIGURE MAXSETSIZE TO UNLIMITED; CONFIGURE ENCRYPTION FOR DATABASE OFF; CONFIGURE ENCRYPTION ALGORITHM 'AES128'; CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/dbs/snapcf_devdb.f'; # default
2. Merubah Beberapa Configuration Parameter RMAN
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/rman/full_%u_%s_%p';
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
RMAN> SHOW ALL; .. CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/rman/full_%u_%s_%p'; CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; ..
RMAN> CONFIGURE RETENTION POLICY CLEAR;
RMAN> SHOW ALL; CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
3. Backup Oracle Database
$ mkdir -p /backup/rman
$ ls -l /backup/rman total 0
RMAN> BACKUP AS BACKUPSET DATABASE
RMAN> BACKUP AS BACKUPSET DATABASE PLUS ARCHIVELOG;
RMAN> BACKUP AS BACKUPSET TABLESPACE PRD01;
RMAN> BACKUP AS BACKUPSET DATABASE Starting backup at 10-AUG-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=193 devtype=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: sid=192 devtype=DISK channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00025 name=/u03/oradata/devdb/devuser07.dbf input datafile fno=00003 name=/u02/oradata/devdb/temp01.dbf channel ORA_DISK_1: starting piece 1 at 10-AUG-13 channel ORA_DISK_2: starting full datafile backupset channel ORA_DISK_2: specifying datafile(s) in backupset input datafile fno=00008 name=/u03/oradata/devdb/devusers05.dbf channel ORA_DISK_2: starting piece 1 at 10-AUG-13 ... .. piece handle=/backup/rman/full_4dogpd0u_4237_1 tag=TAG20130808T114846 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 10-AUG-13 ... Starting Control File and SPFILE Autobackup at 10-AUG-13 piece handle=/backup/rman/ctl_c-758818131-20130808-00 comment=NONE Finished Control File and SPFILE Autobackup at 10-AUG-13
$ ls -l /backup/rman total 14588 -rw-r----- 1 oracle dba 14585856 Aug 8 11:48 ctl_c-758818131-20130808-00 -rw-r----- 1 oracle dba 327680 Aug 8 11:48 full_4dogpd0u_4237_1
4. Menambahkan Backup TAG Name Untuk Identifikasi RMAN Backup File
RMAN> BACKUP AS BACKUPSET TAG 'WEEEKLY_PRD01_TBLS_BK_ONLY' TABLESPACE PRD01; Starting backup at 10-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting full datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00002 name=/u03/oradata/devdb/PRD01_1.dbf channel ORA_DISK_1: starting piece 1 at 10-AUG-13 channel ORA_DISK_1: finished piece 1 at 10-AUG-13 piece handle=/backup/rman/full_4fogpdb3_4239_1 tag=WEEEKLY_PRD01_TBLS_BK_ONLY comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 10-AUG-13 Starting Control File and SPFILE Autobackup at 10-AUG-13 piece handle=/backup/rman/ctl_c-758818131-20130808-01 comment=NONE Finished Control File and SPFILE Autobackup at 10-AUG-13
$ ls -l /backup/rman/ total 29176 -rw-r----- 1 oracle dba 14585856 Aug 8 11:48 ctl_c-758818131-20130808-00 -rw-r----- 1 oracle dba 14585856 Aug 8 11:54 ctl_c-758818131-20130808-01 -rw-r----- 1 oracle dba 327680 Aug 8 11:48 full_4dogpd0u_4237_1 -rw-r----- 1 oracle dba 327680 Aug 8 11:54 full_4fogpdb3_4239_1
5. Merubah Oracle RMAN Backup File Name
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT "/backup/rman/full_devdb_bk_%u_%s_%p" MAXPIECESIZE 2048 M;
RMAN> BACKUP AS BACKUPSET TAG 'WEEEKLY_PRD01_TBLS_BK_ONLY' TABLESPACE PRD01;
$ ls -l /backup/rman/ total 43764 -rw-r----- 1 oracle dba 14585856 Aug 8 11:48 ctl_c-758818131-20130808-00 -rw-r----- 1 oracle dba 14585856 Aug 8 11:54 ctl_c-758818131-20130808-01 -rw-r----- 1 oracle dba 14585856 Aug 8 11:56 ctl_c-758818131-20130808-02 -rw-r----- 1 oracle dba 327680 Aug 8 11:48 full_4dogpd0u_4237_1 -rw-r----- 1 oracle dba 327680 Aug 8 11:54 full_4fogpdb3_4239_1 -rw-r----- 1 oracle dba 327680 Aug 8 11:55 full_devdb_bk_4hogpdef_4241_1
6. Kompresi RMAN Backup
RMAN> BACKUP AS COMPRESSED BACKUPSET TAG 'WEEEKLY_PRD01_TBLS_BK_ONLY' TABLESPACE PRD01;
$ ls -l /backup/rman/ total 58352 -rw-r----- 1 oracle dba 14585856 Aug 8 11:48 ctl_c-758818131-20130808-00 -rw-r----- 1 oracle dba 14585856 Aug 8 11:54 ctl_c-758818131-20130808-01 -rw-r----- 1 oracle dba 14585856 Aug 8 11:56 ctl_c-758818131-20130808-02 -rw-r----- 1 oracle dba 14585856 Aug 8 11:59 ctl_c-758818131-20130808-03 -rw-r----- 1 oracle dba 327680 Aug 8 11:48 full_4dogpd0u_4237_1 -rw-r----- 1 oracle dba 327680 Aug 8 11:54 full_4fogpdb3_4239_1 -rw-r----- 1 oracle dba 327680 Aug 8 11:55 full_devdb_bk_4hogpdef_4241_1 -rw-r----- 1 oracle dba 127680 Aug 8 11:59 full_devdb_bk_4jogpdl0_4243_1
7. Melihat Seluruh RMAN Backup
RMAN> LIST BACKUP SUMMARY; using target database control file instead of recovery catalog List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- --------------- ------- ------- ---------- --- .. 4215 B F A DISK 10-AUG-13 1 1 NO TAG20130808T114846 4216 B F A DISK 10-AUG-13 1 1 NO TAG20130808T114849 4217 B F A DISK 10-AUG-13 1 1 NO WEEEKLY_PRD01_TBLS_BK_ONLY 4218 B F A DISK 10-AUG-13 1 1 NO TAG20130808T115413 4219 B F A DISK 10-AUG-13 1 1 NO WEEEKLY_PRD01_TBLS_BK_ONLY 4220 B F A DISK 10-AUG-13 1 1 NO TAG20130808T115600 4221 B F A DISK 10-AUG-13 1 1 YES WEEEKLY_PRD01_TBLS_BK_ONLY
SQL> SELECT OPERATION, STATUS, MBYTES_PROCESSED, START_TIME, END_TIME from V$RMAN_STATUS; OPERATION STATUS MBYTES_PROCESSED START_TIM END_TIME --------------------------------- ----------------------- ---------------- --------- --------- CONTROL FILE AND SPFILE AUTOBACK COMPLETED 14 07-NOV-12 07-NOV-12 RMAN COMPLETED 0 07-NOV-12 07-NOV-12 RESTORE VALIDATE COMPLETED 0 07-NOV-12 07-NOV-12 RMAN COMPLETED WITH ERRORS 0 07-NOV-12 07-NOV-12 DELETE COMPLETED 0 08-NOV-12 08-NOV-12 BACKUP COMPLETED 0 10-AUG-13 10-AUG-13 CONTROL FILE AND SPFILE AUTOBACK COMPLETED 14 10-AUG-13 10-AUG-13 RMAN COMPLETED WITH ERRORS 1832 10-AUG-13 10-AUG-13 RMAN COMPLETED 0 10-AUG-13 10-AUG-13 ...
Above step by step translated from http://www.thegeekstuff.com/2013/08/oracle-rman-backup/
ABOUT THE AUTHOR
Hello, this blog was originated for sharing and keeping all my finding about IT, Cities I traveled, and other, in line with my life motto "Make yourself usefull". BTW, Sorry for my English :)
0 komentar:
Posting Komentar