ITPub博客

首页 > 数据库 > Oracle > 【RECO_ORACLE】NBU 8.2新特性——快速拉起的恢复步骤

【RECO_ORACLE】NBU 8.2新特性——快速拉起的恢复步骤

原创 Oracle 作者:Attack_on_Jager 时间:2021-01-15 14:45:08 0 删除 编辑

快速拉起是NBU 8 的新功能,利用Oracle RMAN的 image copy(NBU 7是通过RMAN传统备份集——BackupSet的方式)做的 物理文件的镜像副本,利用NFS直接挂载到恢复机上, 无需手动“restore database”从而达到快速恢复数据库的目的;并且在备份方面(增量备份)只备份更改过的数据块,更加节省空间( 需要开启Oracle块跟踪: alter database enable block change tracking )。

 

实验环境

OS :Oracle Linux 6.10

DataBase :Oracle 11.2.0.4

NBU :8.2

注:数据库备份在NBU服务端(Master),恢复在NBU客户端(Client);RAC和单机的恢复方式相同,但RAC只需要在某一个节点上备份。

 

NBU Master 端操作

1 、登录Master服务器:

为了验证Master的NFS配置是否成功,先在Client用bplist查询备份镜像能否识别,能够正常列出备份镜像证明配置生效

/usr/openv/netbackup/bin/bplist -C TestDB -t 4 -R -l /

 

2 、在Master查找能够即时拉起的镜像image,根据“Time”选择想要恢复的日期,并记录下ID(红色标记部分)

[root@NBUMaster ~]#  nborair -list_images -client TestDB -server NBUMaster

Time: 2020-12-20 08:20:51 ID: TestDB_1608409301 Full Backup testdb

Time: 2020-12-21 08:16:29 ID: TestDB_ 1608495368 Full Backup testdb

注意:

(1)命令内-client指源机的主机名,-server指Master的主机名

(2) 下面的“Full Backup”字样只是人为定义的tag名称,不代表“全库备份”


3 、确认所需镜像image包含的文件

[root@NBUMaster ~]#  nborair -list_files -backupid TestDB_1608495368 (检查表空间的备份是否都存在)

-rw-r----- oracle asmadmin 33554424K 12 月 21 08:12 /nfspool/data_D-TEST_I-1979817751_TS_UNDOTBS1_testdb02

-rw-r----- oracle asmadmin 33554424K 12 月 21 08:12 /nfspool/data_D-TEST_I-1979817751_TS_USERS_testdb02

......

 

4 、基于ID生成镜像快照,以便异机恢复挂载。

注意:命令内-dest_client后跟异机的主机名hostname

[root@NBUMaster ~]# nborair -create_recovery_point -backupid TestDB_1608495368 -dest_client NBU82Restore

如果此步报错:

[root@NBUMaster ~]#  nborair -create_recovery_point -backupid TestDB_1608495368 -dest_client NBU82Restore

Error message from Appliance : Failed to reexport NFS shares (UMI Code : V-409-500-1042)

EXIT STATUS 5432: The requested NetBackup appliance operation is unsuccessful.

[root@NBUMaster ~]#  nborair -create_recovery_point -backupid TestDB_1608495368 -dest_client NBU82Restore

Error message from Appliance : Recovery point already exists. Export path: /shares/test_nfspool_TestDB_1608495368_

rp1, Export options: nbu82restore(rw,no_root_squash,insecure), Appliance : NBUMedia01. (UMI Code : V-409-500-1002)EXIT STATUS 5432: The requested NetBackup appliance operation is unsuccessful.

如果报以上提示说明创建恢复点失败

列出当前 mediaserver 上挂载的所有挂载点:

[root@NBUMaster ~]# nborair -list_recovery_points -appliance NBUMedia01

Total 2 recovery points found.

 

Export path: /shares/test_nfspool_TestDB_1595091960_rp1

Share name: nbutest_nfspool

