將資料庫遷移到ASM的實驗記錄
昨天的blog中測試了在非RAC環境下建立ASM的過程,現在要使用已經建立的ASM,將資料庫遷移到ASM上。
主要步驟:
1、設定control_files環境變數2、遷移控制檔案(controlfile)
3、遷移資料檔案(datafile)
4、遷移臨時檔案(tempfile)
5、遷移線上日誌(redolog)
纖細操作過程如下:
[@more@]1、設定control_files環境變數
設定這個環境變數的目的是為了下一步使用restore controlfile的時候,能直接在asm上建立需要的控制檔案。
[oracle@oracle ~]$ echo $ORACLE_SID orcl [oracle@oracle ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Fri Dec 18 09:12:48 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218292 bytes Variable Size 83888396 bytes Database Buffers 75497472 bytes Redo Buffers 7168000 bytes Database mounted. Database opened. SQL> show parameter control NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string /oracle/oradata/orcl/control01 .ctl, /oracle/oradata/orcl/con trol02.ctl, /oracle/oradata/or cl/control03.ctl SQL> alter system set control_files='+DATA/ORCL/control01.ctl','+DATA/ORCL/control02.ctl','+DATA/ORCL/control03.ctl' scope=spfile; System altered. |
2、遷移控制檔案(controlfile)
這一步就是使用rman的restore controlfile命令,將本地磁碟上的控制檔案恢復到資料庫的control_files引數指定的檔案位置。
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup nomount; ORACLE instance started. Total System Global Area 167772160 bytes Fixed Size 1218292 bytes Variable Size 71305484 bytes Database Buffers 88080384 bytes Redo Buffers 7168000 bytes SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options [oracle@oracle ~]$ rman target /; Recovery Manager: Release 10.2.0.1.0 - Production on Fri Dec 18 09:35:25 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. connected to target database: orcl (not mounted) RMAN> restore controlfile from '/oracle/oradata/orcl/control01.ctl'; Starting restore at 18-DEC-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=157 devtype=DISK channel ORA_DISK_1: copied control file copy output filename=+DATA/orcl/control01.ctl output filename=+DATA/orcl/control02.ctl output filename=+DATA/orcl/control03.ctl Finished restore at 18-DEC-09 |
3、遷移資料檔案(datafile)
遷移資料檔案的操作主要就是使用rman的backup as copy命令,將整個資料庫備份到ASM上,然後執行switch命令,修改controlfile以使用備份的資料檔案
RMAN> alter database mount; database mounted released channel: ORA_DISK_1 RMAN> backup as copy database format '+DATA'; Starting backup at 18-DEC-09 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf output filename=+DATA/orcl/datafile/system.259.705922671 tag=TAG20091218T093751 recid=11 stamp=705922714 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:46 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf output filename=+DATA/orcl/datafile/sysaux.260.705922719 tag=TAG20091218T093751 recid=12 stamp=705922741 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26 channel ORA_DISK_1: starting datafile copy input datafile fno=00005 name=/oracle/oradata/orcl/example01.dbf output filename=+DATA/orcl/datafile/example.261.705922745 tag=TAG20091218T093751 recid=13 stamp=705922752 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf output filename=+DATA/orcl/datafile/undotbs1.262.705922759 tag=TAG20091218T093751 recid=14 stamp=705922762 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile copy input datafile fno=00006 name=/oracle/oradata/orcl/tbs_lmt01.dbf output filename=+DATA/orcl/datafile/tbs_lmt.263.705922767 tag=TAG20091218T093751 recid=15 stamp=705922767 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00007 name=/oracle/oradata/orcl/tbs_lmt_2_01.dbf output filename=+DATA/orcl/datafile/tbs_lmt_2.264.705922769 tag=TAG20091218T093751 recid=16 stamp=705922770 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00008 name=/oracle/oradata/orcl/tbs_lmt02.dbf output filename=+DATA/orcl/datafile/tbs_lmt_3.265.705922773 tag=TAG20091218T093751 recid=17 stamp=705922774 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=/oracle/oradata/orcl/users01.dbf output filename=+DATA/orcl/datafile/users.266.705922777 tag=TAG20091218T093751 recid=18 stamp=705922776 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting datafile copy copying current control file output filename=+DATA/orcl/controlfile/backup.267.705922777 tag=TAG20091218T093751 recid=19 stamp=705922778 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 18-DEC-09 channel ORA_DISK_1: finished piece 1 at 18-DEC-09 piece handle=+DATA/orcl/backupset/2009_12_18/nnsnf0_tag20091218t093751_0.268.705922783 tag=TAG20091218T093751 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 18-DEC-09 RMAN> switch database to copy; datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.259.705922671" datafile 2 switched to datafile copy "+DATA/orcl/datafile/undotbs1.262.705922759" datafile 3 switched to datafile copy "+DATA/orcl/datafile/sysaux.260.705922719" datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.266.705922777" datafile 5 switched to datafile copy "+DATA/orcl/datafile/example.261.705922745" datafile 6 switched to datafile copy "+DATA/orcl/datafile/tbs_lmt.263.705922767" datafile 7 switched to datafile copy "+DATA/orcl/datafile/tbs_lmt_2.264.705922769" datafile 8 switched to datafile copy "+DATA/orcl/datafile/tbs_lmt_3.265.705922773" RMAN> alter database open; database opened RMAN> exit Recovery Manager complete. |
4、遷移臨時檔案(tempfile)
臨時檔案不能透過rman備份恢復,只好先在asm上新建一個,然後再把原來的刪除。
這裡使用了oracle的omf特性(透過設定db_create_file_dest引數實現),建立臨時檔案的時候不用指定檔名。
[oracle@oracle ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Fri Dec 18 09:40:50 2009 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#,name from v$tempfile; FILE# ---------- NAME -------------------------------------------------------------------------------- 1 /oracle/oradata/orcl/temp01.dbf SQL> select name from v$tablespace; NAME ------------------------------ SYSTEM UNDOTBS1 SYSAUX USERS TEMP EXAMPLE TBS_LMT TBS_LMT_2 TBS_LMT_3 9 rows selected. SQL> alter system set db_create_file_dest='+DATA' scope=both; System altered. SQL> alter tablespace temp add tempfile; Tablespace altered. SQL> alter tablespace temp drop tempfile 1; Tablespace altered. |
5、遷移線上日誌(redolog)
線上日誌不能透過rman備份恢復,只好先在asm上新建幾組,然後再把原來的刪除。
這裡使用了oracle的omf特性(透過設定db_create_online_log_dest_1引數實現),建立線上日誌檔案的時候不用指定檔名。
SQL> select group#,member from v$logfile; GROUP# ---------- MEMBER -------------------------------------------------------------------------------- 3 /oracle/oradata/orcl/redo03.log 2 /oracle/oradata/orcl/redo02.log 1 /oracle/oradata/orcl/redo01.log SQL> show parameter create NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ create_bitmap_area_size integer 8388608 create_stored_outlines string db_create_file_dest string +DATA db_create_online_log_dest_1 string db_create_online_log_dest_2 string db_create_online_log_dest_3 string db_create_online_log_dest_4 string db_create_online_log_dest_5 string SQL> alter system set db_create_online_log_dest_1='+DATA' scope=both; System altered. SQL> alter database add logfile group 4 size 100m; Database altered. SQL> c/4/5 1* alter database add logfile group 5 size 100m SQL> / Database altered. SQL> c/5/6 1* alter database add logfile group 6 size 100m SQL> / Database altered. SQL> select group#,member from v$logfile; GROUP# ---------- MEMBER -------------------------------------------------------------------------------- 3 /oracle/oradata/orcl/redo03.log 2 /oracle/oradata/orcl/redo02.log 1 /oracle/oradata/orcl/redo01.log GROUP# ---------- MEMBER -------------------------------------------------------------------------------- 4 +DATA/orcl/onlinelog/group_4.270.705923247 5 +DATA/orcl/onlinelog/group_5.271.705923261 6 +DATA/orcl/onlinelog/group_6.272.705923271 6 rows selected. SQL> select group#,status from v$log; GROUP# STATUS ---------- ---------------- 1 INACTIVE 2 INACTIVE 3 INACTIVE 4 ACTIVE 5 CURRENT 6 UNUSED 6 rows selected. SQL> alter system switch logfile; System altered. SQL> alter database drop logfile group 1; Database altered. SQL> c/1/2 1* alter database drop logfile group 2 SQL> / Database altered. SQL> c/2/3 1* alter database drop logfile group 3 SQL> / Database altered. |
-- end --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22049049/viewspace-1029775/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 資料庫遷移到ASM資料庫ASM
- 使用rman將資料庫遷移到ASM例項資料庫ASM
- 將資料庫從ASM遷移到檔案系統資料庫ASM
- 將資料庫從檔案系統遷移到ASM資料庫ASM
- 使用rman copy將資料庫遷移到ASM例項資料庫ASM
- 利用RMAN將資料庫從檔案系統遷移到ASM資料庫ASM
- 將pentaho資料庫遷移到oracle資料庫資料庫Oracle
- 利用rman將本地資料檔案遷移到asmASM
- 將ORACLE資料庫資料檔案遷移到其他目錄(ZT)Oracle資料庫
- 資料庫從檔案系統遷移到ASM資料庫ASM
- 利用RMAN將資料庫從檔案系統遷移到ASM(單例項)資料庫ASM單例
- 三種ASM下將資料檔案由dg遷移到dg的方法ASM
- 遷移到ASMASM
- 實現資料庫由檔案系統遷移到 ASM 磁碟組中資料庫ASM
- 資料庫從檔案系統轉移至ASM實驗記錄資料庫ASM
- 採用Duplicate不連線target資料庫的方式將檔案系統遷移到ASM資料庫ASM
- 資料泵實現資料遷移到異地庫
- 資料庫從檔案系統轉移至ASM實驗記錄[zt]資料庫ASM
- 記錄從vuecli打包庫遷移到rollup打包Vue
- 使用資料庫冷備份方式進行資料庫遷移,資料庫檔案遷移到不同的目錄資料庫
- oracle 10g rac hacmp 遷移到asm實驗步驟Oracle 10gACMASM
- rman將linux平臺資料庫遷移到window平臺資料庫Linux資料庫
- 【原創】資料庫從檔案系統轉移至ASM實驗記錄資料庫ASM
- 使用RAM將檔案系統遷移到ASMASM
- 將OPEN BRAVO資料庫從oracle 遷移到DB2資料庫OracleDB2
- Facebook將花費幾年時間將資料庫遷移到MySQL 8.0資料庫MySql
- 將spfile從ASM裡遷移到檔案系統ASM
- 將SAP 後臺資料庫從DB2 遷移到ORACLE資料庫DB2Oracle
- 遷移資料庫到ASM資料庫ASM
- AIX 資料庫遷移到z/linuxAI資料庫Linux
- 將OPEN BRAVO後臺資料庫從ORACLE遷移到DB2資料庫OracleDB2
- 【資料遷移】RMAN遷移資料庫到ASM(一)建立ASM磁碟組資料庫ASM
- 資料庫遷移之資料泵實驗資料庫
- 你的資料庫真的需要遷移到雲嗎?資料庫
- 單例項資料庫expdp遷移到RAC庫單例資料庫
- 大資料實驗記錄大資料
- 線上過期資料遷移到離線資料庫資料庫
- Oracle遷移資料庫過程記錄Oracle資料庫