Kategori arşivi: RAC

Real Application Cluster

RAC database backup ve restore işlemleri

RAC database backup ve restore işlemleri

Bu örneğimizde RAC database’de nasıl backup alınır, ihtiyaç halinde nasıl restore yapılır beraber inceleyelim.Backup almak single instance ortamlarla aynı ama restore yaparken ufak bir trick var.Database’i cluster moddan çıkarıp restore bittikten sonra tekrar cluster moda almak gerekiyor.(alter system set cluster_database=false) Bu örneğimizde SYSTEM datafile’ını silip database’i backupdan restore edeceğiz.

Ortamlar:
Solaris 10,
Grid 11.2.0.4
Database 11.2.0.4

Adım adım beraber yapalım..

Spfile backup alalım..

RMAN> BACKUP SPFILE FORMAT '/orabackup/rman/ractst/spfile_%d_%T_%I_%u.bkp';

Starting backup at 01-OCT-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 01-OCT-15
channel ORA_DISK_1: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/spfile_RACTST_20151001_482324484_06qikjbu.bkp tag=TAG20151001T155958 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-OCT-15

Controlfile backup alalım..

RMAN> BACKUP CURRENT CONTROLFILE FORMAT '/orabackup/rman/ractst/controlfile_%d_%T_%u.bkp';

Starting backup at 01-OCT-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 01-OCT-15
channel ORA_DISK_1: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/controlfile_RACTST_20151001_07qikjcb.bkp tag=TAG20151001T160011 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 01-OCT-15

Sıkıştırılmış full database backup alalım..

 
RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/orabackup/rman/ractst/datafiles_%d_%T_%u.bkp';

Starting backup at 01-OCT-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/ractst/datafile/tbs_dm.273.873560789
input datafile file number=00004 name=+DATA/ractst/datafile/users.259.873558059
channel ORA_DISK_1: starting piece 1 at 01-OCT-15
channel ORA_DISK_2: starting compressed full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00010 name=+DATA/ractst/datafile/tbs_dm.272.873561081
channel ORA_DISK_2: starting piece 1 at 01-OCT-15
channel ORA_DISK_3: starting compressed full datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00011 name=+DATA/ractst/datafile/tbs_dm.271.873561315
input datafile file number=00005 name=+DATA/ractst/datafile/undotbs2.264.873558267
channel ORA_DISK_3: starting piece 1 at 01-OCT-15
channel ORA_DISK_4: starting compressed full datafile backup set
channel ORA_DISK_4: specifying datafile(s) in backup set
input datafile file number=00008 name=+DATA/ractst/datafile/tbs_mx.270.873559789
input datafile file number=00003 name=+DATA/ractst/datafile/undotbs1.258.873558059
channel ORA_DISK_4: starting piece 1 at 01-OCT-15
channel ORA_DISK_5: starting compressed full datafile backup set
channel ORA_DISK_5: specifying datafile(s) in backup set
input datafile file number=00007 name=+DATA/ractst/datafile/tbs_mlc.269.873559675
input datafile file number=00001 name=+DATA/ractst/datafile/system.256.873558057
channel ORA_DISK_5: starting piece 1 at 01-OCT-15
channel ORA_DISK_6: starting compressed full datafile backup set
channel ORA_DISK_6: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/ractst/datafile/ts_audit.268.873559181
input datafile file number=00002 name=+DATA/ractst/datafile/sysaux.257.873558057
channel ORA_DISK_6: starting piece 1 at 01-OCT-15
channel ORA_DISK_7: starting compressed full datafile backup set
channel ORA_DISK_7: specifying datafile(s) in backup set
channel ORA_DISK_8: starting compressed full datafile backup set
channel ORA_DISK_8: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_8: starting piece 1 at 01-OCT-15
channel ORA_DISK_8: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0fqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_8: backup set complete, elapsed time: 00:00:02
including current control file in backup set
channel ORA_DISK_7: starting piece 1 at 01-OCT-15
channel ORA_DISK_7: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0eqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_7: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_6: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0dqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_6: backup set complete, elapsed time: 00:00:37
channel ORA_DISK_5: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0cqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_5: backup set complete, elapsed time: 00:02:27
channel ORA_DISK_4: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0bqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:04:47
channel ORA_DISK_1: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_08qikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:10:41
channel ORA_DISK_3: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0aqikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:10:41
channel ORA_DISK_2: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_09qikjcp.bkp tag=TAG20151001T160024 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:10:51
Finished backup at 01-OCT-15

