在ASM Diskgroup間移動資料檔案
首先在虛擬機器中加入兩個虛擬磁碟再建立額外的Diskgroup,然後模擬將一資料檔案從一個ASM Diskgroup移動到另一個ASM Diskgroup上。
過程如下:
加入兩個虛擬磁碟,各512M。
[root@Ora10gASM ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1044 8281507+ 8e Linux LVM
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 522 4192933+ 83 Linux
Disk /dev/sdc: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 522 4192933+ 83 Linux
Disk /dev/sdd: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk /dev/sde doesn't contain a valid partition table
建立磁碟分割槽
[root@Ora10gASM ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Using default value 512
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@Ora10gASM ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): q
Partition number (1-4): 1
First cylinder (1-512, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512): 512
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
建立ASM磁碟
[root@Ora10gASM ~]# /etc/init.d/oracleasm scandisk
Usage:
/etc/init.d/oracleasm
{start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@Ora10gASM ~]# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
[root@Ora10gASM ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
[root@Ora10gASM ~]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [ OK ]
[root@Ora10gASM ~]# /etc/init.d/oracleasm createdisk VOL4 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
[root@Ora10gASM ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
建立額外的磁碟組DATA2
Ora10gASM-> export ORACLE_SID=+ASM
Ora10gASM-> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 28 19:30:15
Copyright (c) 1982, , . All rights reserved.
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> col name format a15
SQL> col failgroup format a20
SQL> col path format a30
SQL> select name,failgroup,path from v$asm_disk;
NAME FAILGROUP PATH
--------------- -------------------- ------------------------------
ORCL:VOL3
ORCL:VOL4
VOL1 VOL1 ORCL:VOL1
VOL2 VOL2 ORCL:VOL2
SQL> select name from v$asm_diskgroup;
NAME
---------------
FRA
SQL> create diskgroup DATA2 external redundancy disk 'ORCL:VOL3';
Diskgroup created.
SQL> select name,failgroup,path from v$asm_disk;
NAME FAILGROUP PATH
--------------- -------------------- ------------------------------
ORCL:VOL4
VOL1 VOL1 ORCL:VOL1
VOL2 VOL2 ORCL:VOL2
VOL3 VOL3 ORCL:VOL3
SQL> exit
Disconnected from Oracle Database Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
建立額外的資料檔案在DATA上,將被移動DATA2上
Ora10gASM-> export ORACLE_SID=benbo
Ora10gASM-> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 28 19:44:46 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/benbo/datafile/system.268.655859413
+DATA/benbo/datafile/undotbs1.270.655859475
+DATA/benbo/datafile/sysaux.269.655859449
+DATA/benbo/datafile/users.271.655859485
SQL> create tablespace benbo datafile '+DATA' size 100m autoextend off;
Tablespace created.
SQL> create table t1 tablespace benbo as select * from dba_extents;
Table created.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/benbo/datafile/system.268.655859413
+DATA/benbo/datafile/undotbs1.270.655859475
+DATA/benbo/datafile/sysaux.269.655859449
+DATA/benbo/datafile/users.271.655859485
+DATA/benbo/datafile/benbo.281.655933629
SQL> alter database datafile '+DATA/benbo/datafile/benbo.281.655933629' offline;
Database altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Ora10gASM-> rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 28 19:49:14 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: BENBO (DBID=2376804766)
RMAN> copy datafile '+DATA/benbo/datafile/benbo.281.655933629' to '+DATA2';
Starting backup at 28-MAY-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=158 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATA/benbo/datafile/benbo.281.655933629
output filename=+DATA2/benbo/datafile/benbo.256.655933781 tag=TAG20080528T194940 recid=12 stamp=655933788
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 28-MAY-08
RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 480 SYSTEM *** +DATA/benbo/datafile/system.268.655859413
2 25 UNDOTBS1 *** +DATA/benbo/datafile/undotbs1.270.655859475
3 240 SYSAUX *** +DATA/benbo/datafile/sysaux.269.655859449
4 5 USERS *** +DATA/benbo/datafile/users.271.655859485
5 100 BENBO *** +DATA/benbo/datafile/benbo.281.655933629
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
2 100 TEMP 100 +DATA/benbo/tempfile/temp.274.655859687
RMAN> switch datafile 5 to copy;
datafile 5 switched to datafile copy "+DATA2/benbo/datafile/benbo.256.655933781"
RMAN> "alter database datafile 5 online";
sql statement: alter database datafile 5 online
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 05/28/2008 19:52:16
RMAN-11003: failure during parse/execution of SQL statement: alter database datafile 5 online
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '+DATA2/benbo/datafile/benbo.256.655933781'
RMAN> recover datafile 5;
Starting recover at 28-MAY-08
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 28-MAY-08
RMAN> sql "alter database datafile 5 online";
sql statement: alter database datafile 5 online
RMAN> report schema;
Report of database schema
List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 480 SYSTEM *** +DATA/benbo/datafile/system.268.655859413
2 25 UNDOTBS1 *** +DATA/benbo/datafile/undotbs1.270.655859475
3 240 SYSAUX *** +DATA/benbo/datafile/sysaux.269.655859449
4 5 USERS *** +DATA/benbo/datafile/users.271.655859485
5 100 BENBO *** +DATA2/benbo/datafile/benbo.256.655933781
List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
2 100 TEMP 100 +DATA/benbo/tempfile/temp.274.655859687
RMAN> exit
Recovery Manager complete.
Ora10gASM-> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 28 19:53:16 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select file_id,status from dba_data_files;
FILE_ID STATUS
---------- ---------
5 AVAILABLE
4 AVAILABLE
3 AVAILABLE
2 AVAILABLE
1 AVAILABLE
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA/benbo/datafile/system.268.655859413
+DATA/benbo/datafile/undotbs1.270.655859475
+DATA/benbo/datafile/sysaux.269.655859449
+DATA/benbo/datafile/users.271.655859485
+DATA2/benbo/datafile/benbo.256.655933781
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
刪除舊的DATA上的資料檔案BENBO.281.655933629
Ora10gASM-> asmcmd
ASMCMD> ls DATA/BENBO/DATAFILE
BENBO.281.655933629
SYSAUX.269.655859449
SYSTEM.268.655859413
UNDOTBS1.270.655859475
USERS.266.655858163
USERS.271.655859485ASMCMD> exit
Ora10gASM-> sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 28 19:55:03 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter diskgroup DATA drop file '+DATA/benbo/datafile/BENBO.281.655933629';
Diskgroup altered.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-692426/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用rman在oracle ASM磁碟組之間移動資料檔案OracleASM
- 在ASM磁碟組之間移動檔案ASM
- 移動資料檔案從ASM到檔案系統ASM
- 利用RMAN在檔案系統與ASM之間遷移資料庫ASM資料庫
- PostgreSQL在不同的表空間移動資料檔案SQL
- 在Oracle中移動資料檔案Oracle
- 在ORACLE移動資料庫檔案Oracle資料庫
- 資料檔案,表空間的移動
- 移動資料檔案從檔案系統到ASM磁碟組中ASM
- 遷移資料庫檔案到ASM資料庫ASM
- 【ASM】ASM資料檔案和OS檔案(FILESYSTEM)轉移方法總結ASM
- 在ORACLE中移動資料庫檔案Oracle資料庫
- 在ORACLE中移動資料庫檔案在(轉)Oracle資料庫
- 如何遷移ASM資料檔案到檔案系統ASM
- 【資料遷移】RMAN遷移資料庫到ASM(二)切換資料檔案到ASM資料庫ASM
- ASM與檔案系統之間copy資料檔案--檔案系統到ASMASM
- 移動資料檔案、系統表空間檔案、臨時表空間檔案
- 在ORACLE中移動資料庫檔案(轉)Oracle資料庫
- 在Oracle中移動資料檔案、控制檔案和日誌檔案Oracle
- 表空間online移動資料檔案
- 使用RMAN在ASM和檔案系統之間複製資料ASM
- 使用RMAN在ASM和檔案系統之間拷貝資料ASM
- 利用RMAN將非ASM檔案移動到ASM裡 - [ASM]ASM
- SQLServer移動資料檔案SQLServer
- 線上移動資料檔案
- ORACLE移動資料檔案Oracle
- 磁碟空間不足,線上移動Oracle的資料檔案Oracle
- 在資料庫之間移動表空間資料庫
- 線上遷移表空間資料檔案
- Oracle 表空間資料檔案遷移Oracle
- oracle資料庫移動資料檔案、日誌檔案和控制檔案Oracle資料庫
- 幾種ASM與File System資料檔案轉移方法ASM
- 使用RMAN遷移檔案系統資料庫到ASM資料庫ASM
- ASM資料和File System檔案轉移方法集錦ASM
- 將asm上datafile移動到其他的diskgroup或者普通filesystem上ASM
- 建立表空間、使用者、擴容、移動資料檔案
- 如何移動asm磁碟組內的資料檔案到另外一個磁碟組ASM
- Oracle 資料檔案移動步驟Oracle