系統環境:
CentOS release 6.7 (Final)
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
操作過程:
1、添加資料檔案或者建立表空間時,誤操作将路徑指定為單節點本地
SQL> alter tablespace users add datafile '/home/oracle/test.dbf' size 4m;
Tablespace altered.
SQL>
set line 180
col file_name for a60
col tablespace_name for a15
select file_name,file_id,online_status,tablespace_name from dba_data_files;
FILE_NAME FILE_ID ONLINE_ TABLESPACE_NAME
------------------------------------------------------------ ---------- ------- ---------------
+DATA/devdb/datafile/users.259.936769201 4 ONLINE USERS
+DATA/devdb/datafile/undotbs1.258.936769201 3 ONLINE UNDOTBS1
+DATA/devdb/datafile/sysaux.257.936769199 2 ONLINE SYSAUX
+DATA/devdb/datafile/system.256.936769199 1 SYSTEM SYSTEM
+DATA/devdb/datafile/example.265.936769441 5 ONLINE EXAMPLE
/home/oracle/test.dbf 6 ONLINE USERS
6 rows selected.
2.幹淨關閉RAC2,RAC1
srvctl stop database -d XXX
3.将RAC1啟動mount狀态
SQL> startup mount;
4.通過RMAN CP指令拷貝資料檔案
node1-> rman target /
connected to target database: DEVDB (DBID=841499351, not open)
RMAN> copy datafile '/home/oracle/test.dbf' to '+data';
Starting backup at 2017/09/17 02:13:03
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=36 instance=devdb1 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/home/oracle/test.dbf
output file name=+DATA/devdb/datafile/users.273.954900787 tag=TAG20170917T021305 RECID=3 STAMP=954900786
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017/09/17 02:13:07
Starting Control File and SPFILE Autobackup at 2017/09/17 02:13:07
piece handle=+FLASH/devdb/autobackup/2017_09_17/s_954900552.304.954900789 comment=NONE
Finished Control File and SPFILE Autobackup at 2017/09/17 02:13:10
5.在 ASM 中查找 /home/oracle/test.dbf 映射過來對應的 ASM 檔案名
ASMCMD> cd data/devdb/datafile
ASMCMD> pwd
+data/devdb/datafile
ASMCMD> ls -lt user*
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE SEP 17 03:00:00 Y USERS.273.954900787
DATAFILE UNPROT COARSE SEP 17 03:00:00 Y USERS.259.936769201
說明: /home/oracle/test.dbf 對應為 USERS 表空間, 是以這裡為 user*
6.在sqlplus中将資料庫啟動到mount狀态,rename資料檔案
SQL> alter database rename file '/home/oracle/test.dbf' to '+DATA/devdb/datafile/USERS.273.954900787';
7.将rac1,rac2啟動
#RAC1
SQL> alter database open;
Database altered.
SQL>
#RAC2
SQL> startup;
附:SYSTEM資料檔案移植步驟(過程說明):
1. Stop DB.
2. Move the datafile using asmcmd.
3. Mount the DB.
4. Rename the datafile.
5. Open the DB.
6. On other RAC nodes you still need to bounce the database because it is SYSTEM tablespace, otherwise you will keep getting errors ORA-01516 or original error ORA-01157: cannot identify/lock data file.
本文轉自 張沖andy 部落格園部落格,原文連結: http://www.cnblogs.com/andy6/p/7532458.html,如需轉載請自行聯系原作者