Daha önce backup alınmamış Archivelogları backuplayalım..

RMAN> BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL NOT BACKED UP 1 TIMES FORMAT '/orabackup/rman/ractst/archivelogs_%d_%T_%u.bkp';

Starting backup at 01-OCT-15
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=2 sequence=333 RECID=952 STAMP=891959773
input archived log thread=1 sequence=621 RECID=955 STAMP=891959778
channel ORA_DISK_1: starting piece 1 at 01-OCT-15
channel ORA_DISK_2: starting compressed archived log backup set
channel ORA_DISK_2: specifying archived log(s) in backup set
input archived log thread=2 sequence=334 RECID=953 STAMP=891959775
input archived log thread=2 sequence=335 RECID=954 STAMP=891959775
channel ORA_DISK_2: starting piece 1 at 01-OCT-15
channel ORA_DISK_3: starting compressed archived log backup set
channel ORA_DISK_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=622 RECID=956 STAMP=891961462
channel ORA_DISK_3: starting piece 1 at 01-OCT-15
channel ORA_DISK_4: starting compressed archived log backup set
channel ORA_DISK_4: specifying archived log(s) in backup set
input archived log thread=2 sequence=336 RECID=958 STAMP=891964042
input archived log thread=1 sequence=623 RECID=957 STAMP=891964040
channel ORA_DISK_4: starting piece 1 at 01-OCT-15
channel ORA_DISK_5: starting compressed archived log backup set
channel ORA_DISK_5: specifying archived log(s) in backup set
input archived log thread=1 sequence=624 RECID=960 STAMP=891966763
input archived log thread=2 sequence=337 RECID=959 STAMP=891966762
channel ORA_DISK_5: starting piece 1 at 01-OCT-15
channel ORA_DISK_1: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/archivelogs_RACTST_20151001_0gqikl9b.bkp tag=TAG20151001T163243 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_2: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/archivelogs_RACTST_20151001_0hqikl9b.bkp tag=TAG20151001T163243 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_5: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/archivelogs_RACTST_20151001_0kqikl9c.bkp tag=TAG20151001T163243 comment=NONE
channel ORA_DISK_5: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_3: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/archivelogs_RACTST_20151001_0iqikl9b.bkp tag=TAG20151001T163243 comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_4: finished piece 1 at 01-OCT-15
piece handle=/orabackup/rman/ractst/archivelogs_RACTST_20151001_0jqikl9c.bkp tag=TAG20151001T163243 comment=NONE
channel ORA_DISK_4: backup set complete, elapsed time: 00:00:07
Finished backup at 01-OCT-15

Eksik backup var mı kontrol edelim.

RMAN> report need backup;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------

Databaseleri kapatalım..

-bash-3.2$ srvctl stop database -d ractst
-bash-3.2$ srvctl status database -d ractst
Instance ractst1 is not running on node svtstrac01
Instance ractst2 is not running on node svtstrac02
-bash-3.2$

Asm üzerinden SYSTEM Datafileını silelim.

-bash-3.2$ORACLE_HOME=/oragrid/app/product/11.2.0.4/grid
-bash-3.2$ORACLE_SID=+ASM1
-bash-3.2$PATH=$ORACLE_HOME/bin:$PATH
-bash-3.2$export ORACLE_HOME ORACLE_SID PATH ORACLE_UNQNAME

ASMCMD> cd +DATA/RACTST/DATAFILE
ASMCMD> ls
SYSTEM.256.873558057
SYSAUX.257.873558057
TBS_DM.271.873561315
TBS_DM.272.873561081
TBS_DM.273.873560789
TBS_MLC.269.873559675
TBS_MX.270.873559789
TS_AUDIT.268.873559181
UNDOTBS1.258.873558059
UNDOTBS2.264.873558267
USERS.259.873558059

ASMCMD> rm SYSTEM.256.873558057
ASMCMD> ls
SYSAUX.257.873558057
TBS_DM.271.873561315
TBS_DM.272.873561081
TBS_DM.273.873560789
TBS_MLC.269.873559675
TBS_MX.270.873559789
TS_AUDIT.268.873559181
UNDOTBS1.258.873558059
UNDOTBS2.264.873558267
USERS.259.873558059

