使用RMAN將檔案系統遷移到ASM

來源:互聯網
上載者:User

使用RMAN將檔案系統遷移到ASM

1,全備資料庫PROD

run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup tag 'SH_DB' as compressed backupset format ‘/home/Oracle/full_%U.bak' database
include current controlfile;
backup tag 'SH_ARCH' archivelog al format ‘/home/oracle/arch_%U.bak’l;
release channel c1;
release channel c2;
}

2,確認控制檔案的備份片
RMAN> list backup of control file;

/home/oracle/full_03pkgtf4_1_1.bak

3,匯出pfile,將控制檔案修改為+DATA和+FRA

SYS@PROD >create pfile='/home/oracle/prodpfile' from spfile;

[oracle@single ~]$ vi /home/oracle/prodpfile

*.audit_file_dest='/u01/admin/PROD/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
##*.control_files='/u01/oradata/PROD/control01.ctl','/u01/fast_recovery_area/PROD/control02.ctl'
*.control_files='+DATA/PROD/controlfile/control01.ctl','+FRA/PROD/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='PROD'
##*.db_recovery_file_dest='/u01/fast_recovery_area'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRODXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=583008256
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'

4,刪除PROD
SYS@PROD >startup force mount restrict;

SYS@PROD >drop database;

5,建立災備端所需目錄(DBCA刪除資料庫需要此步驟)
mkdir -p $ORACLE_BASE/admin/PROD/adump

6,建立資料庫密碼檔案 (DBCA刪除資料庫需要此步驟)
orapwd file=$ORACLE_HOME/dbs/orapwPROD password=oracle entries=5 force=y

7,採用修改過的pfile啟動到nomount
$ sqlplus / as sysdba

SYS@PROD >startup nomount pfile=/home/oracle/pfile;

8,將spfile檔案建立到+DATA目錄下,利用Oracle11g新特性from memory

SYS@PROD >create spfile='+DATA/PROD/spfilePROD.ora' from memory;

9,建立一個pfile來指向spfile。將紅色字型內容填寫在vi建立的pfile檔案中。 在Oracle11g中安裝過叢集軟體都需要這樣配置,無論是單一實例ASM還是RAC+ASM

SYS@PROD >!vi $ORACLE_HOME/dbs/initPROD.ora

SPFILE='+DATA/PROD/spfilePROD.ora’

10,恢複控制檔案到+DATA

RMAN> startup force nomount;

RMAN> restore controlfile from '/home/oracle/full_03pkgtf4_1_1.bak';

11,啟動到mount

RMAN> mount database;

12,識別備份組
RMAN> catalog start with '/home/oracle/';

13,恢複資料庫,注意關鍵詞set newname 和 switch datafile all是遷移檔案系統到ASM的關鍵。

run{
set newname for datafile 1 to '+DATA';
set newname for datafile 2 to '+DATA';
set newname for datafile 3 to '+DATA';
set newname for datafile 4 to '+DATA';
set newname for tempfile 1 to '+DATA';
restore database;
switch datafile all;
recover database;
}

14,更改聯機日誌路徑為+DATA

SYS@PROD >alter database rename file '/u01/oradata/PROD/redo01.log' to '+DATA';
SYS@PROD >alter database rename file '/u01/oradata/PROD/redo02.log' to '+DATA';
SYS@PROD >alter database rename file '/u01/oradata/PROD/redo03.log' to '+DATA';

15,open resetlogs開庫
SYS@PROD >alter database open resetlogs;

16, 如果在set newname tempfile步驟不能成功的遷移tempfile使用下面的命令手工追加
SYS@PROD >alter tablespace temp add tempfile '+DATA' size 10m;
SYS@PROD >alter tablespace temp drop tempfile '/u01/oradata/PROD/temp01.dbf’;

實驗結束

--------------------------------------推薦閱讀 --------------------------------------

RMAN 配置歸檔日誌刪除策略

Oracle基礎教程之通過RMAN複製資料庫

RMAN備份策略制定參考內容

RMAN備份學習筆記

OracleDatabase Backup加密 RMAN加密

--------------------------------------分割線 --------------------------------------

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.