Chinaunix首页 | 论坛 | 博客
  • 博客访问: 771535
  • 博文数量: 803
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 5015
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-28 10:29
文章分类

全部博文(803)

文章存档

2011年(1)

2008年(802)

我的朋友

分类:

2008-10-29 11:31:56


  如果数据库处于非归档模式下,可以通过如下步骤更改文件路径:
  
  1.关闭数据库
  
  2.系统级进行文件复制
  
  3.启动数据库到mount状态
  
  3.通过SQL修改数据文件位置
  
  4.打开数据库
  
  以下是实际操作的步骤示范:
  
  1.数据库处于非归档模式
  
  SQL> archive log list;
  Database log mode       No Archive Mode
  Automatic archival       Enabled
  Archive destination      /opt/oracle/oradata/conner/archive
  Oldest online log sequence   150
  Current log sequence      153
  
  2.需要移动test.dbf文件
  
  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
  /opt/oracle/test.dbf
  
  3.关闭数据库
  
  SQL> shutdown immediate;
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  
  4.复制文件到新的位置
  
  SQL> ! cp /opt/oracle/test.dbf /opt/oracle/oradata/conner/test.dbf
  
  5.启动数据库到mount状态
  
  SQL> startup mount;
  ORACLE instance started.
  
  Total System Global Area 101782828 bytes
  Fixed Size          451884 bytes
  Variable Size       37748736 bytes
  Database Buffers      62914560 bytes
  Redo Buffers         667648 bytes
  Database mounted.
  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
  /opt/oracle/test.dbf
  
  6.修改文件位置
  
  SQL> alter database rename file '/opt/oracle/test.dbf' to '/opt/oracle/oradata/conner/test.dbf';
  
  Database altered.
  
  SQL> alter database open;
  
  Database altered.
  
  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
  /opt/oracle/oradata/conner/test.dbf
  
  SQL>
【责编:admin】

--------------------next---------------------

阅读(258) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~