SYSTEM datafile’ı sildik,databaseleri start edelim.Ve hatayı görelim..

-bash-3.2$ srvctl start database -d ractst
PRCR-1079 : Failed to start resource ora.ractst.db
CRS-5017: The resource action "ora.ractst.db start" encountered the following error:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DATA/ractst/datafile/system.256.873558057'

CRS-2674: Start of 'ora.ractst.db' on 'svtstrac01' failed
CRS-2632: There are no more servers to try to place resource 'ora.ractst.db' on that would satisfy its placement policy
CRS-5017: The resource action "ora.ractst.db start" encountered the following error:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '+DATA/ractst/datafile/system.256.873558057'

Görüldüğü gibi SYSTEM datafile’ına erişemedi, ve instancelar startup olmadı..
İnstancelardan birine bağlanıp mount modda açalım ve cluster_database=false yapalım..

-bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 1 17:11:37 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1.0689E+10 bytes
Fixed Size                  2233536 bytes
Variable Size            5905582912 bytes
Database Buffers         4764729344 bytes
Redo Buffers               16928768 bytes
Database mounted.

SQL> alter system set cluster_database=false scope=spfile sid='*';

System altered.

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

Parametreyi false yaptıktan sonra RMAN üzerinden mount edelim ve restore başlatalım..

-bash-3.2$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Oct 1 17:13:42 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> startup mount;

Oracle instance started
database mounted

Total System Global Area   10689474560 bytes

Fixed Size                     2233536 bytes
Variable Size               5905582912 bytes
Database Buffers            4764729344 bytes
Redo Buffers                  16928768 bytes

RMAN ile database restore başlatalım..

RMAN> restore database;

Starting restore at 01-OCT-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=355 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=125 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=246 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=363 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=9 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=126 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=247 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=364 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to +DATA/ractst/datafile/sysaux.257.873558057
channel ORA_DISK_1: restoring datafile 00006 to +DATA/ractst/datafile/ts_audit.268.873559181
channel ORA_DISK_1: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_0dqikjcp.bkp
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to +DATA/ractst/datafile/system.256.873558057
channel ORA_DISK_2: restoring datafile 00007 to +DATA/ractst/datafile/tbs_mlc.269.873559675
channel ORA_DISK_2: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_0cqikjcp.bkp
channel ORA_DISK_3: starting datafile backup set restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_DISK_3: restoring datafile 00003 to +DATA/ractst/datafile/undotbs1.258.873558059
channel ORA_DISK_3: restoring datafile 00008 to +DATA/ractst/datafile/tbs_mx.270.873559789
channel ORA_DISK_3: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_0bqikjcp.bkp
channel ORA_DISK_4: starting datafile backup set restore
channel ORA_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_DISK_4: restoring datafile 00004 to +DATA/ractst/datafile/users.259.873558059
channel ORA_DISK_4: restoring datafile 00009 to +DATA/ractst/datafile/tbs_dm.273.873560789
channel ORA_DISK_4: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_08qikjcp.bkp
channel ORA_DISK_5: starting datafile backup set restore
channel ORA_DISK_5: specifying datafile(s) to restore from backup set
channel ORA_DISK_5: restoring datafile 00005 to +DATA/ractst/datafile/undotbs2.264.873558267
channel ORA_DISK_5: restoring datafile 00011 to +DATA/ractst/datafile/tbs_dm.271.873561315
channel ORA_DISK_5: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_0aqikjcp.bkp
channel ORA_DISK_6: starting datafile backup set restore
channel ORA_DISK_6: specifying datafile(s) to restore from backup set
channel ORA_DISK_6: restoring datafile 00010 to +DATA/ractst/datafile/tbs_dm.272.873561081
channel ORA_DISK_6: reading from backup piece /orabackup/rman/ractst/datafiles_RACTST_20151001_09qikjcp.bkp
channel ORA_DISK_1: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0dqikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
channel ORA_DISK_2: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0cqikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:02:45
channel ORA_DISK_3: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0bqikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:05:25
channel ORA_DISK_4: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_08qikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_4: restored backup piece 1
channel ORA_DISK_4: restore complete, elapsed time: 00:13:35
channel ORA_DISK_5: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_0aqikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_5: restored backup piece 1
channel ORA_DISK_5: restore complete, elapsed time: 00:13:35
channel ORA_DISK_6: piece handle=/orabackup/rman/ractst/datafiles_RACTST_20151001_09qikjcp.bkp tag=TAG20151001T160024
channel ORA_DISK_6: restored backup piece 1
channel ORA_DISK_6: restore complete, elapsed time: 00:13:45
Finished restore at 01-OCT-15

