通過遷移的方式修改ASM磁碟組的冗餘屬性
1. 新建一個期望屬性的新磁碟組
[root@Oracle~]# su - grid
[grid@Oracle ~]$ asmca
或者用命令:
[grid@Oracle~]$ sqlplus / as sysasm
SQL >CREATE DISK GROUP DATA NORMAL REDUNDANCY DISK '/dev/raw/raw1' SIZE 2 G DISK '/dev/raw/raw2' SIZE 2 G DISK '/dev/raw/raw3' SIZE 2 G;
2. 檢查磁碟組
[grid@Oracle~]$ sqlplus / as sysasm
SQL>select state,name,type from v$asm_diskgroup;
STATE NAME TYPE
----------- ------------------------------ ------
MOUNTED DATA EXTERN
MOUNTED FRA EXTERN
MOUNTED DATA01 NORMAL
3. 備份現有的資料庫
[oracle@Oracle ~]$ sqlplus /nolog
SQL>conn /as sysdba
SQL>show parameter db_name
NAME TYPE VALUE
--------------------------- ---------------
db_name string ORCL
檢視當前控制檔案的Value:
SQL> show parameter control
NAME TYPE VALUE
----------------------------------------------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATA/orcl/controlfile/current.260.833734379
control_management_pack_access string DIAGNOSTIC+TUNING
在新磁碟組生成新控制檔案有兩種方法(推薦方法二):
方法一:通過備份現有控制檔案來生成:
備份控制檔案到新磁碟組
SQL>alter database backup controlfile to '+DATA01';
Database altered.
檢視備份後的控制檔案:
[root@Oracle~]# su - grid
[grid@Oracle~]$ asmcmd
ASMCMD> ls +DATA01/ORCL/CONTROLFILE/Backup.256.833381229
設定初始化引數:
SQL> alter system setcontrol_files='+DATA01/ORCL/CONTROLFILE/Backup.256.833381229' scope=spfile;
System altered.
關閉資料庫並啟動至nomount狀態(用SQL或RAMAN)
[oracle@Oracle~]$rman target /
RMAN> shutdown immediate #如果是RAC,需要到另外的節點執行SHUTDOWN命令
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup nomount
connected totarget database (not started)
Oracle instancestarted
Total SystemGlobal Area 1653518336 bytes
Fixed Size 2228904 bytes
VariableSize 973081944 bytes
DatabaseBuffers 671088640 bytes
Redo Buffers 7118848 bytes
從原控制檔案生成現有控制檔案:
RMAN>restore controlfile from'+DATA/orcl/controlfile/current.259.833372337';
Starting restoreat 16-Jul-15
allocatedchannel: ORA_DISK_1
channelORA_DISK_1: SID=13 device type=DISK
channelORA_DISK_1: copied control file copy
output file name=+DATA01/orcl/controlfile/backup.256.833381229
Finished restore at 16-Jul-15
方法二:使用新增控制檔案的方法:
SQL> alter system set control_files='+DATA/orcl/controlfile/current.260.833734379','+DATA01' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instanceshut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 973081944 bytes
Database Buffers 671088640 bytes
Redo Buffers 7118848 bytes
SQL>quit
[oracle@Oracle~]$rman target/
RMAN> restore controlfile from '+DATA/orcl/controlfile/current.260.833734379';
Starting restore at 16-Jul-15
using target database control file instead of recoverycatalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA/orcl/controlfile/current.260.833734379
output filename=+DATA01/orcl/controlfile/current.256.833744103
Finished restore at 16-Jul-15
RMAN> quit
Recovery Manager complete.
[oracle@Oracle~]$sqlplus /nolog
SQL>conn /as sysdba
Connected.
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> show parameter control;
NAME TYPE VALUE
------------------------------------ -----------------------------------------
control_file_record_keep_time integer 7
control_files string +DATA/orcl/controlfile/current.260.833734379,+DATA01/orcl/controlfile/current.256.833744103
control_management_pack_access string DIAGNOSTIC+TUNING
SQL> alter system setcontrol_files='+DATA01/orcl/controlfile/current.256.833744103' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 973081944 bytes
Database Buffers 671088640 bytes
Redo Buffers 7118848 bytes
Database mounted.
Database opened.
SQL> show parameter control;
NAME TYPE VALUE
------------------------------------ -----------------------------------------
control_file_record_keep_time integer 7
control_files string +DATA01/orcl/controlfile/current.256.833744103
control_management_pack_access string DIAGNOSTIC+TUNING
將資料庫啟動到mount狀態:
RMAN> shutdown immediate
RMAN> startup nomount
RMAN> alter database mount ;
database mounted
released channel: ORA_DISK_1
啟用RAMN工具,將資料庫映象備份到新磁碟組:
RMAN>backup as copy database format '+DATA01';
Starting backupat 16-Jul-15
allocatedchannel: ORA_DISK_1
channelORA_DISK_1: SID=13 device type=DISK
channelORA_DISK_1: starting datafile copy
input datafilefile number=00001 name=+DATA/orcl/datafile/system.264.833372265
output filename=+DATA01/orcl/datafile/system.257.833384045 tag=TAG20131205T153405 RECID=3STAMP=833384056
channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channelORA_DISK_1: starting datafile copy
input datafilefile number=00002 name=+DATA/orcl/datafile/sysaux.263.833372265
output filename=+DATA01/orcl/datafile/sysaux.258.833384061 tag=TAG20131205T153405 RECID=4STAMP=833384069
channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channelORA_DISK_1: starting datafile copy
input datafilefile number=00005 name=+DATA/orcl/datafile/example.268.833372347
output filename=+DATA01/orcl/datafile/example.259.833384075 tag=TAG20131205T153405 RECID=5STAMP=833384080
channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
channelORA_DISK_1: starting datafile copy
input datafilefile number=00003 name=+DATA/orcl/datafile/undotbs1.267.833372265
output filename=+DATA01/orcl/datafile/undotbs1.260.833384083 tag=TAG20131205T153405RECID=6 STAMP=833384084
channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channelORA_DISK_1: starting datafile copy
copying currentcontrol file
output filename=+DATA01/orcl/controlfile/backup.261.833384087 tag=TAG20131205T153405RECID=7 STAMP=833384086
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:01
channelORA_DISK_1: starting datafile copy
input datafilefile number=00004 name=+DATA/orcl/datafile/users.269.833372265
output filename=+DATA01/orcl/datafile/users.262.833384087 tag=TAG20131205T153405 RECID=8STAMP=833384087
channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channelORA_DISK_1: starting full datafile backup set
channelORA_DISK_1: specifying datafile(s) in backup set
including currentSPFILE in backup set
channel ORA_DISK_1:starting piece 1 at 16-Jul-15
channelORA_DISK_1: finished piece 1 at 16-Jul-15
piecehandle=+DATA01/orcl/backupset/2015_07_16/nnsnf0_tag20150716t153405_0.263.833384089tag=TAG20150716T153405 comment=NONE
channelORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 16-Jul-15
檢查備份的資料庫映象
RMAN> list copy of database;
4. 切換到備份的資料庫
RMAN> switch database to copy;
datafile 1switched to datafile copy"+DATA01/orcl/datafile/system.257.833384045"
datafile 2switched to datafile copy"+DATA01/orcl/datafile/sysaux.258.833384061"
datafile 3switched to datafile copy"+DATA01/orcl/datafile/undotbs1.260.833384083"
datafile 4switched to datafile copy "+DATA01/orcl/datafile/users.262.833384087"
datafile 5switched to datafile copy"+DATA01/orcl/datafile/example.259.833384075"
RMAN> alter database open;
database opened
修改資料庫新建檔案的目標磁碟組
[Oracle@Oracle ~]$ sqlplus "/as sysdba"
SQL> alter system set db_create_file_dest='+DATA01';
System altered.
5. 在新資料庫內建立新的TEMP表空間(TEMP表空間不會從舊的磁碟組中移到新磁碟組)
SQL> select name from v$tempfile; #檢視現有的temp檔名
SQL>create bigfile temporary tablespace temp01 tempfile size 2M;
Tablespace created.
SQL>alter database default temporary tablespace temp01;
Database altered.
SQL> drop tablespace temp;
Tablespace dropped.
6. 修改重做日誌組
SQL> select * from v$log; #檢視有幾個組
或:SQL>select group#,status from v$log;
GROUP# STATUS
--------------------------
1 CURRENT
2 INACTIVE
3 INACTIVE
SQL> alter database add logfile member '+data01' to group 1;
Database altered.
SQL> alter database add logfile member '+data01' to group 2;
Database altered.
SQL>alter database add logfile member '+data01' to group 3;
Database altered.
SQL>select member from v$logfile; #查詢logfile檔案:
MEMBER
--------------------------------------------------------------------------------
+DATA/orcl/onlinelog/group_3.256.833372341
+DATA/orcl/onlinelog/group_2.257.833372341
+DATA/orcl/onlinelog/group_1.258.833372341
+DATA01/orcl/onlinelog/group_1.265.833386551
+DATA01/orcl/onlinelog/group_2.266.833386565
+DATA01/orcl/onlinelog/group_3.267.833386569
6 rows selected.
SQL>alter system switch logfile; #多用幾次切換命令,切換一個迴圈
SQL>select group#,status from v$log; #檢視結果,找到INACTIVE的組。
GROUP# STATUS
--------------------------
1 INACTIVE
2 INACTIVE
3 CURRENT
SQL>alter database drop logfile member'+DATA/orcl/onlinelog/group_1.258.833372341';
Database altered.
SQL> alter database drop logfile member'+DATA/orcl/onlinelog/group_2.257.833372341';
Database altered.
SQL>select group#,status from v$log;
再次切換,釋放Group_3,然後刪除:
SQL>alter system switch logfile;
SQL> alter database drop logfile member'+DATA/orcl/onlinelog/group_3.256.833372341';
Database altered.
SQL> select * from v$logfile; #檢查結果
7. 遷移引數配置
遷移資料庫配置:
[oracle@Oracle ~]$ sqlplus /nolog
SQL> conn /assysdba
Connected.
SQL> create pfile='$ORACLE_HOME/dbs/init_ORCL.ora' from spfile;
File created.
SQL> shutdown immediate;
Database closed.
Databasedismounted.
ORACLE instanceshut down.
SQL>startup pfile='$ORACLE_HOME/dbs/init_ORCL.ora';
ORACLE instancestarted.
Total SystemGlobal Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 989859160 bytes
Database Buffers 654311424 bytes
Redo Buffers 7118848 bytes
Database mounted.
Database opened.
SQL>create spfile='+DATA01/orcl/spfileORCL.ora' frompfile='$ORACLE_HOME/dbs/init_ORCL.ora';
File created.
SQL>shutdown immediate;
Database closed.
Databasedismounted.
ORACLE instanceshut down.
[oracle@Oracle-LABdbs]$vi initORCL.ora
將SPFILE='+DATA/ORCL/spfileORCL.ora'改為SPFILE='+DATA01/ORCL/spfileORCL.ora',並儲存退出。
SQL> startup
遷移ASM配置:
[grid@Oracle ~]$ sqlplus / assysasm
SQL>create pfile='$ORACLE_HOME/dbs/init_ORCL.ora' from spfile;
File created.
SQL> shutdown immediate;
SQL>startup pfile='$ORACLE_HOME/dbs/init_ORCL.ora';
ASM instancestarted
Total SystemGlobal Area 283930624 bytes
Fixed Size 2227664 bytes
Variable Size 256537136 bytes
ASM Cache 25165824 bytes
ASM diskgroupsmounted
SQL>create spfile='+DATA01' from pfile='$ORACLE_HOME/dbs/init_ORCL.ora';
`File created.
SQL>shutdown immediate;
SQL> startup
8. 全面檢查
SQL> show parameter pfile;(分別在GRID和ORACLE帳號下檢視)
SQL> select name from v$controlfile
SQL>select name from v$datafile
SQL> select name from v$tempfile
SQL>select member from v$logfile
SQL> select filename from v$block_change_tracking
SQL> select name from v$flashback_database_logfile;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12798004/viewspace-1735278/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 修改ASM磁碟組冗餘模式ASM模式
- 修改ASM磁碟組的屬性ASM
- oracle 11.2.0.1 rac 修改asm磁碟組的冗餘模式(redundancy mode)為normalOracleASM模式ORM
- 遷移ASM磁碟組ASM
- oracle asm 磁碟管理什麼場景該用什麼樣的冗餘方式OracleASM
- 遷移ocr/votedisk/asm spfile所在磁碟組ASM
- 【資料遷移】RMAN遷移資料庫到ASM(一)建立ASM磁碟組資料庫ASM
- 通過FTP訪問ASM磁碟組FTPASM
- oracle 11g asm 磁碟組相容屬性OracleASM
- ASM磁碟組修改重建操作ASM
- 遷移OCR和VotingDisk並刪除原ASM磁碟組ASM
- 廉價冗餘磁碟陣列陣列
- 檢視asm磁碟組剩餘空間的正確方法ASM
- RAC環境ASM磁碟組間修改spfile的位置ASM
- ASM 翻譯系列第三十四彈:ASM磁碟組重要屬性介紹ASM
- ASM可以更改冗餘度&增加failgroup嗎?ASMAI
- 如何移動asm磁碟組內的資料檔案到另外一個磁碟組ASM
- asm 磁碟組 增刪磁碟組ASM
- 11.2環境ASM例項spfile放在ASM磁碟組的訪問方式ASM
- 零當機時間遷移 ASM 磁碟組到另一個 SAN/磁碟陣列/DAS 的準確步驟ASM陣列
- Oracle 12c 遷移MGMTDB 到其他的磁碟組Oracle
- oracle asm 儲存 a磁碟組中的資料檔案 遷移到b磁碟組實施步驟OracleASM
- oracle 資料庫磁碟組屬性Oracle資料庫
- oracle 資料庫磁碟組屬性Oracle資料庫
- vgchange指令:修改卷組屬性GC
- 在ASM磁碟組之間移動檔案ASM
- ASM磁碟組更換磁碟的操作方法ASM
- ASM磁碟組限制ASM
- Azure ASM到ARM遷移 (三) Reserved IP的遷移ASM
- ASM 磁碟組的建立及擴容ASM
- 【MOS】零當機遷移ASM磁碟組到另一個SAN/磁碟陣列/DAS的準確步驟 (文件 ID 1946664.1)ASM陣列
- 【ASM】ASMCMD chtmpl 更改ASM 模版的屬性ASM
- ASM下資料檔案遷移至不同磁碟組小記ASM
- 全面學習和應用ORACLE ASM特性--(3)新增和修改asm磁碟組OracleASM
- 找出冗餘索引的指令碼索引指令碼
- Oracle日誌組新增冗餘檔案和日誌組Oracle
- 刪除多餘的屬性 xmlns=""XML
- 一次ASM新增新的磁碟組ASM