利用RMAN將資料庫從檔案系統遷移到ASM(單例項)
一、開啟ASM例項
[oracle@ASM ~]$ echo $ORACLE_SID
+ASM
[oracle@ASM ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 6 01:01:28 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> select name,state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DATA MOUNTED
DGROUP1 MOUNTED
二、修改目標資料庫(TOASM)的SPFILE
SQL> ALTER SYSTEM SET CONTROL_FILES='+DGROUP1' SCOPE=SPFILE;
System altered.
SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST='+DGROUP1' SCOPE=SPFILE;
System altered.
三、關閉目標資料庫
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
四、透過RMAN連線到目標資料庫,並啟動到NOMOUNT狀態
[oracle@ASM admin]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Apr 6 01:06:39 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 230686720 bytes
Fixed Size 1218676 bytes
Variable Size 75499404 bytes
Database Buffers 150994944 bytes
Redo Buffers 2973696 bytes
RMAN>
五、還原控制檔案到ASM磁碟組,並將資料庫啟動到MOUNT狀態
RMAN> RESTORE CONTROLFILE FROM '/u01/oradata/TOASM/control01.ctl';
Starting restore at 06-APR-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DGROUP1/toasm/controlfile/backup.269.683428107
Finished restore at 06-APR-09
RMAN> ALTER DATABASE MOUNT;
database mounted
released channel: ORA_DISK_1
RMAN>
六、利用RMAN複製資料檔案到ASM磁碟組
RMAN > BACKUP AS COPY DATABASE FORMAT '+DGROUP1';
Starting backup at 06-APR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/u01/oradata/TOASM/system01.dbf
output filename=+DGROUP1/toasm/datafile/system.258.683428337 tag=TAG20090406T011215 recid=2 stamp=683428412
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/oradata/TOASM/sysaux01.dbf
output filename=+DGROUP1/toasm/datafile/sysaux.259.683428421 tag=TAG20090406T011215 recid=3 stamp=683428457
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/u01/oradata/TOASM/example01.dbf
output filename=+DGROUP1/toasm/datafile/example.261.683428467 tag=TAG20090406T011215 recid=4 stamp=683428481
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/u01/oradata/TOASM/undotbs01.dbf
output filename=+DGROUP1/toasm/datafile/undotbs1.260.683428483 tag=TAG20090406T011215 recid=5 stamp=683428486
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/u01/oradata/TOASM/users01.dbf
output filename=+DGROUP1/toasm/datafile/users.262.683428489 tag=TAG20090406T011215 recid=6 stamp=683428491
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DGROUP1/toasm/controlfile/backup.278.683428493 tag=TAG20090406T011215 recid=7 stamp=683428495
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 06-APR-09
channel ORA_DISK_1: finished piece 1 at 06-APR-09
piece handle=+DGROUP1/toasm/backupset/2009_04_06/nnsnf0_tag20090406t011215_0.277.683428497 tag=TAG20090406T011215 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 06-APR-09
RMAN>
七、利用RMAN的SWITCH 命令修改控制檔案內資料檔案的指標,使其指向新位置。
RMAN> SWITCH DATABASE TO COPY;
datafile 1 switched to datafile copy "+DGROUP1/toasm/datafile/system.258.683428337"
datafile 2 switched to datafile copy "+DGROUP1/toasm/datafile/undotbs1.260.683428483"
datafile 3 switched to datafile copy "+DGROUP1/toasm/datafile/sysaux.259.683428421"
datafile 4 switched to datafile copy "+DGROUP1/toasm/datafile/users.262.683428489"
datafile 5 switched to datafile copy "+DGROUP1/toasm/datafile/example.261.683428467"
RMAN> RECOVER DATABASE;
Starting recover at 06-APR-09
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 06-APR-09
RMAN>
八、開啟資料庫
RMAN> ALTER DATABASE OPEN;
database opened
RMAN>
九、遷移臨時檔案
由於臨時檔案不會被遷移,所以我們只需要刪除原來的增加新的就可以。
SQL> SELECT NAME FROM V$TEMPFILE;
NAME
--------------------------------------------------
/u01/oradata/TOASM/temp01.dbf
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DGROUP1';
Tablespace altered.
SQL> ALTER TABLESPACE TEMP DROP TEMPFILE '/u01/oradata/TOASM/temp01.dbf';
Tablespace altered.
SQL> SELECT NAME FROM V$TEMPFILE;
NAME
--------------------------------------------------
+DGROUP1/toasm/tempfile/temp.263.683428909
SQL>
十、增加新的ONLINE REDOLOGS 到ASM
SQL> SELECT * FROM V$LOG;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 5 10485760 1 YES INACTIVE 473286 06-APR-09
2 1 6 10485760 1 NO CURRENT 474627 06-APR-09
3 1 4 10485760 1 YES INACTIVE 472097 06-APR-09
SQL> ALTER DATABASE ADD LOGFILE '+DGROUP1' SIZE 10M;
Database altered.
SQL> ALTER DATABASE ADD LOGFILE '+DGROUP1' SIZE 10M;
Database altered.
SQL> ALTER DATABASE ADD LOGFILE '+DGROUP1' SIZE 10M;
Database altered.
SQL> ALTER DATABASE DROP LOGFILE GROUP 1;
Database altered.
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
SQL> ALTER SYSTEM SWITCH LOGFILE;
System altered.
SQL> SQL> ALTER DATABASE DROP LOGFILE GROUP 2;
ALTER DATABASE DROP LOGFILE GROUP 2
*
ERROR at line 1:
ORA-01624: log 2 needed for crash recovery of instance TOASM (thread 1)
ORA-00312: online log 2 thread 1: '/u01/oradata/TOASM/redo02.log'
SQL> ALTER SYSTEM CHECKPOINT;
System altered.
SQL> ALTER DATABASE DROP LOGFILE GROUP 2;
Database altered.
SQL>ALTER DATABASE DROP LOGFILE GROUP 3;
Database altered.
SQL> SELECT MEMBER FROM V$LOGFILE;
MEMBER
--------------------------------------------------
+DGROUP1/toasm/onlinelog/group_4.275.683429043
+DGROUP1/toasm/onlinelog/group_5.276.683429047
+DGROUP1/toasm/onlinelog/group_6.264.683429049
SQL>
十一 遷移引數檔案
SQL> create pfile from spfile;
File created.
SQL> create spfile='+DATA' from pfile;
File created.
[oracle@orcl ~]$ cd $ORACLE_HOME/dbs
[oracle@orcl dbs]$ rm -i spfileorcl.ora
rm:是否刪除 一般檔案 “spfileorcl.ora”? y
[oracle@orcl dbs]$ cat initorcl.ora
spfile=+data/orcl/PARAMETERFILE/spfile.268.752447059
十二檢驗是否完成:
select file_name,tablespace_name from dba_data_files;
select * from v$logfile;
show parameter control;
show parameter spfile;
遷移完畢!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-757942/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 將spfile從ASM裡遷移到檔案系統ASM
- 怎麼把達夢資料庫例項從Windows遷移到Linux系統資料庫WindowsLinux
- Oracle使用RMAN將普通資料檔案轉成ASMOracleASM
- 【ASK_ORACLE】Relink ASM單例項資料庫詳細步驟OracleASM單例資料庫
- ASM單例項安裝後,需要手動設定ASM的引數檔案ASM單例
- 用rman遷移資料庫資料庫
- MySQL資料庫遷移到PostgresMySql資料庫
- Javaweb的例項--訂單管理系統--設計資料庫JavaWeb資料庫
- RAC+DG(asm單例項)ASM單例
- 【RMAN】Oracle使用rman將11.2.0.4資料庫遷移至Oracle12c命令參考Oracle資料庫
- Facebook將花費幾年時間將資料庫遷移到MySQL 8.0資料庫MySql
- 達夢資料庫系統表空間資料檔案遷移過程資料庫
- 利用RMAN備份重建資料庫資料庫
- 利用offline datafile檔案方式遷移資料
- [20191128]11GR2 asm例項audit檔案.txtASM
- 將RAC備份集恢復為單例項資料庫單例資料庫
- 專家解讀:利用Angular專案與資料庫融合例項Angular資料庫
- 將ServiceLoader遷移到Java 9模組系統 - frankelJava
- 將 CentOS 8 作業系統遷移到 Oracle LinuxCentOS作業系統OracleLinux
- 【資料庫資料恢復】ASM例項不能掛載的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- 利用rman copy的方法實現儲存上裸裝置資料檔案的遷移ITPUB
- 將檔案轉移到一個資料夾內batBAT
- FastDFS檔案系統遷移和資料恢復AST資料恢復
- 從本地MySQL遷移到雲資料庫,為什麼是Amazon Aurora?MySql資料庫
- ORACLE RAC ASM資料檔案遷移OMF檔案報錯ORA-01276解決OracleASM
- EAS附件表由資料庫遷移到FTP資料庫FTP
- 將maven、gradle倉庫遷移到d盤MavenGradle
- 使用SpringCloud將單體遷移到微服務SpringGCCloud微服務
- ASM叢集檔案系統ACFS(ASM Cluster File System)ASM
- 【資料庫資料恢復】Oracle ASM例項無法掛載的資料恢復案例資料庫資料恢復OracleASM
- 【ASM】ASM資料檔案和OS檔案(FILESYSTEM)轉移方法總結ASM
- 達夢遷移工具之MySQL資料庫遷移到達夢MySql資料庫
- 你的資料庫真的需要遷移到雲嗎?資料庫
- 19C 單例項資料庫安裝單例資料庫
- 達夢資料庫資料檔案遷移過程資料庫
- 如何將Azure SQL 資料庫還原到本地資料庫例項中SQL資料庫
- 記錄從vuecli打包庫遷移到rollup打包Vue
- [譯] 將專案遷移到 Yarn 然後又遷回 npmYarnNPM
- 如何將您的 Eventlet 專案遷移到 Asyncio