Restore işlemi bittikten sonra recover diyerek archivelogları da işletelim ve database’i son ana kadar getirelim.

RMAN> recover database;

Starting recover at 01-OCT-15
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 01-OCT-15

Restore ve recover tamamlandı, şimdi cluster_database=true yapıp instanceları başlatalım..

-bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 1 17:30:58 2015

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set cluster_database=true scope=spfile sid='*';

System altered.

SQL> shu immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

Şimdi Her iki instanceı da başlatalım..

-bash-3.2$ srvctl start database -d ractst

-bash-3.2$ srvctl status database -d ractst
Instance ractst1 is running on node svtstrac01
Instance ractst2 is running on node svtstrac02

İşlem tamamdır. Databaselerimiz ayakta : )

Notlar:
-Restore recover işlemini tek nod üzerinden yaptık,bunun için cluster_database parametresini false yapmamız gerekti.
-Restore sonrasında bu parametreyi true yaparak iki nodu birden ayağa kaldırdık.
-Burdaki senaryoda aslında datafile kayıptı.Restore datafile,recover datafile diyerek yapabilirdik,daha kısa sürerdi, örnek olması açısından yaptım.
-Backup ve restore adımlarında 8 channel görünüyor, rman configrasyonunda 8 parallel verdiğim için 8 channel açtı.

Umarım faydalı olur..

RAC ORA-00245: control file backup operation failed

RAC ORA-00245: control file backup operation failed

RAC ortamlarda controlfile backup alırken aşağıdaki gibi bir hata alırsak ne yapabiliriz bakalım.

Rman loglarına aşağıdaki gibi yansıyacaktır.

RAC 11gR2 ORA-00245: control file backup operation failed

RMAN-00571: =========================================================== 
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== 
RMAN-00571: =========================================================== 
RMAN-03009: failure of Control File and SPFILE Autobackup command on 
ORA_DISK_1 channel at 18/10/2015 13:34:07
ORA-00245: control file backup operation failed

Alert loga aşağıdaki gibi bir hata basacaktır.

LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2

******************************************************************

Sun Oct 18 18:00:05 2015

Archived Log entry 37833 added for thread 1 sequence 8252 ID 
0xb08b14e7 dest 1:
Sun Oct 18 18:01:50 2015

Errors in file /oracle/app/product/diag/rdbms/ractst/ractst1/trace/ractst1_ora_26854.trc:

ORA-00245: control file backup failed; target is likely on a local file system
Sun Oct 18 18:10:05 2015

Thread 1 advanced to log sequence 8254 (LGWR switch)
  
Current log# 6 seq# 8254 mem# 0: +RECO/ractst/onlinelog/group_6.260.889664983

Şimdi gelelim çözümüne, hata controlfile snapshot backup ının tüm nodların erişebileceği ortak bir alanda tutulmamasından kaynaklanıyor.
Controlfile snapshot’ı nerede tutuluyor bakalım.Bunun için RMAN bağlanıyoruz ve “show all” komutunu çalıştırıyoruz.

-bash-3.2$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Oct 19 11:23:10 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACTST (DBID=2948358668)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name RACTST are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/app/product/11.2.0.4/db/dbs/snapcf_ractst1.f'; # default

Görüldüğü gibi (son satırda) oracle ın kurulu olduğu dizinde tutuluyor.Tüm nodların erişebileceği ortak bir yer(ASM data dikini) gösterelim.


RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DATA/RACTST/CONTROLFILE/SNAPCF_RACTST1.f';

using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+DATA/RACTST/CONTROLFILE/SNAPCF_RACTST1.f';
new RMAN configuration parameters are successfully stored

*Bu işlemi tek nodda yapmamız yeterlidir.
*Ben ASM DATA diskini kullandım, tüm nodların erişebildiği file system de olabilir..

Umarım faydalı olur..

RAC OCR Ve Voting Diski Taşımak

RAC OCR ve VOTINGDISK Taşımak.

