1 做数据库RMAN完全备份
run
{
configure retention policy to recovery window of 25 days;
ALLOCATE CHANNEL c1 DEVICE disk;
ALLOCATE CHANNEL c2 DEVICE disk;
ALLOCATE CHANNEL c3 DEVICE disk;
ALLOCATE CHANNEL c4 DEVICE disk;
crosscheck backup;
crosscheck archivelog all;
backup database format 'ldsc_whole_db%U%T.bak';
sql 'ALTER SYSTEM switch logfile';
backup archivelog all format 'arch_bak%d_%s_%p_%T' not backed up 1 times;
backup current controlfile format 'ctrl_bak%d_%I_%s_%p_%T';
backup spfile format 'spfile_%T_%I.ora';
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
有条件一并做一次逻辑导出备份
2 基本结构
2.1 旧存储裸设备对应关系
查看磁盘ID的指令:
#ls –al /dev/disk/by-id
查看分区的UUID
#ls –al /dev/disk/by-uuid
编号 | 裸设备名称 | 磁盘名称 | 分区名称 | 磁盘ID |
1 | /dev/raw/raw1 | /dev/sdb | /dev/sdb1 | scsi-36000c294e3b550478be9c392c3aaefa6 |
2 | /dev/raw/raw2 | /dev/sdc | /dev/sdc1 | scsi-36000c296c9f56c2fc88deceb5317d68b |
3 | /dev/raw/raw3 | /dev/sdd | /dev/sdd1 | scsi-36000c299c05893c4c2f923909f6ef94c |
4 | /dev/raw/raw4 | /dev/sde | /dev/sde1 | scsi-36000c29d65d6d3e89563e3dfc7f3faa8 |
2.2 旧裸设备与角色对应关系
编号 | 裸设备名称 | 属主 | 权限 | 裸设备角色 | 备注 |
1 | /dev/raw/raw1 | root:oinstall | 640 | OCR |
|
2 | /dev/raw/raw2 | oracle:oinstall | 644 | VOTE DISK |
|
3 | /dev/raw/raw3 | oracle:oinstall | 660 | Member of DATA |
|
4 | /dev/raw/raw4 | oracle:oinstall | 660 | Member of DATA |
|
2.3 新存储裸设备对应关系
编号 | 裸设备名称 | 磁盘名称 | 分区名称 | 磁盘ID |
1 | /dev/raw/raw5 | /dev/sdf | /dev/sdf1 | scsi-36000c29f7ca6341614886693a59aeec8 |
2 | /dev/raw/raw6 | /dev/sdg | /dev/sdg1 | scsi-36000c292a9ebe7d24f2d94542e6c9824 |
3 | /dev/raw/raw7 | /dev/sdh | /dev/sdh1 | scsi-36000c29322a954b4c677cf15e685b6b7 |
4 | /dev/raw/raw8 | /dev/sdi | /dev/sdi1 | scsi-36000c2972866199de5aa51b136e90e5e |
5 | /dev/raw/raw9 | /dev/sdj | /dev/sdj1 | scsi-36000c29f2556d5adfaf30cfba157569b |
6 | /dev/raw/raw10 | /dev/sdk | /dev/sdk1 | scsi-36000c297fa7fbce9f5fa36422a089e4e |
2.4 新裸设备与角色对应关系
编号 | 裸设备名称 | 属主 | 权限 | 裸设备角色 | 备注 |
1 | /dev/raw/raw5 | root:oinstall | 640 | ocr |
|
2 | /dev/raw/raw6 | oracle:oinstall | 644 | Vote disk |
|
3 | /dev/raw/raw7 | oracle:oinstall | 660 | DATA1 |
|
4 | /dev/raw/raw8 | oracle:oinstall | 660 | DATA1 |
|
5 | /dev/raw/raw9 | oracle:oinstall | 660 | ARC |
|
6 | /dev/raw/raw10 | oracle:oinstall | 660 | ARC |
|
3 集群结构迁移
3.1 迁移votedisk
3.1.1 查看当前votedisk情况
查看当前集群环境使用的votedisk
Oracle用户:
[oracle@ora1 ~]$ crsctl query css votedisk
0. 0 /dev/raw/raw2
located 1 votedisk(s).
3.1.2 停止集群的两个节点
root用户执行:
node1:
[root@ora1 ~]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
May 25 16:48:12.961 | INF | daemon shutting down
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
node2:
[root@ora2 raw]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
May 25 16:49:20.379 | INF | daemon shutting down
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
3.1.3 备份vote盘
这里备份vote盘到文件
[root@ora1 bin]# dd if=/dev/raw/raw2 of=/home/oracle/votediskbackup/vote.20150525 bs=1M
499+1 records in
499+1 records out
524271616 bytes (524 MB) copied, 13.0158 seconds, 40.3 MB/s
3.1.4 添加新存储中盘作为新的vote盘
root用户执行:
ORA_CRS_HOME目录bin目录下执行:
注意这里不加-force参数的时候,执行会报cluster没有准备
[root@ora1 bin]# ./crsctl add css votedisk /dev/raw/raw6
Cluster is not in a ready state for online disk addition
正确的语句应该是这样的
[root@ora1 bin]# ./crsctl add css votedisk /dev/raw/raw6 -force
Now formatting voting disk: /dev/raw/raw6
successful addition of votedisk /dev/raw/raw6.
查看添加后的vote盘
root用户执行:
[root@ora1 bin]# ./crsctl query css votedisk
0. 0 /dev/raw/raw2
1. 0 /dev/raw/raw6
located 2 votedisk(s).
3.1.5 启动两个节点
root用户执行
node1:
[root@ora1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
node2:
[root@ora2 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
3.1.6 检查启动情况
oracle用户执行
[oracle@ora1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....z1.inst application ONLINE ONLINE ora1
ora....z2.inst application ONLINE ONLINE ora2
ora.cbnz.db application ONLINE ONLINE ora2
ora.etax.db application ONLINE ONLINE ora2
ora....x1.inst application ONLINE ONLINE ora1
ora....x2.inst application ONLINE ONLINE ora2
ora....SM1.asm application ONLINE ONLINE ora1
ora....A1.lsnr application ONLINE ONLINE ora1
ora.ora1.gsd application ONLINE ONLINE ora1
ora.ora1.ons application ONLINE ONLINE ora1
ora.ora1.vip application ONLINE ONLINE ora1
ora....SM2.asm application ONLINE ONLINE ora2
ora....A2.lsnr application ONLINE ONLINE ora2
ora.ora2.gsd application ONLINE ONLINE ora2
ora.ora2.ons application ONLINE ONLINE ora2
ora.ora2.vip application ONLINE ONLINE ora2
3.1.7 停止两节点
root用户执行
node1:
/etc/init.d/init.crs stop
node2:
/etc/init.d/init.crs stop
3.1.8 删除老的vote盘
这里一定要注意不要删错盘
root用户执行
[root@ora1 bin]# ./crsctl delete css votedisk /dev/raw/raw2 -force
successful deletion of votedisk /dev/raw/raw2.
3.1.9 两节点启动crs
root用户执行
node1:
/etc/init.d/init.crs start
node2:
/etc/init.d/init.crs start
3.1.10 检查启动情况
oracle用户执行
[oracle@ora1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....z1.inst application ONLINE ONLINE ora1
ora....z2.inst application ONLINE ONLINE ora2
ora.cbnz.db application ONLINE ONLINE ora1
ora.etax.db application ONLINE ONLINE ora2
ora....x1.inst application ONLINE ONLINE ora1
ora....x2.inst application ONLINE ONLINE ora2
ora....SM1.asm application ONLINE ONLINE ora1
ora....A1.lsnr application ONLINE ONLINE ora1
ora.ora1.gsd application ONLINE ONLINE ora1
ora.ora1.ons application ONLINE ONLINE ora1
ora.ora1.vip application ONLINE ONLINE ora1
ora....SM2.asm application ONLINE ONLINE ora2
ora....A2.lsnr application ONLINE ONLINE ora2
ora.ora2.gsd application ONLINE ONLINE ora2
ora.ora2.ons application ONLINE ONLINE ora2
ora.ora2.vip application ONLINE ONLINE ora2
3.1.11 检查vote盘的情况
root用户执行
[oracle@ora1 ~]$ crsctl query css votedisk
0. 0 /dev/raw/raw6
located 1 votedisk(s).
3.2 迁移OCR磁盘
3.2.1 查看OCR磁盘情况
oracle用户执行
[oracle@ora1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 511744
Used space (kbytes) : 4636
Available space (kbytes) : 507108
ID : 350260548
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
root用户执行
[root@ora1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 511744
Used space (kbytes) : 4636
Available space (kbytes) : 507108
ID : 350260548
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
3.2.2 在线备份OCR
root用户执行
注意这里是在线备份
CRS宿主目录下执行
[root@ora1 bin]# ./ocrconfig -export /home/oracle/ocrdiskbackup/ocr.disk.20150526 -s online
3.2.3 迁移
3.2.3.1 迁移方法一
改方法是编辑两个节点的/etc/oracle/ocr.loc文件,将ocrconfig_loc的位置/dev/raw/old_ocr_disk改为新存储的/dev/raw/new_ocr_disk
3.2.3.1.1 关闭集群
root用户执行
node1
/etc/init.d/init.crs stop
node2
/etc/init.d/init.crs stop
3.2.3.1.2 导入配置并检查
root用户执行
./ocrconfig -import /home/oracle/ocrback/ocr.bak20120315
./ocrcheck
3.2.3.1.3 启动集群并检查状态
root用户执行
node1
/etc/init.d/init.crs start
node2
/etc/init.d/init.crs start
Oracle用户执行
crs_stat -t
3.2.3.2 迁移方法二
该方法为给OCR所在磁盘做镜像,注意此时集群并没有停。
3.2.3.2.1 先做镜像
[root@ora1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw5
3.2.3.2.2 检查 ocr
[root@ora1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 511744
Used space (kbytes) : 4636
Available space (kbytes) : 507108
ID : 350260548
Device/File Name : /dev/raw/raw1
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw5
Device/File integrity check succeeded
Cluster registry integrity check succeeded
3.2.3.2.3 替换 OCR
[root@ora1 bin]# ./ocrconfig -replace ocr
//该指令是删除OCR设备,这是镜像OCR设备自动转换为OCR设备
[root@ora1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 511744
Used space (kbytes) : 4636
Available space (kbytes) : 507108
ID : 350260548
Device/File Name : /dev/raw/raw5
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
此时重新启动下集群,检验集群的状态。
4 调整ASM磁盘组
4.1 创建新的ASM磁盘组
4.1.1 启动两个实例到mount状态
先关闭数据库的两个实例
oracle用户执行
node1
shutdown immediate
startup mount
node2
shutdown immediate
startup mount
4.1.2 添加asm磁盘发现位置
此步骤不用执行
node1
SQL> alter system set asm_diskstring='/dev/raw/raw*','/dev/raw/new_raw*';
4.1.3 创建磁盘组
SQL> create diskgroup arc external redundancy disk '/dev/raw/raw9' name ARC_0000,'/dev/raw/raw10' name ARC_0001;
SQL> select name,state from v$asm_disk;
NAME STATE
------------------------------ ----------------
NORMAL
NORMAL
NORMAL
NORMAL
ARC_0001 NORMAL
ARC_0000 NORMAL
DATA_0001 NORMAL
DATA_0000 NORMAL
4.1.4 第二节点挂载该磁盘组
node2
SQL> /
NAME STATE
-------------------- ----------------------
DATA MOUNTED
ARC MOUNTED
DATA MOUNTED
ARC DISMOUNTED
SQL> alter diskgroup arc mount;
Diskgroup altered.
SQL> select name,state from gv$asm_diskgroup;
NAME STATE
-------------------- ----------------------
DATA MOUNTED
ARC MOUNTED
DATA MOUNTED
ARC MOUNTED
注意必须要在pfile中添加asm_diskgroups参数的更改值。
重新启动下crs,测试ARC能不能自动的挂载(mount),经测试确实不能自动挂载
需要修改ASM的参数文件:
more init+ASM1.ora
asm_diskgroups='DATA','ARC'
这样在启动ASM实例时会自动挂载ARC卷组
4.1.5 在ASM中手动创建所需的目录
注意这里要手动在ASM中创建如下需要的目录
DATA1/数据库名称/DATAFILE
DATA1/数据库名称/ARCHIVELOG
DATA1/数据库名称/CONTROLFILE
DATA1/数据库名称/ONLINELOG
DATA1/数据库名称/PARAMETERFILE
DATA1/数据库名称/TEMPFILE
ASMCMD> cd DATA1
ASMCMD> ls
ASMCMD> mkdir ETAX
ASMCMD> mkdir CBNZ
ASMCMD> ls
CBNZ/
ETAX/
ASMCMD> cd etax
ASMCMD> ls
ASMCMD> mkdir DATAFILE
ASMCMD> mkdir ARCHIVELOG
ASMCMD> mkdir CONTROLFILE
ASMCMD> mkdir ONLINELOG
ASMCMD> mkdir PARAMETERFILE
ASMCMD> mkdir TEMPFILE
5 数据库迁移
5.1 迁移数据文件
!!!!!!!!!!!做所有操作前做spfile的备份
5.1.1 查询数据文件的名称
SQL> select FILE#,NAME from v$datafile;
FILE# NAME
---------- ---------------------------------------------
1 +DATA/etax/datafile/system.256.880644513
2 +DATA/etax/datafile/undotbs1.258.880644515
3 +DATA/etax/datafile/sysaux.257.880644513
4 +DATA/etax/datafile/users.259.880644515
5 +DATA/etax/datafile/undotbs2.264.880644613
5.1.2 关闭数据库并启动数据到mount状态
srvctl stop database –d etax
srvctl start database –d etax –o mount
5.1.3 用RMAN复制数据文件
rman target / nocatalog
RMAN> copy datafile 1 to '+DATA1/etax/datafile/system01.dbf';
RMAN>copy datafile 2 to '+DATA1/etax/datafile/undotbs01.dbf';
RMAN>copy datafile 3 to '+DATA1/etax/datafile/sysaux01.dbf';
RMAN>copy datafile 4 to '+DATA1/etax/datafile/user01.dbf';
RMAN>copy datafile 5 to '+DATA1/etax/datafile/undotbs02.dbf';
5.1.4 更换数据文件的位置
登录数据库,更换数据文件的位置
alter database rename file '+DATA/etax/datafile/system.256.880644513' to '+DATA1/etax/datafile/system01.dbf';
alter database rename file '+DATA/etax/datafile/undotbs1.258.880644515' to '+DATA1/etax/datafile/undotbs01.dbf';
alter database rename file '+DATA/etax/datafile/sysaux.257.880644513' to '+DATA1/etax/datafile/sysaux01.dbf';
alter database rename file '+DATA/etax/datafile/users.259.880644515' to '+DATA1/etax/datafile/user01.dbf';
alter database rename file '+DATA/etax/datafile/undotbs2.264.880644613' to '+DATA1/etax/datafile/undotbs02.dbf';
5.1.5 两节点打开数据库并验证数据文件
alter database open;
FILE# NAME
---------- ---------------------------------------------
1 +DATA1/etax/datafile/system01.dbf
2 +DATA1/etax/datafile/undotbs01.dbf
3 +DATA1/etax/datafile/sysaux01.dbf
4 +DATA1/etax/datafile/user01.dbf
5 +DATA1/etax/datafile/undotbs02.dbf
已更换完成
5.2 迁移redolog文件
新添加重做日志组的成员到日志组中,在新磁盘位置,
SQL> alter database add logfile member '+DATA1' to group 1;
Database altered.
SQL> alter database add logfile member '+DATA1' to group 2;
Database altered.
SQL> alter database add logfile member '+DATA1' to group 3;
Database altered.
SQL> alter database add logfile member '+DATA1' to group 4;
Database altered.
每个现成新建一组日志组:
SQL> alter database add logfile thread 1 group 5 '+DATA1' size 50M;
Database altered.
SQL> alter database add logfile thread 2 group 6 '+DATA1' size 50M;
Database altered.
通过切换日志,将在旧存储上的重做日志成员删除
SQL> alter database drop logfile member '+DATA/cbnz/onlinelog/group_2.259.880881363';
SQL> alter database drop logfile member '+DATA/cbnz/onlinelog/group_3.280.880881425';
SQL> alter database drop logfile member '+DATA/cbnz/onlinelog/group_1.264.880881361';
SQL> alter database drop logfile member '+DATA/cbnz/onlinelog/group_4.281.880881427';
5.3 迁移控制文件
5.3.1 查看控制文件
SQL> select name from v$controlfile;
NAME
---------------------------------------------
+DATA/etax/controlfile/current.260.880644577
5.3.2 调整数据库的状态
srvctl stop database –d etax
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
关闭一个实例,另一个实例启动到nomount状态
5.3.3 用现有控制文件恢复控制文件
在nomount实例节点上用rman连接实例
[oracle@ora1 ~]$ rman target / nocatalog
Recovery Manager: Release 10.2.0.5.0 - Production on Tue May 26 10:35:04 2015
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: etax (not mounted)
using target database control file instead of recovery catalog
RMAN> restore controlfile to '+DATA1/etax/control01.ctl' from '+DATA/etax/controlfile/current.260.880644577';
Starting restore at 26-MAY-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=149 instance=etax1 devtype=DISK
channel ORA_DISK_1: copied control file copy
Finished restore at 26-MAY-15
5.3.4 更改控制文件参数
在nomount状态的数据库中更改control_files参数
SQL> alter system set control_files='+DATA1/etax/control01.ctl' scope=spfile;
System altered.
关闭数据库,注意这里必须要先关闭数据库,然后才能启动数据库
不然会报如下的错误
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '+DATA1/etax/datafile/system01.dbf'
ORA-01207: file is more recent than control file - old control file
正常启动数据库
5.4 迁移spfile文件
5.4.1 查看两个节点的spfile文件
oracle用户执行:
[oracle@ora2 ~]$ srvctl config database -d etax -a
ora1 etax1 /app/oracle/product/10.2.0/db
ora2 etax2 /app/oracle/product/10.2.0/db
DB_UNIQUE_NAME: etax
DB_NAME: etax
ORACLE_HOME: /app/oracle/product/10.2.0/db
SPFILE: +DATA/etax/spfileetax.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
5.4.2 用现有spfile生成pfile
create pfile='/home/oracle/pfilebackup/etax.pfile.20150526.00' from spfile;
5.4.3 用pfile文件启动数据库
在一个节点上用pfile文件将数据库启动到mount模式
startup pfile='/home/oracle/pfilebackup/etax.pfile.20150526.00' mount
5.4.4 在新位置创建pfile文件
SQL> create spfile='+DATA1/etax/spfileetax.ora' from pfile;
File created.
5.4.5 关闭数据库
SQL> shutdown immediate
5.4.6 设置数据库的参数文件位置
srvctl modify database -d etax -p '+DATA1/etax/spfileetax.ora'
检验两个节点$ORACLE_HOME/dbs下的initetax1.ora和initetax2.ora文件中的spfile参数指向位置
[oracle@ora1 ~]$ more /app/oracle/product/10.2.0/db/dbs/initetax1.ora
SPFILE='+DATA/etax/spfileetax.ora'
[oracle@ora2 ~]$ more /app/oracle/product/10.2.0/db/dbs/initetax2.ora
SPFILE='+DATA/etax/spfileetax.ora'
发现均没有变过来
查看数据库的配置:
[oracle@ora2 ~]$ srvctl config database -d etax -a
ora1 etax1 /app/oracle/product/10.2.0/db
ora2 etax2 /app/oracle/product/10.2.0/db
DB_UNIQUE_NAME: etax
DB_NAME: etax
ORACLE_HOME: /app/oracle/product/10.2.0/db
SPFILE: +DATA1/etax/spfileetax.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
已经改变
重新启动下crs,重启之后也没有改变
手动编辑两个pfile参数文件
[oracle@ora1 dbs]$ vi /app/oracle/product/10.2.0/db/dbs/initetax1.ora
SPFILE='+DATA1/etax/spfileetax.ora'
[oracle@ora2 dbs]$ vi /app/oracle/product/10.2.0/db/dbs/initetax2.ora
SPFILE='+DATA1/etax/spfileetax.ora'
然后再启动,仍然是不行的,参数文件仍然指向原位置.
来自官方的解决方法:
1. 是创建spfile时要制定pfile的路径到你刚才启动用的pfile路径:
比如我们生成的pfile文件在/tmp目录下,并且用该文件启动的数据库,则创建spfile的语句应该用如下的方式。
create spfile='+DATA/ora10g/spfileora10g.ora1' from pfile='/tmp/pfile.ora'
2.创建完成后要马上shutdown immediate
5.4.7 查看数据库的参数文件位置
srvctl config database -d 数据库名称 –a
DB_UNIQUE_NAME: etax
DB_NAME: etax
ORACLE_HOME: /app/oracle/product/10.2.0/db
SPFILE: +DATA1/etax/spfileetax.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
5.4.8 完整的创建过程
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
SQL> create pfile='/home/oracle/pfilebackup/cbnz.spfile.backup.20150528' from spfile;
File created.
SQL> shutdown immediate
SQL> startup pfile='/home/oracle/pfilebackup/cbnz.spfile.backup.20150528' nomount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
SQL> create spfile='+DATA1/cbnz/spfilecbnz.ora' from pfile='/home/oracle/pfilebackup/cbnz.spfile.backup.20150528';
File created.
SQL> shutdown immediate
[oracle@ora1 dbs]$ srvctl config database -d cbnz -a
ora1 cbnz1 /app/oracle/product/10.2.0/db
ora2 cbnz2 /app/oracle/product/10.2.0/db
DB_UNIQUE_NAME: cbnz
DB_NAME: cbnz
ORACLE_HOME: /app/oracle/product/10.2.0/db
SPFILE: +DATA/cbnz/spfilecbnz.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
[oracle@ora1 dbs]$ srvctl modify database -d cbnz -p '+DATA1/cbnz/spfilecbnz.ora'
[oracle@ora1 dbs]$ srvctl config database -d cbnz -a
ora1 cbnz1 /app/oracle/product/10.2.0/db
ora2 cbnz2 /app/oracle/product/10.2.0/db
DB_UNIQUE_NAME: cbnz
DB_NAME: cbnz
ORACLE_HOME: /app/oracle/product/10.2.0/db
SPFILE: +DATA1/cbnz/spfilecbnz.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED
[oracle@ora1 dbs]$ more initcbnz1.ora
SPFILE='+DATA/cbnz/spfilecbnz.ora'
[oracle@ora1 dbs]$ vi initcbnz1.ora
SPFILE='+DATA1/cbnz/spfilecbnz.ora'
[oracle@ora2 dbs]$ more initcbnz2.ora
SPFILE='+DATA/cbnz/spfilecbnz.ora'
[oracle@ora2 dbs]$ vi initcbnz2.ora
SPFILE='+DATA1/cbnz/spfilecbnz.ora'
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 385876488 bytes
Database Buffers 1207959552 bytes
Redo Buffers 14680064 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA1/cbnz/spfilecbnz.ora
5.5 临时表空间文件的处理
在新位置创建新的临时表空间作为数据库的默认临时表空间
SQL> create temporary tablespace temp01 tempfile '+DATA1' size 200M;
Tablespace created.
SQL> alter database default temporary tablespace temp01;
Database altered.
删除在旧存储上的临时表空间
SQL> alter database default temporary tablespace temp;
Database altered.
查看所有临时文件的存放地
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
+DATA1/cbnz/tempfile/temp.284.880989223
6 旧存储的ASM磁盘组处理
6.1 在两个节点卸载旧存储的磁盘组
SQL> alter diskgroup data dismount;
Diskgroup altered.
SQL> select name,state from gv$asm_diskgroup;
NAME STATE
---------- ----------------------
ARC MOUNTED
DATA1 MOUNTED
DATA DISMOUNTED
DATA1 MOUNTED
ARC MOUNTED
DATA DISMOUNTED
rows selected.
6.2 关闭该卷组的自启动
vi /app/oracle/product/10.2.0/db/dbs/init+ASM1.ora
asm_diskgroups='ARC','DATA1'
vi /app/oracle/product/10.2.0/db/dbs/init+ASM2.ora
asm_diskgroups='ARC','DATA1'
6.3 重新启动集群和资源组
将集群和资源组全部重新启动,检查数据库状态
SQL> select name,state from gv$asm_diskgroup;
NAME STATE
-------------------- ----------------------
ARC MOUNTED
DATA1 MOUNTED
DATA DISMOUNTED
ARC MOUNTED
DATA1 MOUNTED
DATA DISMOUNTED
查看到该磁盘组没有自动启动,数据库的状态完全正常,说明存储迁移成功
[oracle@ora1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....z1.inst application ONLINE ONLINE ora1
ora....z2.inst application ONLINE ONLINE ora2
ora.cbnz.db application ONLINE ONLINE ora2
ora.etax.db application ONLINE ONLINE ora2
ora....x1.inst application ONLINE ONLINE ora1
ora....x2.inst application ONLINE ONLINE ora2
ora....SM1.asm application ONLINE ONLINE ora1
ora....A1.lsnr application ONLINE ONLINE ora1
ora.ora1.gsd application ONLINE ONLINE ora1
ora.ora1.ons application ONLINE ONLINE ora1
ora.ora1.vip application ONLINE ONLINE ora1
ora....SM2.asm application ONLINE ONLINE ora2
ora....A2.lsnr application ONLINE ONLINE ora2
ora.ora2.gsd application ONLINE ONLINE ora2
ora.ora2.ons application ONLINE ONLINE ora2
ora.ora2.vip application ONLINE ONLINE ora2
6.4 删除磁盘组
删除时只能有一个节点挂载该卷组,在挂载该卷组的节点上执行移除操作。
SQL> alter diskgroup data mount;
Diskgroup altered.
SQL> drop diskgroup data including contents;
Diskgroup dropped.
6.5 查看现有磁盘组
SQL> select name from v$asm_diskgroup;
NAME
------------------------------------------------------------
ARC
DATA1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20516214/viewspace-1716360/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20516214/viewspace-1716360/