您好,登錄后才能下訂單哦!
本篇內容介紹了“rman換磁盤遷移的方法是什么”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
I先遷移數據文件
1 準備
新插一塊盤,并且格式化 ,mount上
/dev/sdc/
mkfs.ext4 /dev/sdc/
mkdir /home/oracle/cs
mount /dev/sdc /home/oracle/cs
vi /etc/fstab --永久掛載
df -h
2 copy數據文件移動到新設備cs上
i)先查看當前庫數據文件位置
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/ooradata/test1/system01.dbf
/ooradata/test1/sysaux01.dbf
/ooradata/test1/undotbs01.dbf
/ooradata/test1/users01.dbf
ii)復制到新的路徑 copy ... to
rman target/
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
copy datafile'/ooradata/test1/system01.dbf'to'/home/oracle/cs/system01.dbf';
copy datafile'/ooradata/test1/sysaux01.dbf'to'/home/oracle/cs/sysaux01.dbf';
copy datafile'/ooradata/test1/undotbs01.dbf'to'/home/oracle/cs/undotbs01.dbf';
copy datafile'/ooradata/test1/users01.dbf'to'/home/oracle/cs/users01.dbf';
}
注:復制前,可以先切歸 alter system archive log current;
iii)驗證
[oracle@jcy1 oradata]$ cd /home/oracle/cs
[oracle@jcy1 cs]$ ll
total 1295400
-rw-r----- 1 oracle dba 513810432 Feb 2 07:50 sysaux01.dbf
-rw-r----- 1 oracle dba 775954432 Feb 2 07:50 system01.dbf
-rw-r----- 1 oracle dba 31465472 Feb 2 07:50 undotbs01.dbf
-rw-r----- 1 oracle dba 5251072 Feb 2 07:50 users01.dbf
II 遷移控制文件
1 先查看控制文件位置
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/ooradata/test1/control01.ctl
/u01/app/oracle/fast_recovery_area/test1/control02.ctl
2 copy到新位置
RMAN> copy current controlfile to '/home/oracle/cs/control01.ctl';
注:這里不需要制定原位置,02.ctl我們就不做改動。控制文件為了安全,一般要分別放在3個不同的磁盤上,咱們這里僅為做實驗
i)驗證
[oracle@jcy1 oradata]$ cd /home/oracle/cs
[oracle@jcy1 cs]$ ls -l control01.ctl
-rw-r----- 1 oracle dba 9748480 Feb 2 08:08 control01.ctl
ii)因為控制文件移動了位置,需要在參數文件里修改控制文件位置
SQL> create pfile='/home/oracle/cs/a.txt' from spfile;
File created.
SQL> !vi /home/oracle/cs/a.txt
修改值control_files
*.control_files='/home/oracle/cs/control01.ctl','/u01/app/oracle/fast_recovery_area/test1/control02.ctl'
關庫
SQL> shutdown immediate
創建spfile
SQL> create spfile from pfile='/home/oracle/cs/a.txt';
File created.
啟動
SQL> startup nomount;
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file
'/u01/app/oracle/fast_recovery_area/test1/control02.ctl' version 724
inconsistent with file '/home/oracle/cs/control01.ctl' version 717
解決方法:把第二個控制文件刪除,后期咱們再添加
SQL> create pfile ='/home/oracle/cs/b.txt' from spfile; --新的b.txt文件
File created.
SQL> !vi /home/oracle/cs/b.txt
修改值control_files
*.control_files='/home/oracle/cs/control01.ctl'
關庫
SQL> shutdown immediate
創建psfile
SQL> create spfile from pfile='/home/oracle/cs/b.txt';
SQL> startup nomount;
SQL> alter database mount;
正常
iii)查看啟動的是哪個控制文件
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/home/oracle/cs/control01.ctl
注:如果還是沒有改過來,需要制定一下,我這里是沒有遇到哈,
RMAN>switch database to copy;
3 恢復數據文件
RMAN> recover database;
III 遷移日志文件
1 查看日志文件位置
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/ooradata/test1/redo03.log
/ooradata/test1/redo02.log
/ooradata/test1/redo01.log
2 copy到新位置
SQL> alter database rename file '/ooradata/test1/redo03.log' to '/home/oracle/cs/redo03.log';
Database altered.
SQL> alter database rename file '/ooradata/test1/redo02.log' to '/home/oracle/cs/redo02.log';
Database altered.
SQL> alter database rename file '/ooradata/test1/redo01.log' to '/home/oracle/cs/redo01.log';
Database altered.
驗證一下
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/home/oracle/cs/redo03.log
/home/oracle/cs/redo02.log
/home/oracle/cs/redo01.log
3 這時候就可以open數據庫了,一定一定要遷移完數據、控制、日志文件后再open
SQL> alter database open RESETLOGS;
Database altered.
IIII 遷移臨時文件
1 查看臨時文件位置
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/ooradata/test1/temp01.dbf
2 更改臨時文件位置
i)思路:先添加一個臨時文件,再把之前的刪除
SQL> alter tablespace temp add tempfile '/home/oracle/cs/temp01.dbf' size 100m;
Tablespace altered.
ii)刪除
SQL> alter database tempfile '/ooradata/test1/temp01.dbf' drop;
alter database tempfile '/ooradata/test1/temp01.dbf' drop
*
ERROR at line 1:
ORA-25152: TEMPFILE cannot be dropped at this time
--正在使用,可以重啟后在刪除
SQL> shutdown immediate
SQL>startup
SQL> alter database tempfile '/ooradata/test1/temp01.dbf' drop;
Database altered.
iii)驗證
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/home/oracle/cs/temp01.dbf
“rman換磁盤遷移的方法是什么”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。