您好,登錄后才能下訂單哦!
誤將數(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;
免責(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)容。