10g 文件系统与ASM系统的切换

12 篇文章 0 订阅
9 篇文章 0 订阅

Asm磁盘组:

SQL> select name from V$asm_diskgroup;

NAME

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

ASMDATA1

查看数据文件

SQL> select name from V$datafile;

NAME

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

/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf

 

7 rows selected.

1.将普通数据文件转换为ASM管理

[oracle@dbserver1 ~]$ rman target /

RMAN> backup as copy datafile '/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf' format '+ASMDATA1'

2> ;

 

Starting backup at 30-APR-12

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=133 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00007 name=/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf

output filename=+ASMDATA1/dboms/datafile/tan.256.781970009 tag=TAG20120430T135323 recid=1 stamp=781970010

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

Finished backup at 30-APR-12

RMAN> switch datafile '/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf' to copy;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of switch to copy command at 04/30/2012 13:55:24

RMAN-06572: database is open and datafile 7 is not offline

RMAN>

SQL> alter tablespace tan offline;

Tablespace altered.

RMAN> switch datafile '/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf' to copy;

datafile 7 switched to datafile copy "+ASMDATA1/dboms/datafile/tan.256.781970009"

SQL> alter tablespace tan online;

Tablespace altered.

SQL> select name from V$datafile;

NAME

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

/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

+ASMDATA1/dboms/datafile/tan.256.781970009

 

7 rows selected.

 

2.切换系统表空间文件为ASM管理:

RMAN> report schema;

 

Report of database schema

 

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

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

1    530      SYSTEM               ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf

2    175      UNDOTBS1             ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

3    230      SYSAUX               ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

4    5        USERS                ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

5    240      MGMT_TABLESPACE      ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

6    100      MGMT_ECM_DEPOT_TS    ***     /apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

7    10       TAN                  ***     +ASMDATA1/dboms/datafile/tan.256.781970009

 

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

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

1    20       TEMP                 32767       /apps/oracle/product/10.2.0/db_1/oradata/dboms/temp01.dbf

 

RMAN> backup as copy datafile

'/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf' format '+ASMDATA1';

Starting backup at 30-APR-12

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/30/2012 13:57:42

ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

continuing other job steps, job failed will not be re-run

channel ORA_DISK_1: starting datafile copy

copying current control file

output filename=+ASMDATA1/dboms/controlfile/backup.257.781970263 tag=TAG20120430T135742 recid=3 stamp=781970263

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

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current SPFILE in backupset

channel ORA_DISK_1: starting piece 1 at 30-APR-12

channel ORA_DISK_1: finished piece 1 at 30-APR-12

piece handle=+ASMDATA1/dboms/backupset/2012_04_30/nnsnf0_tag20120430t135742_0.258.781970263 tag=TAG20120430T135742 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

 

RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/30/2012 13:57:42

ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

先设置为归档模式

RMAN> backup as copy

datafile '/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf' format '+ASMDATA1';

 

Starting backup at 30-APR-12

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=131 devtype=DISK

channel ORA_DISK_1: starting datafile copy

input datafile fno=00001 name=/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf

output filename=+ASMDATA1/dboms/datafile/system.259.781971143 tag=TAG20120430T141223 recid=4 stamp=781971170

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

channel ORA_DISK_1: starting datafile copy

copying current control file

output filename=+ASMDATA1/dboms/controlfile/backup.260.781971179 tag=TAG20120430T141223 recid=5 stamp=781971178

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

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current SPFILE in backupset

channel ORA_DISK_1: starting piece 1 at 30-APR-12

channel ORA_DISK_1: finished piece 1 at 30-APR-12

piece handle=+ASMDATA1/dboms/backupset/2012_04_30/nnsnf0_tag20120430t141223_0.261.781971179 tag=TAG20120430T141223 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 30-APR-12

mount状态下切换

SQL> startup mount;

RMAN> switch datafile '/apps/oracle/product/10.2.0/db_1/oradata/dboms/system01.dbf' to copy;

 

using target database control file instead of recovery catalog

datafile 1 switched to datafile copy "+ASMDATA1/dboms/datafile/system.259.781971143"

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01113: file 1 needs media recovery

ORA-01110: data file 1: '+ASMDATA1/dboms/datafile/system.259.781971143'

 

 

SQL> recover datafile 1;

Media recovery complete.

SQL> alter database open;

 

Database altered.

 

SQL> select name from V$datafile;

 

NAME

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

+ASMDATA1/dboms/datafile/system.259.781971143

/apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

+ASMDATA1/dboms/datafile/tan.256.781970009

 

7 rows selected.

 

SQL>

 

3.ASM文件切换成普通文件

SQL> select name from V$datafile;

 

NAME

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

+ASMDATA1/dboms/datafile/system.259.781971143

/apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

+ASMDATA1/dboms/datafile/tan.256.781970009

 

备份:

RMAN> backup as copy datafile '+ASMDATA1/dboms/datafile/tan.256.781970009' format '/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf';

 

Starting backup at 30-APR-12

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile fno=00007 name=+ASMDATA1/dboms/datafile/tan.256.781970009

output filename=/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf tag=TAG20120430T151025 recid=7 stamp=781974626

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

Finished backup at 30-APR-12

离线

SQL> alter tablespace tan offline;

切换

RMAN> switch datafile '+ASMDATA1/dboms/datafile/tan.256.781970009' to copy;

Online

SQL> alter tablespace tan online;

SQL> select name from V$datafile;

 

NAME

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

+ASMDATA1/dboms/datafile/system.259.781971143

/apps/oracle/product/10.2.0/db_1/oradata/dboms/undotbs01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/sysaux01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/users01.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/mgmt_ecm_depot1.dbf

/apps/oracle/product/10.2.0/db_1/oradata/dboms/tan01.dbf

 

7 rows selected.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值