含有特殊字元的資料檔案處理

super_sky發表於2014-02-12

檢查資料檔案,以24號資料檔案存在特殊字元為例。
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- ------------------------------------------------------------
        23 /ora10g/oradata/ssc620.data11
        24 /ora10g/oradata/sscusr.data1
        25 /ora10g/oradata/ssc.data10
        26 /ora10g/oradata/ssc620.data12
        27 /ora10g/oradata/ssc.data11
        28 /ora10g/oradata/jtitsm.data1
        29 /ora10g/oradata/ssc.data12
        30 /ora10g/oradata/ssc.data13
        31 /ora10g/oradata/rmants01.dbf

31 rows selected.

SQL>

關閉資料庫
RMAN> shutdown immediate;

using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

將資料庫啟動到mount狀態
RMAN> startup mount;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area   10737418240 bytes

Fixed Size                     2098896 bytes
Variable Size               1560283440 bytes
Database Buffers            9160359936 bytes
Redo Buffers                  14675968 bytes

使用rman copy命令,將有問題的資料檔案重新命名。
RMAN> copy datafile 24 to '/ora10g/oradata/new_data/sscusr.data1_1';

Starting backup at 11-MAY-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=386 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00024 name=/ora10g/oradata/sscusr.data1
output filename=/ora10g/oradata/new_data/sscusr.data1_1 tag=TAG20130511T132942 recid=65 stamp=815146183
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 11-MAY-13

修改控制檔案中對應的檔案內容。
RMAN> run{
2> set newname for datafile 24 to '/ora10g/oradata/new_data/sscusr.data1_1';
3> switch datafile 24;
4> }

executing command: SET NEWNAME

datafile 24 switched to datafile copy
input datafile copy recid=65 stamp=815146183 filename=/ora10g/oradata/new_data/sscusr.data1_1

開啟資料庫。
RMAN> alter database open;

database opened

RMAN>

檢查24號檔案
SQL> select file#,name from v$datafile;
     FILE# NAME
---------- ------------------------------------------------------------
        23 /ora10g/oradata/ssc620.data11
        24 /ora10g/oradata/new_data/sscusr.data1_1
        25 /ora10g/oradata/ssc.data10
        26 /ora10g/oradata/ssc620.data12
        27 /ora10g/oradata/ssc.data11
        28 /ora10g/oradata/jtitsm.data1
        29 /ora10g/oradata/ssc.data12
        30 /ora10g/oradata/ssc.data13
        31 /ora10g/oradata/rmants01.dbf

31 rows selected.

SQL>
這時,24號檔案對應的檔案已經修改為新的檔案了。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11590946/viewspace-1079880/,如需轉載,請註明出處,否則將追究法律責任。

相關文章