利用rman copy的方法實現儲存上裸裝置資料檔案的遷移ITPUB
利用rman copy的方法實現儲存上裸裝置資料檔案的遷移ITPUB
背景:有時為了應用的需要,不得不把一些裸裝置資料檔案遷移到新的儲存上或者更快的儲存上來滿足應用的要求。
下面就是實驗來測試控制檔案,資料檔案,臨時資料檔案,redo檔案遷移到新的儲存方法
背景:有時為了應用的需要,不得不把一些裸裝置資料檔案遷移到新的儲存上或者更快的儲存上來滿足應用的要求。
下面就是實驗來測試控制檔案,資料檔案,臨時資料檔案,redo檔案遷移到新的儲存方法
[oracle@single ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 02:56:14 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
SQL> select name from v$controlfile;
NAMEITPUB
--------------------------------------------------------------------------------
/dev/raw/raw2
/dev/raw/raw3
--------------------------------------------------------------------------------
/dev/raw/raw2
/dev/raw/raw3
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/dev/raw/raw7
/dev/raw/raw11
/dev/raw/raw10
/dev/raw/raw9
--------------------------------------------------------------------------------
/dev/raw/raw7
/dev/raw/raw11
/dev/raw/raw10
/dev/raw/raw9
SQL> select name from v$tempfile;
NAME
-------------------------------------------------------------------------------
/dev/raw/raw8
-------------------------------------------------------------------------------
/dev/raw/raw8
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/dev/raw/raw4
/dev/raw/raw5
1.建好和原來裸裝置一樣大小的lv,建議比原來lv大一些 配製好許可權 屬性為oracle:dba
1.1原來儲存的控制檔案 新儲存的控制檔案
/dev/raw/raw2 /dev/raw/raw22
/dev/raw/raw3 /dev/raw/raw23
1.2原來儲存的資料檔案 新儲存的資料檔案
/dev/raw/raw7 /dev/raw/raw27
/dev/raw/raw11 /dev/raw/raw31
/dev/raw/raw10 /dev/raw/raw30
/dev/raw/raw9 /dev/raw/raw29
1.3原來儲存的日誌檔案 新儲存的日誌檔案
/dev/raw/raw4 /dev/raw/raw24
/dev/raw/raw5 /dev/raw/raw25
1.4原來儲存的臨時檔案 新儲存的臨時檔案
/dev/raw/raw8 /dev/raw/raw28
2. 遷移資料檔案到新的儲存上
--------------------------------------------------------------------------------
/dev/raw/raw4
/dev/raw/raw5
1.建好和原來裸裝置一樣大小的lv,建議比原來lv大一些 配製好許可權 屬性為oracle:dba
1.1原來儲存的控制檔案 新儲存的控制檔案
/dev/raw/raw2 /dev/raw/raw22
/dev/raw/raw3 /dev/raw/raw23
1.2原來儲存的資料檔案 新儲存的資料檔案
/dev/raw/raw7 /dev/raw/raw27
/dev/raw/raw11 /dev/raw/raw31
/dev/raw/raw10 /dev/raw/raw30
/dev/raw/raw9 /dev/raw/raw29
1.3原來儲存的日誌檔案 新儲存的日誌檔案
/dev/raw/raw4 /dev/raw/raw24
/dev/raw/raw5 /dev/raw/raw25
1.4原來儲存的臨時檔案 新儲存的臨時檔案
/dev/raw/raw8 /dev/raw/raw28
2. 遷移資料檔案到新的儲存上
2.1 啟動資料庫到mount狀態
SQL> startup mount
ORACLE instance started.
SQL> startup mount
ORACLE instance started.
Total System Global Area 192937984 bytes
Fixed Size 1260840 bytes
Variable Size 67109592 bytes
Database Buffers 121634816 bytes
Redo Buffers 2932736 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
Fixed Size 1260840 bytes
Variable Size 67109592 bytes
Database Buffers 121634816 bytes
Redo Buffers 2932736 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
2.2 用rman target /方式進入
[oracle@single ~]$ rman target /
[oracle@single ~]$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:24:27 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1213870770, not open)
RMAN> copy datafile '/dev/raw/raw7' to '/dev/raw/raw27';
Starting backup at 06-5月 -09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1I
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/dev/raw/raw7
output filename=/dev/raw/raw27 tag=TAG20090506T032607 recid=1 stamp=686114794
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
output filename=/dev/raw/raw27 tag=TAG20090506T032607 recid=1 stamp=686114794
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
Finished backup at 06-5月 -09
RMAN> copy datafile '/dev/raw/raw9' to '/dev/raw/raw29';
Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/dev/raw/raw9
output filename=/dev/raw/raw29 tag=TAG20090506T032716 recid=2 stamp=686114837
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02
Finished backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/dev/raw/raw9
output filename=/dev/raw/raw29 tag=TAG20090506T032716 recid=2 stamp=686114837
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02
Finished backup at 06-5月 -09
RMAN> copy datafile '/dev/raw/raw10' to '/dev/raw/raw30';
Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/dev/raw/raw10
output filename=/dev/raw/raw30 tag=TAG20090506T032746 recid=3 stamp=686114875
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
output filename=/dev/raw/raw30 tag=TAG20090506T032746 recid=3 stamp=686114875
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16
Finished backup at 06-5月 -09
RMAN> copy datafile '/dev/raw/raw11' to '/dev/raw/raw31';
Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/dev/raw/raw11
output filename=/dev/raw/raw31 tag=TAG20090506T032822 recid=4 stamp=686114915
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 06-5月 -09
output filename=/dev/raw/raw31 tag=TAG20090506T032822 recid=4 stamp=686114915
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 06-5月 -09
RMAN>2.3 進入sqlplus,更改檔名寫入到控制檔案中
[oracle@single ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:29:28 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter database rename file '/dev/raw/raw7' to '/dev/raw/raw27';
Database altered.
SQL> alter database rename file '/dev/raw/raw9' to '/dev/raw/raw29';
Database altered.
SQL> alter database rename file '/dev/raw/raw10' to '/dev/raw/raw30';
Database altered.
SQL> alter database rename file '/dev/raw/raw11' to '/dev/raw/raw31';
Database altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/dev/raw/raw27
/dev/raw/raw31
/dev/raw/raw30
/dev/raw/raw29
--------------------------------------------------------------------------------
/dev/raw/raw27
/dev/raw/raw31
/dev/raw/raw30
/dev/raw/raw29
SQL> alter database open;
Database altered.
SQL>
遷移資料檔案到新的儲存上成功
3.遷移控制檔案到新的儲存上
3.1.備份控制檔案
startup mount
RMAN> backup current controlfile format '/home/oracle/crontrol.bak';
startup mount
RMAN> backup current controlfile format '/home/oracle/crontrol.bak';
Starting backup at 06-5月 -09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 06-5月 -09
channel ORA_DISK_1: finished piece 1 at 06-5月 -09
piece handle=/home/oracle/crontrol.bak tag=TAG20090506T033405 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 06-5月 -09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 06-5月 -09
channel ORA_DISK_1: finished piece 1 at 06-5月 -09
piece handle=/home/oracle/crontrol.bak tag=TAG20090506T033405 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 06-5月 -09
3.2.關閉庫修改控制檔案引數檔案
sqlplus "/as sysdba"
shutdown immediate
create pfile from spfile;
[oracle@single dbs]$ vi initorcl.ora
sqlplus "/as sysdba"
shutdown immediate
create pfile from spfile;
[oracle@single dbs]$ vi initorcl.ora
###########################################
control_files=("/dev/raw/raw22", "/dev/raw/raw23")
指向新的引數檔案lv,並且儲存
control_files=("/dev/raw/raw22", "/dev/raw/raw23")
指向新的引數檔案lv,並且儲存
create spfile from pfile;
QL> startup nomount;
ORACLE instance started.
QL> startup nomount;
ORACLE instance started.
Total System Global Area 192937984 bytes
Fixed Size 1260840 bytes
Variable Size 67109592 bytes
Database Buffers 121634816 bytes
Redo Buffers 2932736 bytes
SQL> show parameter cont
Fixed Size 1260840 bytes
Variable Size 67109592 bytes
Database Buffers 121634816 bytes
Redo Buffers 2932736 bytes
SQL> show parameter cont
NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time integer
#A2I4_6K F07
control_files string
/dev/raw/raw22, /dev/raw/raw23
global_context_pool_size string
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time integer
#A2I4_6K F07
control_files string
/dev/raw/raw22, /dev/raw/raw23
global_context_pool_size string
3.3恢復控制檔案到新的儲存上,並且mount和用resetlogs方式開啟資料庫
[oracle@single dbs]$ rman target /
[oracle@single dbs]$ rman target /
Recovery Manager: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:38:47 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: orcl (not mounted)
RMAN> restore controlfile from '/home/oracle/crontrol.bak';
Starting restore at 06-5月 -09
using channel ORA_DISK_1
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/dev/raw/raw22
output filename=/dev/raw/raw23
Finished restore at 06-5月 -09
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/dev/raw/raw22
output filename=/dev/raw/raw23
Finished restore at 06-5月 -09
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
released channel: ORA_DISK_1
RMAN> alter database open resetlogs;
database opened
[oracle@single dbs]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:42:02 2009
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/dev/raw/raw22
/dev/raw/raw23
--------------------------------------------------------------------------------
/dev/raw/raw22
/dev/raw/raw23
可以看到控制檔案遷移到新的儲存上已經成功
4.遷移redo檔案到新的儲存上
SQL>alter database add logfile '/dev/raw/raw24' size 50m;
Database altered.
SQL>alter database add logfile '/dev/raw/raw25' size 50m;
Database altered
QL> alter database drop logfile group 1;
QL> alter database drop logfile group 1;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter database drop logfile group 2;
Database altered.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/dev/raw/raw24
/dev/raw/raw25
--------------------------------------------------------------------------------
/dev/raw/raw24
/dev/raw/raw25
SQL>
可以看到redo已經遷移到新的儲存上
5.遷移臨時資料檔案
SQL> create TEMPORARY TABLESPACE temp1 tempfile '/oradata/temp01.dbf' size 50m;
Tablespace created.
alter database default temporary tablespace TEMP1;
drop TABLESPACE TEMP;
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE
'/dev/raw/raw28' SIZE 500M AUTOEXTEND OFF
'/dev/raw/raw28' SIZE 500M AUTOEXTEND OFF
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M
BLOCKSIZE 8K;
BLOCKSIZE 8K;
SQL> alter database default temporary tablespace TEMP;
Database altered.
SQL> drop tablespace temp1;
Tablespace dropped.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/dev/raw/raw28
--------------------------------------------------------------------------------
/dev/raw/raw28
SQL>
可以看到臨時資料檔案已經遷移到新的儲存上
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9522838/viewspace-2152567/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- raw 裸裝置資料檔案更改其他raw裸裝置位置
- 利用pearcmd實現裸檔案包含
- 利用offline datafile檔案方式遷移資料
- geoserver資料儲存遷移Server
- 資料遷移的時候出現RMAN-03002,RMAN-06026
- 【伺服器儲存裝置資料恢復】EMC儲存裝置POOL上的資料卷被刪除的資料恢復案例伺服器資料恢復
- 使用SQL SERVER儲存過程實現歷史資料遷移SQLServer儲存過程
- 資料儲存--檔案儲存
- 用rman遷移資料庫資料庫
- Android中的資料儲存之檔案儲存Android
- 儲存、檔案管理/目錄、裝置管理
- 銀行業生產系統儲存資料遷移方法及實踐行業
- oracle RAC 更換儲存遷移資料Oracle
- 如何選擇移動儲存裝置
- 圖資料庫設計實踐 | 儲存服務的負載均衡和資料遷移資料庫負載
- 西部資料(WD)的 My Cloud EX2 儲存裝置預設配置洩露檔案資訊Cloud
- python儲存檔案的幾種方法Python
- Kubernetes 遷移節點 Kubelet 資料儲存目錄
- Elasticsearch 基於物件儲存使用快照資料遷移Elasticsearch物件
- 使用vplex的mirror功能對儲存層LUN進行資料的遷移
- 利用Kubernetes實現容器的持久化儲存持久化
- 有效儲存資料的方法
- 遷移資料庫的檔案到不同路徑(轉)資料庫
- SpringBoot整合阿里雲OSS物件儲存實現檔案上傳Spring Boot阿里物件
- Curve 檔案儲存在 Elasticsearch 冷熱資料儲存中的應用實踐Elasticsearch
- 伺服器資料遷移的方法-硬體不同如何遷移資料伺服器
- 大型系統儲存層遷移實踐
- 按檔案或扇區方式遷移資料到另一儲存,完成恢復工作
- 微信儲存的檔案在哪個資料夾
- AIX中的裸裝置AI
- 如何實現檔案傳輸系統的多儲存
- 乾貨 | 玩轉雲檔案儲存——利用CFS實現web應用的共享訪問Web
- 【Python3網路爬蟲開發實戰】5-資料儲存-1 檔案儲存-2 JSON檔案儲存Python爬蟲JSON
- 達夢資料庫資料檔案遷移過程資料庫
- 資料儲存(歸檔解檔,沙河儲存)
- 如何獲取HDFS上檔案的儲存位置
- MySQL儲存毫秒資料的方法MySql
- 線上資料遷移,數字化時代的必修課 —— 京東雲資料遷移實踐