Export options: nbu82restore(rw,no_root_squash,insecure)

 

Export path: /shares/test_nfspool_TestDB_1608495368_rp1

Share name: nbutest_nfspool

Export options: nbu82restore(rw,no_root_squash,insecure)

 

删除刚才 创建失败的挂载点:

[root@NBUMaster ~]# nborair -delete_recovery_point -appliance NBUMedia01 -export_path /shares/test_nfspool_TestDB_1608495368_rp1

然后再次查看挂载点是否还在。

 

5 、在Oracle客户端(200.0.253.127)上创建挂载点:

[root@NBU82Restore ~]# mkdir /nfspool

 

NBU Client 端挂载操作

1 、用root用户挂载VA Media一体机提供的NFS Shares空间,挂载参数如下:

# mount -t nfs NBUMedia01.local:/shares/test_nfspool_TestDB_1595091960_rp1 -o rw,bg,hard, nolock,nointr,rsize=1048576,wsize=1048576,tcp,actimeo=0,vers=3,timeo=600 /nfspool

 

2 、改Oracle客户端挂载点nfspool的权限:

# chmod 700 /nfspool

# chown -R oracle:oinstall /nfspool  ——必须设置成oracle权限

 

3 、oracle客户端配置oracle_link, 切换到oracle用户做oracle_link(需先设置对应数据库的SID)

# /usr/openv/netbackup/bin/oracle_link

 

4、执行恢复

4.1 启动数据库到nomount状态,设置原机的DBID

[oracle@NBU82Restore ~]$ rman target /

RMAN> set DBID=1979817751

RMAN> startup nomount;

 

4.2 恢复spfile:

RMAN>  restore spfile to '/nfspool/spfiletmp.ora' from '/nfspool/spfile_D-TEST_I-1979817751_T-20201221_cfvijqbi_testdb02';

Starting restore at 21-DEC-20

using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /nfspool/spfile_D-TEST_I-1979817751_T-20201221_cfvijqbi_testdb02

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 21-DEC-20

RMAN>  exit

 

4.3 退出RMAN,进入SQL创建pfile

SQL> create pfile='/nfspool/pfile.ora' from spfile='/nfspool/spfiletmp.ora';

File created.

 

4.4 进入RMAN,恢复控制文件

RMAN> restore controlfile to '/nfspool/control01.ctl' from '/nfspool/cf_D-TEST_I-1979817751_T-20201221_cgvijqbj_testdb02';

注:需修改步骤3中pfile.ora 参数:

*.control_files='/nfspool/control01.ctl'

*.log_archive_dest_1='LOCATION=/nfspool'

 

4.5 从新创建的pfile启动到mount状态

[oracle@NBU82Restore ~]$ export ORACLE_SID=test

[oracle@NBU82Restore ~]$  sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 21 15:35:08 2020

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 Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> startup mount pfile='/nfspool/pfile.ora'

ORA-01081: cannot start already-running ORACLE - shut it down first

SQL> shutdown immediate

ORA-01507: database not mounted

 

ORACLE instance shut down.

SQL>  startup mount pfile='/nfspool/pfile.ora'

ORACLE instance started.

 

Total System Global Area 2.6724E+10 bytes

Fixed Size            2265864 bytes

Variable Size      3758099704 bytes

Database Buffers    2.2951E+10 bytes

Redo Buffers         12099584 bytes

Database mounted.

 

4.6  切换到RMAN下注册NFS共享池内的 datafile archivelog

[oracle@NBU82Restore ~]$ rman target / nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jun 5 16:29:31 2020

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

connected to target database: TESTDB (DBID= 1979817751, not open)

using target database control file instead of recovery catalog

