本文推荐另外一种方法,可以做一个折中,以下是一个简单的步骤说明:
1.将表空间置于只读
只读状态可以使数据仍然可为用户访问.
alter tablespacetablespace_nameread only;
2.物理拷贝文件
3.将表空间offline
alter tablespace
tablespace_nameoffline;
4.rename数据文件
alter database rename file
'old_dir_file'to
'new_dir_file';
5.将表空间联机
alter tablespace
tablespace_nameonline;
6.将表空间置于read write模式
alter tablespace
tablespace_nameread write;
以下是示范步骤:
1.将表空间置于只读状态
[oracle@jumper oracle]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Nov 12 21:10:49 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 7
Next log sequence to archive 10
Current log sequence 10
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------
/opt/oracle/oradata/conner/system01.dbf
/opt/oracle/oradata/conner/undotbs01.dbf
/opt/oracle/oradata/conner/users01.dbf
SQL> alter tablespace users read only;
Tablespace altered. |
2.物理拷贝文件
SQL> ! cp /opt/oracle/oradata/conner/users01.dbf /opt/oracle/oradata/users01.dbf |
3.将表空间脱机
SQL> alter tablespace users offline;
Tablespace altered. |
4.修改文件名称
SQL> alter database rename file '/opt/oracle/oradata/conner/users01.dbf' to '/opt/oracle/oradata/users01.dbf';
Database altered. |
5.将表空间联机
SQL> alter tablespace users online;
Tablespace altered. |
6.将表空间置于读写状态
SQL> alter tablespace users read write;
Tablespace altered.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------
/opt/oracle/oradata/conner/system01.dbf
/opt/oracle/oradata/conner/undotbs01.dbf
/opt/oracle/oradata/users01.dbf
SQL> |
阅读(1056) | 评论(0) | 转发(0) |