Rac ortamlarda OCR ve Voting diski yeni bir ASM disk gruba nasıl taşırız,nasıl kontrol ederiz
beraber bakalım.Oracle RAC kurulumunda bu konfig dosyaları default olarak +DATA diskine yerleştiriliyor.
OCR ve Voting diskin ayrı bir özel disk grubunda bulunması tavsiye edilir.

Önce OCR ve Voting Disk için özel bir asm disk grubu oluşturalım.(+OCRVOT dedim ben)
Aşağıdaki işlemleri rac nodlarından birinde yapmamız yeterlidir.

1-) Yeni ASM disk grup(+OCRVOT) oluşturalım.(oracle userı ile)

Oracle userı için grid home değişkenlerini set edelim..

-bash-3.2$ ORACLE_HOME=/oragrid/app/product/11.2.0.4/grid
-bash-3.2$ ORACLE_SID=+ASM2
-bash-3.2$ PATH=$ORACLE_HOME/bin:$PATH
-bash-3.2$ export ORACLE_HOME ORACLE_SID PATH ORACLE_UNQNAME

Yeni disk grubumuzu oluşturuyoruz(+OCRVOT).OCR ve Voting için 8-10 GB raw bir disk yeterli olacaktır.
Bu diske tüm nodlar erişebilmelidir ve ownerı oracle userı olmalıdır.

-bash-3.2$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Sep 23 11:04:44 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> CREATE DISKGROUP OCRVOT EXTERNAL REDUNDANCY DISK '/dev/rdsk/emcpower10g';

Diskgroup created.

-- Disklerimizi kontrol edelim..
SQL> select name,path,header_status from v$asm_disk;

 OCRVOT_0000	/dev/rdsk/emcpower10g	MEMBER
 RECO_0000	/dev/rdsk/emcpower11g	MEMBER
 DATA_0000	/dev/rdsk/emcpower12g	MEMBER
2-) Voting diski yeni disk gruba taşıyalım.(root userı ile yapıyoruz)
-bash-3.2$ su - root
Password:
-bash-3.2$

-- grid home değişkenlerini root için set edelim..
-bash-3.2$ ORACLE_HOME=/oragrid/app/product/11.2.0.4/grid
-bash-3.2$ ORACLE_SID=+ASM2
-bash-3.2$ PATH=$ORACLE_HOME/bin:$PATH
-bash-3.2$ export ORACLE_HOME ORACLE_SID PATH ORACLE_UNQNAME

Önce mevcut voting diski kontrol edelim.

-bash-3.2$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   54654668334f7ebf7567657fhd36ch34 (/dev/rdsk/emcpower12g) [DATA]
Located 1 voting disk(s).

Voting diski taşıyalım..

-bash-3.2$ crsctl replace votedisk +OCRVOT

Yeni Voting disk lokasyonunu kontrol edelim..

-bash-3.2$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   95a6f0d308334f7ebf128c0404d36c7d (/dev/rdsk/emcpower10g) [OCRVOT]
Located 1 voting disk(s).

Voting diski taşımış olduk şimdi OCR ı taşıyalım..

3-) OCR ı yeni disk gruba taşıyalım.(root userı ile yapıyoruz)

OCR ın bir kopyasını OCRVOT diskine taşıyalım.

-bash-3.2$ ocrconfig -add +OCRVOT

OCR lokasyonunu kontrol edelim, hem +DATA hem +OCRVOT olarak görmemiz gerekiyor..

-bash-3.2$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3552
         Available space (kbytes) :     258568
         ID                       : 1847570962

         Device/File Name         :    +DATA
                                    Device/File integrity check succeeded

         Device/File Name         :    +OCRVOT
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

Her iki disktede OCR ı gördüğümüze göre +DATA daki OCR ı silip işlemi bitirebiliriz..

-bash-3.2$ ocrconfig -delete +DATA
-bash-3.2$ ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       3552
         Available space (kbytes) :     258568
         ID                       : 1847570962
         Device/File Name         :    +OCRVOT
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

Ve işlem tamamlanmıştır : )

RAC databasede paralel export almak

RAC Aktif nodlar üzerinden paralel export almak

Rac ortamlarda expdp komutuna paralel parametresi ekleyerek backup aldırabiliriz, paralellik derecesi kadar backup dump file oluşacaktır.Cluster olduğu için backup export processleri nodlar arasında dağıtılacaktır.

Ortam değişkenlerimizi set edelim.

