如何通过RMAN进行裸设备和文件系统之间的数据文件迁移

如何通过RMAN进行裸设备和文件系统之间的数据文件迁移,第1张

1.使用裸设备建立EYGLE测试表空间

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

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 30 14:41:53 2005

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, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>create tablespace eygle

2 datafile '/dev/cciss/c0d0p11' size 10M

Tablespace created.

SQL>create table eygle tablespace eygle as select * from dba_objects

Table created.

SQL>select count(*) from eygle

COUNT(*)

----------

50420

SQL>alter tablespace eygle offline

Tablespace altered.

SQL>exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

2.使用RMAN的COPY功能备份裸设备文件文件系统文件

[oracle@danaly ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Nov 30 16:00:42 2005

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

connected to target database: DANALY (DBID=3965153484)

RMAN>copy datafile '/dev/cciss/c0d0p11' to '/opt/oracle/eygle01.dbf'

Starting backup at 30-NOV-05

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=137 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00002 name=/dev/cciss/c0d0p11

output filename=/opt/oracle/eygle01.dbf tag=TAG20051130T160137 recid=2 stamp=575740898

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02

Finished backup at 30-NOV-05

RMAN>exit

Recovery Manager complete.

3.通过rename修改文件位置

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

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 30 16:01:54 2005

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, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>alter database rename file '/dev/cciss/c0d0p11' to '/opt/oracle/eygle01.dbf'

Database altered.

SQL>alter tablespace eygle online

Tablespace altered.

SQL>select file_name from dba_data_files where tablespace_name='EYGLE'

FILE_NAME

--------------------------------------------------------------------------------

/opt/oracle/eygle01.dbf

4.进行数据修改

SQL>insert into eygle as select * from eygle

insert into eygle as select * from eygle

*

ERROR at line 1:

ORA-00926: missing VALUES keyword

SQL>insert into eygle select * from eygle

insert into eygle select * from eygle

*

ERROR at line 1:

ORA-01653: unable to extend table SYS.EYGLE by 128 in tablespace EYGLE

SQL>alter database datafile '/opt/oracle/eygle01.dbf' resize 20m

Database altered.

SQL>insert into eygle select * from eygle

50420 rows created.

SQL>commit

Commit complete.

SQL>alter tablespace eygle offline

Tablespace altered.

SQL>exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

5.从文件系统迁移文件至裸设备

[oracle@danaly ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Nov 30 16:08:51 2005

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

connected to target database: DANALY (DBID=3965153484)

RMAN>copy datafile '/opt/oracle/eygle01.dbf' to '/dev/cciss/c0d0p11'

Starting backup at 30-NOV-05

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=135 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00002 name=/opt/oracle/eygle01.dbf

output filename=/dev/cciss/c0d0p11 tag=TAG20051130T160935 recid=3 stamp=575741376

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 30-NOV-05

RMAN>exit

Recovery Manager complete.

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

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Nov 30 16:09:48 2005

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, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>alter database rename file '/opt/oracle/eygle01.dbf' to '/dev/cciss/c0d0p11'

Database altered.

SQL>alter tablespace eygle online

Tablespace altered.

SQL>select count(*) from eygle

COUNT(*)

----------

100840

SQL>

rman使得对于裸设备的 *** 作大大简化。

变成裸设备后分区上的内容将被清除

编辑/etc/udev/rules.d/60-raw.rules,加入如下内容:

ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="16",RUN+="/bin/raw/dev/raw/raw1 %M %m"

ACTION=="add",KERNEL=="sdb",RUN+="/bin/raw /dev/raw/raw1 %N"

KERNEL=="raw[1]",OWNER="oracle", GROUP="oinstall", MODE="640

其中MAJOR、MINOR和KERNEL的值根据实际情况填写。权限部分我用oracle做了示例,可根据情况修改。

使用start_udev使设置生效,此时会在/dev/raw/下生成相应的raw1文件,该文件即裸设备

格式化裸设备(大小按照2T设计,耗时可能相当长!!):dd if=/dev/zero of=/dev/raw/raw1 bs=2M count=1048576

完成

sybase数据库文件系统需要哪些裸设备

一、 裸设备分区方法 使用 yast2 工具对系统剩余空间进行分区,分区时每个分区设成

二、裸设备绑定方法 1、可以手工绑定裸设备 raw /dev/raw/raw1 /dev/sda5 raw /dev/.

三、其他裸设备命令 1、删除裸设备 #raw /dev/raw/raw1 0 0 #raw /dev/raw/raw2 0 0

四、数据库配置 1、disk init name="dev1",physname="/dev/raw/raw1",vdevno= .


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11513631.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存