Move datafile:From File System to ASM
Move datafile:From File System to ASM
一、資料庫關閉(mount狀態).
適用於移動undo或system表空間檔案
1、關閉資料庫並啟動到mount狀態.
[oracle] sqlplus '/as sysdba'
SQL> shutdown immediate;
SQL> startup mount;
2、確保ASM有足夠的空間
SQL> col name for a80
SQL> select file#, name, bytes/1024/1024 Size_MB from v$datafile;
FILE# NAME SIZE_MB
---------- -------------------------------------------------------------------------------- ----------
1 +DGDATA/dg1/datafile/system.256.815366947 2048
2 +DGDATA/dg1/datafile/sysaux.257.815367079 1024
3 /tmp/oracle/backup/undo01.dbf 1024
4 /tmp/oracle/backup/users01.dbf 500
5 /home/oracle/test.dbf 500
這裡舉例移動undo表空間檔案
[grid@dg1:/home/grid]#asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 1568 1187 0 1187 0 N DGCRS/
MOUNTED EXTERN N 512 4096 1048576 8628 4989 0 4989 0 N DGDATA/
3、利用RMAN將資料檔案從asm磁碟拷貝到檔案系統
[oracle@dg1:/home/oracle]#rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Aug 20 03:26:58 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: DG (DBID=1728697911, not open)
RMAN> copy datafile 3 to '+DGDATA';
Starting backup at 20-AUG-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=29 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/tmp/oracle/backup/undo01.dbf
output file name=+DGDATA/dg1/datafile/undotbs1.260.823927355 tag=TAG20130820T044233 RECID=6 STAMP=823927487
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:21
Finished backup at 20-AUG-13
4、修改控制檔案中新檔案的路徑
[oracle] sqlplus '/as sysdba'
SQL> alter database rename file '/tmp/oracle/backup/undo01.dbf' to '+DGDATA/dg1/datafile/undotbs1.260.823927355';
Database altered.
5、檢視新檔案路徑
SQL> col name for a80
SQL> set line 180
SQL> select file#, name from v$datafile;
FILE# NAME
---------- --------------------------------------------------------------------------------
1 +DGDATA/dg1/datafile/system.256.815366947
2 +DGDATA/dg1/datafile/sysaux.257.815367079
3 +DGDATA/dg1/datafile/undotbs1.260.823927355
4 /tmp/oracle/backup/users01.dbf
5 /home/oracle/test.dbf
6、開啟資料庫
SQL> alter database open;
Database altered.
二、資料庫執行(只要將對應的表空間offline).
1、確定要移動的資料檔案,並offline
SQL> col tablespace_name for a40
SQL> col file_name for a80
SQL> select TABLESPACE_NAME,FILE_ID,FILE_NAME from dba_data_files;
TABLESPACE_NAME FILE_ID FILE_NAME
---------------------------------------- ---------- --------
SYSTEM 1 +DGDATA/dg1/datafile/system.256.815366947
SYSAUX 2 +DGDATA/dg1/datafile/sysaux.257.815367079
UNDOTBS1 3 +DGDATA/dg1/datafile/undotbs1.260.823927355
USERS 4 /tmp/oracle/backup/users01.dbf
TEST 5 /home/oracle/test.dbf
SQL> alter tablespace USERS offline;
Tablespace altered.
2、確保ASM有足夠的空間
SQL> col name for a80
SQL> select file#, name, bytes/1024/1024 Size_MB from v$datafile;
FILE# NAME SIZE_MB
---------- -------------------------------------------------------------------------------- ----------
1 +DGDATA/dg1/datafile/system.256.815366947 2048
2 +DGDATA/dg1/datafile/sysaux.257.815367079 1024
3 +DGDATA/dg1/datafile/undotbs1.258.815367141 1024
4 /tmp/oracle/backup/users01.dbf 500
5 /home/oracle/test.dbf 500
這裡舉例移動users表空間檔案
[grid@dg1:/home/grid]#asmcmd
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 1568 1187 0 1187 0 N DGCRS/
MOUNTED EXTERN N 512 4096 1048576 8628 4989 0 4989 0 N DGDATA/
3、利用RMAN將資料檔案從asm磁碟拷貝到檔案系統
[oracle@dg1:/home/oracle]#rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Tue Aug 20 03:26:58 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: DG (DBID=1728697911, not open)
RMAN> copy datafile 4 to '+DGDATA';
Starting backup at 20-AUG-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/tmp/oracle/backup/users01.dbf
output file name=+DGDATA/dg1/datafile/users.258.823927747 tag=TAG20130820T044907 RECID=7 STAMP=823927870
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:07
Finished backup at 20-AUG-13
4、修改控制檔案中新檔案的路徑
RMAN> switch datafile 4 to copy;
datafile 4 switched to datafile copy "+DGDATA/dg1/datafile/users.258.823927747"
或
[oracle] sqlplus '/as sysdba'
SQL> alter database rename file '/tmp/oracle/backup/users01.dbf' to '+DGDATA/dg1/datafile/users.258.823927747';
Database altered.
5、檢視新檔案路徑
SQL> select file#, name from v$datafile;
FILE# NAME
---------- --------------------------------------------------------------------------------
1 +DGDATA/dg1/datafile/system.256.815366947
2 +DGDATA/dg1/datafile/sysaux.257.815367079
3 +DGDATA/dg1/datafile/undotbs1.260.823927355
4 +DGDATA/dg1/datafile/users.258.823927747
5 /home/oracle/test.dbf
6、online表空間
SQL> alter tablespace USERS online;
Tablespace altered.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24996904/viewspace-768919/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Move datafile:From ASM to File SystemASM
- How to copy a datafile from ASM to a file system not using RMANASM
- FROM ASM Migrating to FILE SYSTEM Using RMAN(三)ASM
- How to move ASM database files from one diskgroup to anotherASMDatabase
- Oracle ACFS ( ASM Cluster File System )OracleASM
- Catalog archivelog from file system to Asmdg;HiveASM
- rman copy asm datafile(rename asm datafile)ASM
- ASM叢集檔案系統ACFS(ASM Cluster File System)ASM
- alter system dump datafile headerHeader
- 幾種ASM與File System資料檔案轉移方法ASM
- ASM資料和File System檔案轉移方法集錦ASM
- xtts from檔案系統到ASM儲存(dbms_file_transfer)TTSASM
- how to move a MediaWiki wiki from one server to anotherServer
- v$datafile.file#與v$tempfile.file#區別
- Google File System原理Go
- oracle asm diskgroup add datafile error problemOracleASMError
- Step-By-Step Guide To Create Physical Standby On Normal File System For ASM Primary using RMANGUIIDEORMASM
- Sqlserver移動檔案路徑move datafile的三種方法SQLServer
- move linux os from disk A to disk B with 0 lossLinux
- Oracle ASM File DirectoryOracleASM
- Resource is out of sync with the file system
- Raw Device vs File Systemdev
- How to release space from database( in other words: resize datafile ) (zt)Database
- How to release space from database( in other words: resize datafile ) 【zt】Database
- Export/import Datas To/from a Csv FileExportImport
- It is indirectly referenced from required .class fileUI
- ASM file metadata operationASM
- HP -Data Protector Restore file systemREST
- RMAN Duplicate Database From RAC ASM To RAC ASM [ID 461479.1]DatabaseASM
- Duplicate database from non ASM to ASM to a different host [ID 382669.1]DatabaseASM
- Duplicate Database from ASM to Non- ASM Database Using RMANDatabaseASM
- ORA-27054: NFS file system where the file is created or resides is ......NFSIDE
- How to move ASM spfile to a different disk group [ID 1082943.1]ASM
- ASM 翻譯系列第八彈:ASM Internal ASM file extent mapASM
- oracle檔案遷移之datafile,relog file,tempfileOracle
- alter database drop datafile 與 drop tablespace file 的區別Database
- Oracle ASM Cluster File Systems (ACOracleASM
- 《The Google File System》論文研讀Go