ITPub博客

首页 > Linux操作系统 > Linux操作系统 > HP UNIX 下表空间文件系统到裸设备测试

HP UNIX 下表空间文件系统到裸设备测试

原创 Linux操作系统 作者:维在北京 时间:2010-12-31 11:01:05 0 删除 编辑

HPUNIX下表空间文件系统到裸设备测试
===========================================================


创建裸设备
# lvcreate -L 1024 -n lvtest vg00
Logical volume "/dev/vg00/lvtest" has been successfully created with
character device "/dev/vg00/rlvtest".
Logical volume "/dev/vg00/lvtest" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# ls -l | grep test
brw-r----- 1 root sys 64 0x000014 Aug 17 19:20 lvtest
crw-r----- 1 root sys 64 0x000014 Aug 17 19:20 rlvtest
#chown oracle:dba rlvtest
# ls -l | grep test
brw-r----- 1 root sys 64 0x000014 Aug 17 19:20 lvtest
crw-r----- 1 oracle dba 64 0x000014 Aug 17 19:20 rlvtest

1.先从裸设备移动到文件系统上
SQL> alter tablespace guyuanli offline;

Tablespace altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@cp-cs02 /oracle/app/product/11.1.0/db_1/network/admin $ rman target /

Recovery Manager: Release 11.1.0.7.0 - Production on Wed Aug 18 11:51:34 2010

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

connected to target database: TSDB (DBID=3914389360)

RMAN> copy datafile '/dev/vg00/rlvtest' to '/oracle/app/gutest.dbf';

Starting backup at 18-AUG-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1556 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00077 name=/dev/vg00/rlvtest
output file name=/oracle/app/gutest.dbf tag=TAG20100818T115303 RECID=2 STAMP=727357987
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 18-AUG-10

RMAN> exit


Recovery Manager complete.
oracle@cp-cs02 /oracle/app/product/11.1.0/db_1/network/admin $ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Aug 18 11:53:22 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database rename file '/dev/vg00/rlvtest' to '/oracle/app/gutest.dbf';

Database altered.

SQL> alter tablespace guyuanli online;

Tablespace altered.

SQL> select count(*) from guyuanli;

COUNT(*)
----------
71399

2.从文件系统移动到裸设备上
oracle@cp-cs02 /dev/vg00 $ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Aug 18 12:13:08 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter tablespace guyuanli offline;

Tablespace altered.
oracle@cp-cs02 /dev/vg00 $ rman target /

Recovery Manager: Release 11.1.0.7.0 - Production on Wed Aug 18 12:15:17 2010

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

connected to target database: TSDB (DBID=3914389360)

RMAN> copy datafile '/oracle/app/gutest.dbf' to '/dev/vg00/rlvtest';

Starting backup at 18-AUG-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1553 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00077 name=/oracle/app/gutest.dbf
output file name=/dev/vg00/rlvtest tag=TAG20100818T121532 RECID=3 STAMP=727359332
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-AUG-10

RMAN> exit


Recovery Manager complete.
oracle@cp-cs02 /dev/vg00 $ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Wed Aug 18 12:15:58 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database rename file '/oracle/app/gutest.dbf' to '/dev/vg00/rlvtest';

Database altered.

SQL> alter tablespace guyuanli online;

Tablespace altered.

SQL> select count(*) from guyuanli;

COUNT(*)
----------
71399

最后把文件系统的文件手工删除
oracle@cp-cs02 /dev/vg00 $ cd /oracle/app/
oracle@cp-cs02 /oracle/app $ ls
admin cfgtoollogs diag eygle01.dbf gutest.dbf product
oracle@cp-cs02 /oracle/app $ rm gutest.dbf

 

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

上一篇: HPMC集群手工切换
下一篇: linux_不常用命令
请登录后发表评论 登录
全部评论

注册时间:2010-12-31

  • 博文量
    50
  • 访问量
    98224