关于centos6.8下Oracle11gRAC 设置本地归档目录,并配置nfs共享目录rman备份

1、修改目录
将两个节点的归档修改到本地文件系统下
节点1归档到/arch1
节点2归档到/arch2

2、创建本地目录
节点1:

#mkdir -p /arch1

#chown -R oracle:oinstall /arch1
#chown -R 775 /arch1

节点2:

#mkdir -p /arch2
#chown -R oracle:oinstall /arch2
#chown -R 775 /arch2

3、修改归档(任一节点操作)
SQL>alter system set log_archive_dest_1='location='/arch1' scope=spfile sid='oratest1';
SQL>alter system set log_archive_dest_1='location='/arch2' scope=spfile sid='oratest2';

4、重启到mount状态
节点1:
SQL>shutdown immediate;
SQL>startup mount;
节点2:
SQL>shutdown immediate;
SQL>startup mount;

5、打开库
两个节点依次打开
SQL>alter database open;

6、查看归档
节点1:
SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /arch1
Oldest online log sequence     23
Next log sequence to archive   24
Current log sequence           24

节点2:
SQL> archive log list;
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /arch2
Oldest online log sequence     23
Next log sequence to archive   24
Current log sequence           24

7、日志切换测试
SQL>alter system switch logfile;

8、rman备份数据库及两节点本地归档日志到共享nfs目录

节点1(192.192.103.85)server:
 
---创建nfs共享目录---

mkdir -p /backup
#vi /etc/exports
/backup * (rw,sync,no_roo_squash,no_all_squash)
---生效nfs目录---
#exportfs -a  
---启动nfs服务---
#service  rpcbind start
#service nfs start
---查看nfs共享信息---
 #showmount -e
 /backup *
 
 节点2(192.192.103.86)client:
---创建目录---
#mkdir -p /backup
---检查nfs server共享目录信息---
#showmount -e 192.192.103.85
---mount nfs共享目录---
#mount -t nfs -o rw 192.192.103.85:/backup /backup
---编辑fstab文件--
#vi /etc/fstab
192.192.103.85:/backup  /backup nfs  defaults 0 0
---启动nfs服务---
#service  rpcbind start
#service nfs start

-----两节点配置TNSNAMES.ora文件-----

ORATEST1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ora85)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.192.103.85)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oratest)
      (INSTANCE_NAME = oratest1) 
    )
  )

ORATEST2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ora86)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.192.103.86)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oratest)
      (INSTANCE_NAME = oratest2)
    )
  )