rman> catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-10_h3v5jqgu_s-547_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-11_h4v5jqlf_s-548_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-12_h5v5jqlf_s-549_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-13_h6v5jqqk_s-550_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-14_h7v5jqql_s-551_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-15_h8v5jqvq_s-552_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-16_h9v5jqvq_s-553_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-17_hav5jr5t_s-554_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-18_hdv5jrbm_s-557_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-19_hbv5jr5t_s-555_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-20_hev5jrel_s-558_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-21_hcv5jrbm_s-556_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-22_hfv5jrhu_s-559_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-23_hgv5jrhu_s-560_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-25_3hv6g2vv_s-1137_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-26_3iv6g30e_s-1138_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-27_3jv6g359_s-1139_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-28_3kv6g359_s-1140_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-29_3lv6g3a4_s-1141_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-30_mkv7d34l_s-1748_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-31_mlv7d354_s-1749_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-32_mmv7d3a0_s-1750_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-33_mnv7d3a0_s-1751_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-34_mov7d3er_s-1752_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-35_i9va43im_s-3657_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-36_iava43jp_s-3658_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-37_ibva43nc_s-3659_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-38_revah9de_s-3950_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-39_rfvah9de_s-3951_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-40_rgvah9it_s-3952_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-41_rhvah9it_s-3953_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-42_6ivb13ln_s-4306_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-43_e0vbbl4q_s-4544_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-44_e1vbbl4q_s-4545_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-45_e2vbblb7_s-4546_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-46_navbrfcq_s-4842_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-47_nbvbrfcq_s-4843_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-48_dvvcr3te_s-5567_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-49_e0vcr3te_s-5568_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-50_e1vcr437_s-5569_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-51_p2vdau3s_s-5922_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-52_p3vdau4b_s-5923_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-53_sovdg6to_s-6040_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-5_guv5jq7i_s-542_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-6_gvv5jq7i_s-543_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-7_h0v5jqbp_s-544_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-8_h1v5jqbp_s-545_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-TEST_FNO-9_h2v5jqgu_s-546_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-SYSAUX_FNO-2_hiv5jrk9_s-562_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-SYSTEM_FNO-1_hhv5jrk9_s-561_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-UNDOTBS1_FNO-24_hkv5jrl3_s-564_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-UNDOTBS1_FNO-3_hjv5jrl2_s-563_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-UNDOTBS1_FNO-54_umvdirhi_s-6102_I-1979817751_testdb02';

catalog datafilecopy '/nfspool/data_D-TEST_I-1979817751_TS-USERS_FNO-4_hlv5jrli_s-565_I-1979817751_testdb02';

RMAN> switch datafile 1 to copy;

switch datafile 2 to copy;

switch datafile 3 to copy;

switch datafile 4 to copy;

switch datafile 5 to copy;

switch datafile 6 to copy;

switch datafile 7 to copy;

switch datafile 8 to copy;

switch datafile 9 to copy;

switch datafile 10 to copy;

switch datafile 11 to copy;

switch datafile 12 to copy;

switch datafile 13 to copy;

switch datafile 14 to copy;

switch datafile 15 to copy;

switch datafile 16 to copy;

switch datafile 17 to copy;

switch datafile 18 to copy;

switch datafile 19 to copy;

switch datafile 20 to copy;

switch datafile 21 to copy;

switch datafile 22 to copy;

switch datafile 23 to copy;

switch datafile 24 to copy;

switch datafile 25 to copy;

switch datafile 26 to copy;

switch datafile 27 to copy;

switch datafile 28 to copy;

switch datafile 29 to copy;

switch datafile 30 to copy;

switch datafile 31 to copy;

switch datafile 32 to copy;

switch datafile 33 to copy;

switch datafile 34 to copy;

switch datafile 35 to copy;

switch datafile 36 to copy;

switch datafile 37 to copy;

switch datafile 38 to copy;

switch datafile 39 to copy;

switch datafile 40 to copy;

switch datafile 41 to copy;

switch datafile 42 to copy;

switch datafile 43 to copy;

switch datafile 44 to copy;

