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

Attack_on_Jager發表於2021-01-15

快速拉起是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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章