bash-3.2$ ORACLE_HOME=/oracle/app/product/11.2.0.4/db 
bash-3.2$ ORACLE_SID=mxprod1
bash-3.2$ PATH=$PATH:$ORACLE_HOME/bin
bash-3.2$ export ORACLE_HOME ORACLE_SID PATH

RAC databasede 4 parallel bi_rep schemasını export alalım.

bash-3.2$ expdp '" / as sysdba"' schemas=BI_REP directory=export_dir dumpfile=bi_rep%U.dmp logfile=log_bi_rep.log reuse_dumpfiles=y parallel=4

Eğer aşağıdaki gibi bir hata alırsak, backup dizinine 2. nodun erişebildiğinden emin olmamız gerekli. 2. nodun da backup dizinini ya da diskini görmesi halinde export backup başarılı bir şekilde tamamlanacaktır.

ORA-31693: Table data object "BI_REP"."TEMPDBMLC142009697768_TMP_DBF" failed to load/unload and is being skipped due to error:
ORA-31617: unable to open dump file "/orabackup/export_backup/bi_rep04.dmp" for write
ORA-19505: failed to identify file "/orabackup/export_backup/bi_rep04.dmp"
ORA-27037: unable to obtain file status
Solaris-AMD64 Error: 2: No such file or directory
ORA-31640: unable to open dump file "/restore/psdwh/exp_dataONLY_iccs_25062

2.Nodunda dizine erişmesini sağladıktan sonra export düzgün bi şekilde tamamlanacaktır..

bash-3.2$ expdp '" / as sysdba"' schemas=BI_REP directory=export_dir dumpfile=bi_rep%U.dmp logfile=log_bi_rep.log reuse_dumpfiles=y parallel=4

Rac Tek nod üzerinden paralel export almak

RAC databasede tek node üzerinden parallel export almak da mümkün bunun için expdp komutumuza Cluster=N parametresini eklemek gerekiyor.
Bu durumda tek nod üzerinden 4 paralel ile export alınacaktır.

bash-3.2$ expdp '" / as sysdba"' schemas=BI_REP directory=export_dir dumpfile=bi_rep%U.dm  logfile=log_bi_rep.log reuse_dumpfiles=y parallel=4 cluster=N

Umarım faydalı olur.

RAC Database’e Controlfile Eklemek

RAC Database’e Controlfile Eklemek

Dbca ile RAC database create ettiğimizde default olarak bir tane controlfile oluşturulur, bu pek tercih edilen bir durum değildir, bozulmalara karşı controlfile’ı farklı yerlerde en az iki kopya tutmamız gerekir..

Aşağıdaki örnekte 11.2.0.4 RAC ve ASM ortamında controlfile’ımızı kopyalayacağız..
Bir tane FRA alanımızda var, bir tane de +DATA diskimize oluşturacağız.

1 )Önce controlfile’ımızı sorgulayalım..Görüldüğü gibi bir tane controlfileımız var.

SQL> show parameter control_files;

NAME           TYPE        VALUE
-------------- -------     ------------------------------
control_files  string      +RECO/ractst/controlfile/current.256.876145805

2 ) Yeni controlfile parametresini set edelim.(scope=spfile)
İkinci parametre olarak +DATA verdim, +DATA diskinde otomatik olarak isimlendirecek.

SQL> alter system set control_files='+RECO/ractst/controlfile/current.256.876145805','+DATA' scope=spfile sid='*';

3 ) Rac database durdurulur.

srvctl stop database -d ractst

4 ) Rac Database nomount modda açılır.

srvctl start database -d ractst -o nomount

5 ) Rman ile bağlanılır controlfile restore edilir.

RMAN> restore controlfile from '+RECO/ractst/controlfile/current.256.876145805';
Starting restore at 14-JUN-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 instance=ractst1 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+RECO/ractst/controlfile/current.256.876145805
output file name=+DATA/ractst/controlfile/current.260.873558149
Finished restore at 14-JUN-15

6 ) Rac Database’imizi stop edelim.

srvctl stop database -d ractst

7 ) Rac Database’imizi start edelim.

srvctl start database -d ractst

8 ) Controlfile dosyalarımızı kontrol edelim, 2 tane görmemiz gerekiyor..

SQL> show parameter control_files;

NAME           TYPE        VALUE
-------------- -------     ------------------------------
control_files  string      +RECO/ractst/controlfile/current.256.876145805
control_files  string      +DATA/ractst/controlfile/current.260.873558149