switch datafile 45 to copy;

switch datafile 46 to copy;

switch datafile 47 to copy;

switch datafile 48 to copy;

switch datafile 49 to copy;

switch datafile 50 to copy;

switch datafile 51 to copy;

switch datafile 52 to copy;

switch datafile 53 to copy;

switch datafile 54 to copy;

#####  指定归档日志恢复  #####

RMAN>  catalog backuppiece '/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cdvijq9r_testdb02';

cataloged backup piece

backup piece handle=/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cdvijq9r_testdb02 RECID=10010 STAMP=1059753603

RMAN>  catalog backuppiece '/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cevijq9r_testdb02';

cataloged backup piece

backup piece handle=/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cevijq9r_testdb02 RECID=10011 STAMP=1059753604

 

4.7  恢复数据库

RMAN> recover database;   -- 只需要 recover ,因为上一步的 catalog datafilecopy” 已经默认 restore

Starting recover at 21-DEC-20

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=761 device type=DISK

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24810

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24811

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24812

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24813

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24814

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24815

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24816

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24817

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24818

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24819

channel ORA_DISK_1: reading from backup piece /nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cdvijq9r_testdb02

channel ORA_DISK_1: piece handle=/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cdvijq9r_testdb02 tag=TESTDB02

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:55

archived log file name=/nfspool/1_24810_1043835671.dbf thread=1 sequence=24810

archived log file name=/nfspool/1_24811_1043835671.dbf thread=1 sequence=24811

archived log file name=/nfspool/1_24812_1043835671.dbf thread=1 sequence=24812

archived log file name=/nfspool/1_24813_1043835671.dbf thread=1 sequence=24813

archived log file name=/nfspool/1_24814_1043835671.dbf thread=1 sequence=24814

archived log file name=/nfspool/1_24815_1043835671.dbf thread=1 sequence=24815

archived log file name=/nfspool/1_24816_1043835671.dbf thread=1 sequence=24816

archived log file name=/nfspool/1_24817_1043835671.dbf thread=1 sequence=24817

archived log file name=/nfspool/1_24818_1043835671.dbf thread=1 sequence=24818

archived log file name=/nfspool/1_24819_1043835671.dbf thread=1 sequence=24819

channel ORA_DISK_1: starting archived log restore to default destination

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24820

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24821

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24822

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24823

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24824

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24825

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24826

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24827

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24828

channel ORA_DISK_1: restoring archived log

archived log thread=1 sequence=24829

channel ORA_DISK_1: reading from backup piece /nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cevijq9r_testdb02

channel ORA_DISK_1: piece handle=/nfspool/arch_D-TEST_I-1979817751_SCN-529136809501_cevijq9r_testdb02 tag=TESTDB02

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:46

archived log file name=/nfspool/1_24820_1043835671.dbf thread=1 sequence=24820

archived log file name=/nfspool/1_24821_1043835671.dbf thread=1 sequence=24821

archived log file name=/nfspool/1_24822_1043835671.dbf thread=1 sequence=24822

archived log file name=/nfspool/1_24823_1043835671.dbf thread=1 sequence=24823

archived log file name=/nfspool/1_24824_1043835671.dbf thread=1 sequence=24824

archived log file name=/nfspool/1_24825_1043835671.dbf thread=1 sequence=24825

archived log file name=/nfspool/1_24826_1043835671.dbf thread=1 sequence=24826

archived log file name=/nfspool/1_24827_1043835671.dbf thread=1 sequence=24827

archived log file name=/nfspool/1_24828_1043835671.dbf thread=1 sequence=24828

archived log file name=/nfspool/1_24829_1043835671.dbf thread=1 sequence=24829

unable to find archived log

archived log thread=1 sequence=24830

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 12/21/2020 16:15:41

RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 24830 and starting SCN of 529136828568

