小编给大家分享一下如何修改ASM磁盘冗余度,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
----1.将参数文件中,控制文件的参数由+DATA磁盘上的一个路径改为两个路径,
SQL> alter system set control_files='+DATA/asmdb/controlfile/current.260.886430449','+newdg' scope=spfile;
----2. 改为两个路径以后,由于第二个文件并不存在,会报错。
----这时重启数据库至nomount模式,使用rman从第一个控制文件恢复第二个控制文件
SQL> startup force nomount;
ORACLE instance started.
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 180358932 bytes
Database Buffers 423624704 bytes
Redo Buffers 2969600 bytes
[oracle@oracle4 dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Aug 19 01:47:18 2015
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: asmdb (not mounted)
RMAN> restore controlfile from '+DATA/asmdb/controlfile/current.260.886430449';
Starting restore at 19-AUG-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: copied control file copy
output filename=+DATA/asmdb/controlfile/current.260.886430449
output filename=+NEWDG/asmdb/controlfile/backup.257.888112073
Finished restore at 19-AUG-15
---红色标注的是生成的新的控制文件
---这时启动数据库至nomount模式
---你会发现参数被修改了:
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
[oracle@oracle4 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 19 01:48:48 2015
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> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATA/asmdb/controlfile/curren
t.260.886430449, +NEWDG/asmdb/controlfile/backup.257.888112073
新控制文件参数变成了前面rman恢复的控制文件的位置,如下:
+DATA/asmdb/controlfile/current.260.886430449 ---这是旧的
+NEWDG/asmdb/controlfile/backup.257.888112073 ---这是新的,我们需要被迁移到的位置,我们发现控制文件已经被迁移到了新的位置,接下来需要删除旧的控制文件
----3.删除旧的控制文件,因此将其从控制文件参数中剔除:
SQL> alter system set control_files='+NEWDG/asmdb/controlfile/backup.257.888112073' scope=spfile;
System altered.
SQL> startup force ;
ORACLE instance started.
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 180358932 bytes
Database Buffers 423624704 bytes
Redo Buffers 2969600 bytes
Database mounted.
Database opened.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +NEWDG/asmdb/controlfile/backup.257.888112073
----1.拷贝数据文件
[oracle@oracle4 dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Aug 19 01:51:13 2015
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ASMDB (DBID=630629232)
RMAN> backup as copy database format '+newdg';
Starting backup at 19-AUG-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=144 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DATA/asmdb/datafile/system.256.886430341
output filename=+NEWDG/asmdb/datafile/system.258.888112285 tag=TAG20150819T015122 recid=6 stamp=888112417
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:17
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DATA/asmdb/datafile/sysaux.257.886430341
output filename=+NEWDG/asmdb/datafile/sysaux.259.888112421 tag=TAG20150819T015122 recid=7 stamp=888112494
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:16
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATA/asmdb/datafile/example.265.886430497
output filename=+NEWDG/asmdb/datafile/example.260.888112497 tag=TAG20150819T015122 recid=8 stamp=888112539
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:47
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DATA/asmdb/datafile/undotbs1.258.886430341
output filename=+NEWDG/asmdb/datafile/undotbs1.261.888112547 tag=TAG20150819T015122 recid=9 stamp=888112564
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DATA/asmdb/datafile/users.259.886430341
output filename=+NEWDG/asmdb/datafile/users.262.888112571 tag=TAG20150819T015122 recid=10 stamp=888112572
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=+DATA/asmdb/datafile/tbs1.267.886604335
output filename=+NEWDG/asmdb/datafile/tbs1.263.888112573 tag=TAG20150819T015122 recid=11 stamp=888112580
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+NEWDG/asmdb/controlfile/backup.264.888112589 tag=TAG20150819T015122 recid=12 stamp=888112601
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
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 19-AUG-15
channel ORA_DISK_1: finished piece 1 at 19-AUG-15
piece handle=+NEWDG/asmdb/backupset/2015_08_19/nnsnf0_tag20150819t015122_0.265.888112607 tag=TAG20150819T015122 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 19-AUG-15
RMAN> list copy of database;
Key File S Completion Time Ckp SCN Ckp Time Name
------- ---- - --------------- ---------- --------------- ----
6 1 A 19-AUG-15 559320 19-AUG-15 +NEWDG/asmdb/datafile/system.258.888112285
9 2 A 19-AUG-15 559375 19-AUG-15 +NEWDG/asmdb/datafile/undotbs1.261.888112547
7 3 A 19-AUG-15 559349 19-AUG-15 +NEWDG/asmdb/datafile/sysaux.259.888112421
10 4 A 19-AUG-15 559383 19-AUG-15 +NEWDG/asmdb/datafile/users.262.888112571
8 5 A 19-AUG-15 559366 19-AUG-15 +NEWDG/asmdb/datafile/example.260.888112497
11 6 A 19-AUG-15 559385 19-AUG-15 +NEWDG/asmdb/datafile/tbs1.263.888112573
3 6 A 01-AUG-15 514730 01-AUG-15 /home/oracle/tbs1.bak
----拷贝完成
----2.数据文件拷贝已经完成,我们是在数据库开着的情况下拷贝的,现在需要将数据库切换到新的文件,切换文件实际是告诉控制文件,数据文件被移到了新的位置。因此这个步骤只是改变控制文件的内容,会很快,但是需要将数据库置为mount状态
RMAN> switch database to copy;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 08/19/2015 02:00:35
RMAN-06572: database is open and datafile 1 is not offline
----注意,需要启动数据库到mount状态执行switch
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 608174080 bytes
Fixed Size 1220844 bytes
Variable Size 180358932 bytes
Database Buffers 423624704 bytes
Redo Buffers 2969600 bytes
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+NEWDG/asmdb/datafile/system.258.888112285"
datafile 2 switched to datafile copy "+NEWDG/asmdb/datafile/undotbs1.261.888112547"
datafile 3 switched to datafile copy "+NEWDG/asmdb/datafile/sysaux.259.888112421"
datafile 4 switched to datafile copy "+NEWDG/asmdb/datafile/users.262.888112571"
datafile 5 switched to datafile copy "+NEWDG/asmdb/datafile/example.260.888112497"
datafile 6 switched to datafile copy "+NEWDG/asmdb/datafile/tbs1.263.888112573"
----switch成功,数据库使用新的数据文件
RMAN> alter database open;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 08/19/2015 02:01:54
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '+NEWDG/asmdb/datafile/system.258.888112285'
RMAN> recover database;
Starting recover at 19-AUG-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 19-AUG-15
RMAN> alter database open;
database opened
3. 日志文件:在新磁盘添加新成员,删除旧成员
4. 参数文件:
利用spfile生成pfile,pfile生成新的spfile,最后将pfile指向新的spfile
----检查
show parameter spfile;
select name from v$controlfile;
select name from v$datafile;
select name from v$tempfile;
select member from v$logfile;
select filename from v$block_change_tracking;
select name from v$flashback_database_logfile;
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +NEWDG/asmdb/spfileasmdb.ora
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+NEWDG/asmdb/controlfile/backup.257.888112073
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+NEWDG/asmdb/datafile/system.258.888112285
+NEWDG/asmdb/datafile/undotbs1.261.888112547
+NEWDG/asmdb/datafile/sysaux.259.888112421
+NEWDG/asmdb/datafile/users.262.888112571
+NEWDG/asmdb/datafile/example.260.888112497
+NEWDG/asmdb/datafile/tbs1.263.888112573
6 rows selected.
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
+NEWDG/asmdb/tempfile/temp01.266.888113011
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+NEWDG/asmdb/onlinelog/group_1.267.888113109
+NEWDG/asmdb/onlinelog/group_2.268.888113113
+NEWDG/asmdb/onlinelog/group_3.269.888113115
SQL> select name from v$flashback_database_logfile;
no rows selected
SQL> select filename from v$block_change_tracking;
以上是“如何修改ASM磁盘冗余度”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注天达云行业资讯频道!