溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

rac ORA-001157 數(shù)據(jù)文件誤創(chuàng) 本地盤(pán) 共享存儲(chǔ) ASM cannot identify/lock data file

發(fā)布時(shí)間:2020-07-10 22:42:42 來(lái)源:網(wǎng)絡(luò) 閱讀:743 作者:JUN_LJ 欄目:關(guān)系型數(shù)據(jù)庫(kù)

誤將數(shù)據(jù)文件創(chuàng)建在本地盤(pán)而不是共享存儲(chǔ)

錯(cuò)誤原因:

不是共享存儲(chǔ)中的數(shù)據(jù)文件,其他實(shí)例不能訪問(wèn)

解決思路和辦法:

把本地的數(shù)據(jù)文件移到共享存儲(chǔ)中。

步驟;

1. offline 表空間或數(shù)據(jù)文件

2. 復(fù)制數(shù)據(jù)文件

3. 重命名數(shù)據(jù)文件

4. 恢復(fù)數(shù)據(jù)文件(表空間不用)

5. online 表空間或數(shù)據(jù)文件

復(fù)制方案

1. RMAN copy datafile

2. dbms_file_transfer.copy_file

3. ASMCMD cp


詳細(xì)步驟:

一:

alter tablespace ts1 offline;

rman>copy datafile '本地目錄/源數(shù)據(jù)文件' to '共享目錄/目標(biāo)文件名';--目標(biāo)文件自己取名

alter database rename file '本地目錄/源數(shù)據(jù)文件' to '共享目錄/目標(biāo)文件名';

alter tablespace ts1 online;


二:

create directory source_dir as '本地目錄/';

create directory dest_dir as '共享目錄/';

alter tablespace ts1 offline;

begin

dbms_file_transfer.copy_file('SOURCE_DIR','源數(shù)據(jù)文件名','DEST_DIR','目標(biāo)文件名');

end;

--可以通過(guò)asmcmd命令行確認(rèn)是否正確copy成功

/*

  grid>asmcmd

  asmcmd>cd 共享目錄

  asmcmd>ls 目標(biāo)文件名

*/

alter database rename file '本地目錄/源數(shù)據(jù)文件名' to '共享目錄/目標(biāo)文件名';

alter tablespace ts1 online;


三:--操作數(shù)據(jù)文件,只能是表空間添加數(shù)據(jù)文件可行,創(chuàng)建表空間時(shí)出錯(cuò)(以下改成表空間)

alter database datafile '本地目錄/源數(shù)據(jù)文件' offline;

root>mv 源數(shù)據(jù)文件 /home/grid/

root>chown grid:asmadmin  源數(shù)據(jù)文件--/home/grid/目錄操作

grid>asmcmd

asmcmd>cd 共享目錄

asmcmd>cp /home/grid/源數(shù)據(jù)文件 目標(biāo)文件名

asmcmd>ls

alter database rename file '本地目錄/源數(shù)據(jù)文件' to '共享目錄/目標(biāo)文件名';  

alter database recover datafile '共享目錄/目標(biāo)文件名';

alter database datafile '共享目錄/目標(biāo)文件名' online;   


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI