且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SOLARS AIX LINUX 下移动数据库文件到裸设备

更新时间:2022-08-14 14:57:31

SOLARS AIX LINUX 下移动数据库文件到裸设备
SOLARIS:
 SQL> create tablespace test1
  2  datafile '/oradata/ora11g/test01.dbf' size 100m ;

Tablespace created.

SQL> create table testpp
  2  tablespace test1
  3  as
  4  select * from dba_users;

Table created.

SQL> alter tablespace 
  2  
SQL> 
SQL> alter datafile 
  2  
SQL> 
SQL> alter database datafile '/oradata/ora11g/test01.dbf' offline;

Database altered.



SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-bash-3.2$ cd /disk
-bash-3.2$ ls -l
total 2
lrwxrwxrwx   1 root     root          18 Jun 26 15:51 test01 -> /dev/rdsk/c1t1d0s0
-bash-3.2$ dd if=/oradata/ora11g/test01.dbf of=/disk/test01 bs=1024k
100+1 records in
100+1 records out
-bash-3.2$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Wed Jun 26 16:00:08 2013

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


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

SQL> alter database rename file '/oradata/ora11g/test01.dbf' to '/disk/test01';

Database altered.

SQL> recover datafile '/disk/test01';
Media recovery complete.
SQL> alter database datafile '/disk/test01' online;

Database altered.

SQL> select count(*) from testpp;

  COUNT(*)
----------
        20
也可以使用OFFLINE TABLESPACE来做