ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 迁移数据库到ASM

迁移数据库到ASM

原创 Linux操作系统 作者:westzq1984 时间:2009-08-27 13:27:30 0 删除 编辑

有个迁移到ASM存储的需求,今天研究了

觉得用RMAN的COPY+SWITCH应该是个能最短化停机时间的方法

下面记录下过程

SYS@SOURCE10 > select file# from v$datafile;

     FILE#
----------
         1
         2
         3
         5
         6

copy datafile 1 to '+DG1';
copy datafile 2 to '+DG1';
copy datafile 3 to '+DG1';
copy datafile 5 to '+DG1';
copy datafile 6 to '+DG1';

shutdown immediate;
startup mount

switch database to copy;

alter database add logfile group 4 ('+DG1');
alter database add logfile group 5 ('+DG1');
alter database add logfile group 6 ('+DG1');

copy current controlfile to '+DG1';
alter system set control_files='+DG1/source10/controlfile/backup.261.695999269' scope=spfile;

shutdown immediate;
startup mount;
recover database;
alter database open resetlogs;

SYS@SOURCE10 > select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1          1   52428800          1 NO  CURRENT                3117688 2009-08-27 13:11:09
         2          1          0   52428800          1 YES UNUSED                       0
         3          1          0   52428800          1 YES UNUSED                       0
         4          1          0  104857600          1 YES UNUSED                       0
         5          1          0  104857600          1 YES UNUSED                       0
         6          1          0  104857600          1 YES UNUSED                       0
        
alter system archive log current ;
alter system archive log current ;
alter system archive log current ;
alter system archive log current ;
alter system archive log current ;

SYS@SOURCE10 > select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1          1   52428800          1 YES ACTIVE                 3117688 2009-08-27 13:11:09
         2          1          2   52428800          1 YES ACTIVE                 3117986 2009-08-27 13:15:40
         3          1          3   52428800          1 YES ACTIVE                 3117989 2009-08-27 13:15:42
         4          1          4  104857600          1 YES ACTIVE                 3118000 2009-08-27 13:15:44
         5          1          5  104857600          1 YES ACTIVE                 3118033 2009-08-27 13:16:51
         6          1          6  104857600          1 NO  CURRENT                3118038 2009-08-27 13:16:53

alter database drop logfile group 1;
alter database drop logfile group 2;
alter database drop logfile group 3;

CREATE SMALLFILE TEMPORARY TABLESPACE TMP TEMPFILE '+DG1' SIZE 20M;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TMP;

drop tablespace temp;

SYS@SOURCE10 > select name from v$datafile
  2  union all
  3  select name from v$tempfile;

NAME
--------------------------------------------------------
+DG1/source10/datafile/system.258.695998419
+DG1/source10/datafile/undotbs1.257.695998465
+DG1/source10/datafile/sysaux.256.695998483
+DG1/source10/datafile/zhangqiaoc.259.695998517
+DG1/source10/datafile/zhangqiaoc_test.260.695998543
+DG1/source10/tempfile/tmp.265.696000131

SYS@SOURCE10 > select member from v$logfile;

MEMBER
--------------------------------------------------------
+DG1/source10/onlinelog/group_4.262.695999173
+DG1/source10/onlinelog/group_5.263.695999213
+DG1/source10/onlinelog/group_6.264.695999221


SYS@SOURCE10 > SELECT NAME FROM v$controlfile;

NAME
--------------------------------------------------------
+DG1/source10/controlfile/backup.261.695999269

停机时间应该主要是恢复的时间

日志文件,临时文件这些都是可以联机做的。不过测试的时候没想到这些

以前的数据文件可以catalog下进来当备份用

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8242091/viewspace-613388/,如需转载,请注明出处,否则将追究法律责任。

上一篇: Easy Connect Naming
请登录后发表评论 登录
全部评论

注册时间:2009-04-06

  • 博文量
    251
  • 访问量
    948907