-----执行备份测试-----
RMAN> run
{
allocate channel c1 device type disk connect sys/oracle@oratest1;
allocate channel c2 device type disk connect sys/oracle@oratest1;
allocate channel c3 device type disk connect sys/oracle@oratest2;
allocate channel c4 device type disk connect sys/oracle@oratest2;
backup database plus archivelog delete input format '/backup/%T%U';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 

released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
released channel: ORA_DISK_4
allocated channel: c1
channel c1: SID=213 instance=oratest1 device type=DISK

allocated channel: c2
channel c2: SID=404 instance=oratest1 device type=DISK

allocated channel: c3
channel c3: SID=408 instance=oratest2 device type=DISK

allocated channel: c4
channel c4: SID=201 instance=oratest2 device type=DISK


Starting backup at 15-DEC-21
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=2 sequence=11 RECID=19 STAMP=1091367222
input archived log thread=1 sequence=14 RECID=20 STAMP=1091367222
input archived log thread=1 sequence=15 RECID=22 STAMP=1091367263
channel c1: starting piece 1 at 15-DEC-21
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=23 STAMP=1091367961
input archived log thread=1 sequence=17 RECID=26 STAMP=1091368098
input archived log thread=1 sequence=18 RECID=28 STAMP=1091368341
channel c2: starting piece 1 at 15-DEC-21
channel c1: finished piece 1 at 15-DEC-21
piece handle=/backup/202112150t0gpvcc_1_1 tag=TAG20211215T142620 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/arch1/2_11_1091275028.dbf RECID=19 STAMP=1091367222
archived log file name=/arch1/1_14_1091275028.dbf RECID=20 STAMP=1091367222
archived log file name=/arch1/1_15_1091275028.dbf RECID=22 STAMP=1091367263
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=19 RECID=29 STAMP=1091368593
input archived log thread=1 sequence=20 RECID=32 STAMP=1091368708
channel c1: starting piece 1 at 15-DEC-21
channel c2: finished piece 1 at 15-DEC-21
piece handle=/backup/202112150u0gpvcc_1_1 tag=TAG20211215T142620 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c2: deleting archived log(s)
archived log file name=/arch1/1_16_1091275028.dbf RECID=23 STAMP=1091367961
archived log file name=/arch1/1_17_1091275028.dbf RECID=26 STAMP=1091368098
archived log file name=/arch1/1_18_1091275028.dbf RECID=28 STAMP=1091368341
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=33 STAMP=1091368957
channel c2: starting piece 1 at 15-DEC-21
channel c4: starting archived log backup set
channel c4: specifying archived log(s) in backup set
input archived log thread=2 sequence=18 RECID=34 STAMP=1091368987
channel c4: starting piece 1 at 15-DEC-21
channel c1: finished piece 1 at 15-DEC-21
piece handle=/backup/202112150v0gpvce_1_1 tag=TAG20211215T142620 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/arch1/1_19_1091275028.dbf RECID=29 STAMP=1091368593
archived log file name=/arch1/1_20_1091275028.dbf RECID=32 STAMP=1091368708
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=22 RECID=35 STAMP=1091370377
channel c1: starting piece 1 at 15-DEC-21
channel c3: starting archived log backup set
channel c3: specifying archived log(s) in backup set
input archived log thread=2 sequence=19 RECID=36 STAMP=1091370407
channel c3: starting piece 1 at 15-DEC-21
channel c2: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215100gpvce_1_1 tag=TAG20211215T142620 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c2: deleting archived log(s)
archived log file name=/arch1/1_21_1091275028.dbf RECID=33 STAMP=1091368957
channel c4: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215110gpvdb_1_1 tag=TAG20211215T142620 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:01
channel c4: deleting archived log(s)
archived log file name=/arch2/2_18_1091275028.dbf RECID=34 STAMP=1091368987
channel c1: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215120gpvcf_1_1 tag=TAG20211215T142620 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/arch1/1_22_1091275028.dbf RECID=35 STAMP=1091370377
channel c3: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215130gpvdc_1_1 tag=TAG20211215T142620 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:01
channel c3: deleting archived log(s)
archived log file name=/arch2/2_19_1091275028.dbf RECID=36 STAMP=1091370407
Finished backup at 15-DEC-21

Starting backup at 15-DEC-21
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/oratest/datafile/system.256.1091274917
input datafile file number=00004 name=+DATA/oratest/datafile/users.259.1091274919
channel c1: starting piece 1 at 15-DEC-21
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATA/oratest/datafile/sysaux.257.1091274919
input datafile file number=00006 name=+DATA/oratest/datafile/undotbs2.265.1091275293
channel c2: starting piece 1 at 15-DEC-21
channel c4: starting full datafile backup set
channel c4: specifying datafile(s) in backup set
input datafile file number=00005 name=+DATA/oratest/datafile/example.264.1091275055
input datafile file number=00003 name=+DATA/oratest/datafile/undotbs1.258.1091274919
channel c4: starting piece 1 at 15-DEC-21
channel c4: finished piece 1 at 15-DEC-21
piece handle=+FRA/oratest/backupset/2021_12_15/nnndf0_tag20211215t142628_0.269.1091370419 tag=TAG20211215T142628 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:15
channel c1: finished piece 1 at 15-DEC-21
piece handle=+FRA/oratest/backupset/2021_12_15/nnndf0_tag20211215t142628_0.261.1091370389 tag=TAG20211215T142628 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:26
channel c2: finished piece 1 at 15-DEC-21
piece handle=+FRA/oratest/backupset/2021_12_15/nnndf0_tag20211215t142628_0.262.1091370389 tag=TAG20211215T142628 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:26
Finished backup at 15-DEC-21

Starting backup at 15-DEC-21
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=23 RECID=37 STAMP=1091370420
channel c1: starting piece 1 at 15-DEC-21
channel c4: starting archived log backup set
channel c4: specifying archived log(s) in backup set
input archived log thread=2 sequence=20 RECID=38 STAMP=1091370450
channel c4: starting piece 1 at 15-DEC-21
channel c1: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215170gpvdp_1_1 tag=TAG20211215T142705 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/arch1/1_23_1091275028.dbf RECID=37 STAMP=1091370420
channel c4: finished piece 1 at 15-DEC-21
piece handle=/backup/20211215180gpvel_1_1 tag=TAG20211215T142705 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:02
channel c4: deleting archived log(s)
archived log file name=/arch2/2_20_1091275028.dbf RECID=38 STAMP=1091370450
Finished backup at 15-DEC-21

Starting Control File and SPFILE Autobackup at 15-DEC-21
piece handle=/backup/c-3626654096-20211215-04 comment=NONE
Finished Control File and SPFILE Autobackup at 15-DEC-21

released channel: c1

released channel: c2

released channel: c3

released channel: c4

RMAN> 

猜你喜欢

转载自blog.csdn.net/zhrzhl/article/details/121952634