Oracle单实例下oracle数据库从文件系统迁移到ASM上
来源:互联网 发布:js如何让按钮失效 编辑:程序博客网 时间:2024/05/09 00:41
第一步:启动ASM实例(+ASM)
[oracle@oracle ~]$ export ORACLE_SID=+ASM
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 18 13:25:46 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select instance_name,status from v$instance;
ASM实例已经启动
INSTANCE_NAME STATUS
---------------- ------------
+ASM STARTED
SQL> select instance_name,db_name,status from v$asm_client;
ASM实例上没有数据库连接
no rows selected
SQL> select name,state from v$asm_diskgroup;
ASM磁盘组已经挂载
NAME STATE
------------------------------ -----------
DG MOUNTED
第二步,修改目标数据库(WM)的参数文件(spfile)
[oracle@oracle ~]$ echo $ORACLE_SID WM
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 18 13:33:59 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter control_files;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/app/oracle/oradata/WM/conrol01.ctl, /u01/app/oracle/or adata/WM/control02.ctl, /u01/app/oracle/oradata/WM/control03.ctl
SQL> show parameter db_create_file_dest;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string
SQL> create pfile from spfile;
File created.
SQL> alter system set control_files='+DG' scope=spfile;在spfile中把控制文件的路径修改为ASM磁盘组
System altered.
SQL> alter system set db_create_file_dest='+DG' scope=spfile;同上,修改数据文件的创建路径
System altered.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
第三步,利用RMAN迁移目标数据库(WM)的控制文件和数据文件
[oracle@oracle ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 18 13:38:22 2011 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database (not started)
RMAN> startup nomount;
Oracle instance started Total System Global Area 285212672 bytes Fixed Size 1273276 bytesVariable Size 92275268 bytes Database Buffers 188743680 bytes Redo Buffers 2920448 bytes
RMAN> restore controlfile from '/u01/app/oracle/oradata/WM/control01.ctl';利用文件系统上的控制文件重建控制文件到ASM磁盘组DG上
Starting restore at 18-JAN-11 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=+DG/wm/controlfile/current.256.740756507 Finished restore at 18-JAN-11
RMAN> alter database mount;
database mounted released channel: ORA_DISK_1
RMAN> run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup as copy database format '+DG';
} 利用RMAN复制数据文件到ASM磁盘组DG上
allocated channel: c1 channel c1: sid=156 devtype=DISK
allocated channel: c2 channel c2: sid=152 devtype=DISK
Starting backup at 18-JAN-11 channel c1: starting datafile copy input datafile fno=00001 name=/u01/app/oracle/oradata/WM/system01.dbf channel c2: starting datafile copy input datafile fno=00003 name=/u01/app/oracle/oradata/WM/sysaux01.dbf output filename=+DG/wm/datafile/sysaux.258.740756731 tag=TAG20110118T134523 recid=2 stamp=740757197 channel c2: datafile copy complete, elapsed time: 00:07:58channel c2: starting datafile copy input datafile fno=00005 name=/u01/app/oracle/oradata/WM/example01.dbf output filename=+DG/wm/datafile/system.257.740756727 tag=TAG20110118T134523 recid=3 stamp=740757268 channel c1: datafile copy complete, elapsed time: 00:09:09 channel c1: starting datafile copy input datafile fno=00002 name=/u01/app/oracle/oradata/WM/undotbs01.dbf output filename=+DG/wm/datafile/example.259.740757205 tag=TAG20110118T134523 recid=4 stamp=740757287 channel c2: datafile copy complete, elapsed time: 00:01:30channel c2: starting datafile copy input datafile fno=00004 name=/u01/app/oracle/oradata/WM/users01.dbf output filename=+DG/wm/datafile/undotbs1.260.740757277 tag=TAG20110118T134523 recid=6 stamp=740757304channel c1: datafile copy complete, elapsed time: 00:00:32 output filename=+DG/wm/datafile/users.261.740757299 tag=TAG20110118T134523 recid=5 stamp=740757303 channel c2: datafile copy complete, elapsed time: 00:00:12Finished backup at 18-JAN-11
Starting Control File and SPFILE Autobackup at 18-JAN-11 piece handle=/u01/app/oracle/flash_recovery_area/WM/autobackup/2011_01_18/o1_mf_s_737250559_6mbbsvw6_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 18-JAN-11 released channel: c1 released channel: c2
RMAN> switch database to copy; 利用RMAN的SWITCH 命令修改控制文件内数据文件的指针,使其指向新位置
datafile 1 switched to datafile copy "+DG/wm/datafile/system.257.740756727" datafile 2 switched to datafile copy "+DG/wm/datafile/undotbs1.260.740757277" datafile 3 switched to datafile copy "+DG/wm/datafile/sysaux.258.740756731" datafile 4 switched to datafile copy "+DG/wm/datafile/users.261.740757299" datafile 5 switched to datafile copy "+DG/wm/datafile/example.259.740757205"
RMAN> recover database;
Starting recover at 18-JAN-11 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=156 devtype=DISK
starting media recovery media recovery complete, elapsed time: 00:00:01
Finished recover at 18-JAN-11
RMAN> alter database open;
database opened
第四步,迁移tempfile到ASM磁盘组DG上
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 18 14:01:09 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
WM OPEN
SQL> select name,status,enabled from v$tempfile;
NAME STATUS ENABLED
---------------------------------------- ------- ----------
/u01/app/oracle/oradata/WM/temp01.dbf ONLINE READ WRITE
SQL> alter tablespace temp add tempfile '+DG';
Tablespace altered.
SQL> alter tablespace temp drop tempfile '/u01/app/oracle/oradata/WM/temp01.dbf';
Tablespace altered.
SQL> select name,status,enabled from v$tempfile;
NAME STATUS ENABLED
---------------------------------------- ------- ----------
+DG/wm/tempfile/temp.262.740757907 ONLINE READ WRITE
第五步,迁移redo logfile到ASM磁盘组DG上
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
3 6 /u01/app/oracle/oradata/WM/redo03.log CURRENT NO
2 5 /u01/app/oracle/oradata/WM/redo02.log INACTIVE YES
1 4 /u01/app/oracle/oradata/WM/redo01.log INACTIVE YES
SQL> alter database add logfile '+DG' size 10M;
Database altered.
SQL> alter database add logfile '+DG' size 10M;
Database altered.
SQL> alter database add logfile '+DG' size 10M; 添加三个redolog组到ASM磁盘组DG上
Database altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
3 6 /u01/app/oracle/oradata/WM/redo03.log CURRENT NO
2 5 /u01/app/oracle/oradata/WM/redo02.log INACTIVE YES
1 4 /u01/app/oracle/oradata/WM/redo01.log INACTIVE YES
4 0 +DG/wm/onlinelog/group_4.263.740758405 UNUSED YES
5 0 +DG/wm/onlinelog/group_5.264.740758423 UNUSED YES
6 0 +DG/wm/onlinelog/group_6.265.740758425 UNUSED YES
6 rows selected.
SQL> alter database drop logfile '/u01/app/oracle/oradata/WM/redo02.log';
Database altered.
SQL> alter database drop logfile '/u01/app/oracle/oradata/WM/redo01.log';删除文件系统上的redolog组
Database altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
3 6 /u01/app/oracle/oradata/WM/redo03.log CURRENT NO
4 0 +DG/wm/onlinelog/group_4.263.740758405 UNUSED YES
5 0 +DG/wm/onlinelog/group_5.264.740758423 UNUSED YES
6 0 +DG/wm/onlinelog/group_6.265.740758425 UNUSED YES
SQL> alter system switch logfile;
System altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
3 6 /u01/app/oracle/oradata/WM/redo03.log ACTIVE NO
4 7 +DG/wm/onlinelog/group_4.263.740758405 CURRENT NO
5 0 +DG/wm/onlinelog/group_5.264.740758423 UNUSED YES
6 0 +DG/wm/onlinelog/group_6.265.740758425 UNUSED YES
SQL> alter system checkpoint;
System altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
3 6 /u01/app/oracle/oradata/WM/redo03.log INACTIVE NO
4 7 +DG/wm/onlinelog/group_4.263.740758405 CURRENT NO
5 0 +DG/wm/onlinelog/group_5.264.740758423 UNUSED YES
6 0 +DG/wm/onlinelog/group_6.265.740758425 UNUSED YES
SQL> alter database drop logfile group 3;
Database altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
4 7 +DG/wm/onlinelog/group_4.263.740758405 CURRENT NO
5 0 +DG/wm/onlinelog/group_5.264.740758423 UNUSED YES
6 0 +DG/wm/onlinelog/group_6.265.740758425 UNUSED YES
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select l.group#,l.sequence#,f.member as name,l.status,l.archived from v$log l,v$logfile f where f.group#=l.group#;
GROUP# SEQUENCE# NAME STATUS ARC
---------- ---------- ---------------------------------------- ---------------- ---
4 7 +DG/wm/onlinelog/group_4.263.740758405 ACTIVE NO
5 8 +DG/wm/onlinelog/group_5.264.740758423 ACTIVE NO
6 9 +DG/wm/onlinelog/group_6.265.740758425 CURRENT NO
第六步,删除文件系统上的数据文件
[oracle@oracle oradata]$ cd $ORACLE_BASE/oradata
[oracle@oracle oradata]$ ls WM
[oracle@oracle oradata]$ rm -rf WM/
[oracle@oracle oradata]$ ls
- Oracle单实例下oracle数据库从文件系统迁移到ASM上
- 单实例oracle从文件系统迁移到ASM
- Oracle数据库有文件系统迁移到ASM
- oracle从单实例数据库迁移到RAC数据库
- oracle 11g asm单实例迁移文件系统
- 数据库迁移-从文件系统到ASM
- 数据库迁移-从ASM到文件系统
- 把数据库从文件系统迁移到ASM
- 数据库从文件系统迁移到ASM
- oracle 10.2.0.4 rac(ASM) 恢复到单实例文件系统
- oracle 异机恢复 从asm到文件系统成功实例
- 把数据库从asm迁移到文件系统,完全卸载asm实例。
- Oracle rac asm数据库恢复到单实例数据库
- Oracle rac asm数据库恢复到单实例数据库
- 利用RMAN将数据库从文件系统迁移到ASM
- 利用RMAN将数据库从文件系统迁移到ASM
- 将数据库从普通文件系统迁移到ASM中
- oracle 11g R2 单实例 ASM 数据库数据磁盘组迁移
- 修改Mysql编码
- Request.ServerVariables("HTTP_USER_AGENT")
- android获取图片文件头信息
- hdu2141
- 内核 API,第 2 部分:可延迟函数、内核微线程以及工作队列
- Oracle单实例下oracle数据库从文件系统迁移到ASM上
- AMD和NVIDIA之间的显卡战争
- ceph 资料
- RPC JNDI
- 简单返回顶部代码及注释说明(转)
- poj 1038 Bugs Integrated, Inc.
- public static Bitmap zoomIn(Bitmap bitmap, int maxW, int maxH)
- OCP-043 alter diskgroup power
- 二 : using声明、using指示用于嵌套命名空间时的作用域