HPUNIX下表空間檔案系統到裸裝置測試

guyuanli發表於2010-08-26
建立裸裝置
# 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[@more@]

# 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/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/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.從檔案系統移動到裸裝置上
/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.
/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.
/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

最後把檔案系統的檔案手工刪除
/dev/vg00 $ cd /oracle/app/
/oracle/app $ ls
admin cfgtoollogs diag eygle01.dbf gutest.dbf product
/oracle/app $ rm gutest.dbf

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7490392/viewspace-1037428/,如需轉載,請註明出處,否則將追究法律責任。

相關文章