文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

如何利用rman copy的方法实现存储上裸设备数据文件的迁移ITPUB

2024-04-02 19:55

关注

小编给大家分享一下如何利用rman copy的方法实现存储上裸设备数据文件的迁移ITPUB,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

利用rman copy的方法实现存储上裸设备数据文件的迁移ITPUB
背景:有时为了应用的需要,不得不把一些裸设备数据文件迁移到新的存储上或者更快的存储上来满足应用的要求。
下面就是实验来测试控制文件,数据文件,临时数据文件,redo文件迁移到新的存储方法

[oracle@single ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 02:56:14 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


SQL> select name from v$controlfile;

NAMEITPUB
--------------------------------------------------------------------------------
/dev/raw/raw2
/dev/raw/raw3

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/dev/raw/raw7
/dev/raw/raw11
/dev/raw/raw10
/dev/raw/raw9

SQL> select name from v$tempfile;

NAME
-------------------------------------------------------------------------------
/dev/raw/raw8

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/dev/raw/raw4
/dev/raw/raw5
1.建好和原来裸设备一样大小的lv,建议比原来lv大一些 配制好权限 属性为oracle:dba
 1.1原来存储的控制文件     新存储的控制文件          
/dev/raw/raw2            /dev/raw/raw22
/dev/raw/raw3            /dev/raw/raw23
1.2原来存储的数据文件     新存储的数据文件
   /dev/raw/raw7            /dev/raw/raw27
   /dev/raw/raw11           /dev/raw/raw31
   /dev/raw/raw10           /dev/raw/raw30
   /dev/raw/raw9            /dev/raw/raw29
 1.3原来存储的日志文件    新存储的日志文件
   /dev/raw/raw4            /dev/raw/raw24           
   /dev/raw/raw5            /dev/raw/raw25
1.4原来存储的临时文件    新存储的临时文件
  /dev/raw/raw8            /dev/raw/raw28
2. 迁移数据文件到新的存储上

2.1 启动数据库到mount状态
SQL> startup mount
ORACLE instance started.

Total System Global Area  192937984 bytes
Fixed Size                  1260840 bytes
Variable Size              67109592 bytes
Database Buffers          121634816 bytes
Redo Buffers                2932736 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

2.2 用rman target /方式进入
[oracle@single ~]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:24:27 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1213870770, not open)

RMAN> copy datafile '/dev/raw/raw7' to '/dev/raw/raw27';

Starting backup at 06-5月 -09

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1I
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00001 name=/dev/raw/raw7
output filename=/dev/raw/raw27 tag=TAG20090506T032607 recid=1 stamp=686114794
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35

Finished backup at 06-5月 -09

RMAN> copy datafile '/dev/raw/raw9' to '/dev/raw/raw29';

Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/dev/raw/raw9
output filename=/dev/raw/raw29 tag=TAG20090506T032716 recid=2 stamp=686114837
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02
Finished backup at 06-5月 -09

RMAN> copy datafile '/dev/raw/raw10' to '/dev/raw/raw30';

Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy

input datafile fno=00003 name=/dev/raw/raw10
output filename=/dev/raw/raw30 tag=TAG20090506T032746 recid=3 stamp=686114875
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:16

Finished backup at 06-5月 -09

RMAN> copy datafile '/dev/raw/raw11' to '/dev/raw/raw31';

Starting backup at 06-5月 -09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy

input datafile fno=00002 name=/dev/raw/raw11
output filename=/dev/raw/raw31 tag=TAG20090506T032822 recid=4 stamp=686114915
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 06-5月 -09

RMAN>2.3 进入sqlplus,更改文件名写入到控制文件中

[oracle@single ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:29:28 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database rename file '/dev/raw/raw7' to '/dev/raw/raw27';

Database altered.

SQL>  alter database rename file '/dev/raw/raw9' to '/dev/raw/raw29';

Database altered.

SQL> alter database rename file '/dev/raw/raw10' to '/dev/raw/raw30';

Database altered.

SQL> alter database rename file '/dev/raw/raw11' to '/dev/raw/raw31';

Database altered.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/dev/raw/raw27
/dev/raw/raw31
/dev/raw/raw30
/dev/raw/raw29

SQL> alter database open;

Database altered.

SQL>

迁移数据文件到新的存储上成功

3.迁移控制文件到新的存储上

3.1.备份控制文件
startup mount
RMAN> backup current controlfile format '/home/oracle/crontrol.bak';

Starting backup at 06-5月 -09
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: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 06-5月 -09
channel ORA_DISK_1: finished piece 1 at 06-5月 -09
piece handle=/home/oracle/crontrol.bak tag=TAG20090506T033405 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 06-5月 -09

3.2.关闭库修改控制文件参数文件
sqlplus "/as sysdba"
shutdown immediate
create pfile from spfile;
[oracle@single dbs]$ vi initorcl.ora

###########################################
control_files=("/dev/raw/raw22", "/dev/raw/raw23")
指向新的参数文件lv,并且保存

create spfile from pfile;
QL> startup nomount;
ORACLE instance started.

Total System Global Area  192937984 bytes
Fixed Size                  1260840 bytes
Variable Size              67109592 bytes
Database Buffers          121634816 bytes
Redo Buffers                2932736 bytes
SQL> show parameter cont

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time        integer
#A2I4_6K F07
control_files                        string
/dev/raw/raw22, /dev/raw/raw23
global_context_pool_size             string

3.3恢复控制文件到新的存储上,并且mount和用resetlogs方式打开数据库
[oracle@single dbs]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:38:47 2009

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

RMAN> restore controlfile from '/home/oracle/crontrol.bak';

Starting restore at 06-5月 -09
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/dev/raw/raw22
output filename=/dev/raw/raw23
Finished restore at 06-5月 -09

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> alter database open resetlogs;

database opened

[oracle@single dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on 星期三 5月 6 03:42:02 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/dev/raw/raw22
/dev/raw/raw23

可以看到控制文件迁移到新的存储上已经成功

4.迁移redo文件到新的存储上

SQL>alter database add logfile '/dev/raw/raw24' size 50m;

Database altered.

SQL>alter database add logfile '/dev/raw/raw25' size 50m;

Database altered
QL> alter database drop logfile group 1;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/dev/raw/raw24
/dev/raw/raw25

SQL>

可以看到redo已经迁移到新的存储上

 
5.迁移临时数据文件


SQL> create TEMPORARY TABLESPACE temp1 tempfile '/oradata/temp01.dbf' size 50m;

Tablespace created.

alter database default temporary tablespace TEMP1;


drop TABLESPACE TEMP;

CREATE TEMPORARY TABLESPACE TEMP TEMPFILE
  '/dev/raw/raw28' SIZE 500M AUTOEXTEND OFF

EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M
BLOCKSIZE 8K;


SQL> alter database default temporary tablespace TEMP;

Database altered.

SQL> drop tablespace temp1;

Tablespace dropped.

SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/dev/raw/raw28

SQL>

看完了这篇文章,相信你对“如何利用rman copy的方法实现存储上裸设备数据文件的迁移ITPUB”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