注:最后 recover 的报错属于正常现象,已经默认把所有可以找到的归档应用了(相当于 until cancel

 

4.8 修改onlinelog路径为NFS共享池

在生产系统上执行以下语句获取系统redo日志:

select 'alter database rename file '''||member||''' to ''/nfspool/redo001.log'';' from v$logfile;

注:rename 后的log 名字要更改为不同的名字

 

alter database rename file '+DATA/test/onlinelog/group_1.257.1043835675' to '/nfspool/redo001.log';

alter database rename file '+DATA/test/onlinelog/group_2.258.1043835677' to '/nfspool/redo002.log';

alter database rename file '+DATA/test/onlinelog/group_3.259.1043835677' to '/nfspool/redo003.log';

alter database rename file '+DATA/test/onlinelog/group_4.260.1043835679' to '/nfspool/redo004.log';

alter database rename file '+DATA/test/onlinelog/group_5.261.1043835681' to '/nfspool/redo005.log';

alter database rename file '+DATA/test/onlinelog/group_6.262.1043835683' to '/nfspool/redo006.log';

alter database rename file '+DATA/test/onlinelog/group_7.263.1043835683' to '/nfspool/redo007.log';

alter database rename file '+DATA/test/onlinelog/group_8.264.1043835685' to '/nfspool/redo008.log';

alter database rename file '+DATA/test/onlinelog/group_101.284.1045059565' to '/nfspool/redo009.log';

alter database rename file '+DATA/test/onlinelog/group_102.285.1045059567' to '/nfspool/redo010.log';

alter database rename file '+DATA/test/onlinelog/group_103.286.1045059569' to '/nfspool/redo011.log';

alter database rename file '+DATA/test/onlinelog/group_104.287.1045059571' to '/nfspool/redo012.log';

alter database rename file '+DATA/test/onlinelog/group_105.288.1045059571' to '/nfspool/redo013.log';

alter database rename file '+DATA/test/onlinelog/group_106.289.1045059573' to '/nfspool/redo014.log';

alter database rename file '+DATA/test/onlinelog/group_107.290.1045059575' to '/nfspool/redo015.log';

alter database rename file '+DATA/test/onlinelog/group_108.291.1045059577' to '/nfspool/redo016.log';

alter database rename file '+DATA/test/onlinelog/group_109.292.1045059577' to '/nfspool/redo017.log';

 

另, 如果搭建过DG,可以删除standby log:

SQL> select group# from v$standby_log;

 

    GROUP#

----------

       101

       102

       103

       104

       105

       106

       107

       108

       109

 

9 rows selected.

 

SQL> select 'alter database drop standby logfile group '||group#||';' from v$standby_log;

 

'ALTERDATABASEDROPSTANDBYLOGFILEGROUP'||GROUP#||';'

--------------------------------------------------------------------------------

alter database drop standby logfile group 101;

alter database drop standby logfile group 102;

alter database drop standby logfile group 103;

alter database drop standby logfile group 104;

alter database drop standby logfile group 105;

alter database drop standby logfile group 106;

alter database drop standby logfile group 107;

alter database drop standby logfile group 108;

alter database drop standby logfile group 109;

 

9 rows selected.

 

4.9  打开数据库

SQL> alter database disable block change tracking;   -- 关闭块跟踪

Database altered.

SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE

----------------------------------------

READ WRITE

 

注:

SQL> alter database open resetlogs;   ——如果此步报错

alter database open resetlogs

*

ERROR at line 1:

ORA-00392: log 5 of thread 1 is being cleared, operation not allowed

ORA-00312: online log 5 thread 1: '/nfsbta/redo005.log'

ORA-00312: online log 5 thread 1: '/nfsbta/redo055.log'

执行: alter database clear logfile group 5;

 alter database open resetlogs;  ——再报错继续 clear

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/69992972/viewspace-2750221/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
小小DBA一枚

注册时间:2021-01-11

  • 博文量
    20
  • 访问量
    28113