熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

在非歸檔模式下如何更改數據文件位置

2022-06-13   來源: Oracle 

  如果數據庫處於非歸檔模式下可以通過如下步驟更改文件路徑:
  
  關閉數據庫
  
  系統級進行文件復制
  
  啟動數據庫到mount狀態
  
  通過SQL修改數據文件位置
  
  打開數據庫
  
  以下是實際操作的步驟示范
  
  數據庫處於非歸檔模式
  
  SQL> archive log list;
  Database log mode       No Archive Mode
  Automatic archival       Enabled
  Archive destination      /opt/oracle/oradata/conner/archive
  Oldest online log sequence  
  Current log sequence     
  
  需要移動testdbf文件
  
  SQL> select name from v$datafile;
  
  NAME
  
  /opt/oracle/oradata/conner/systemdbf
  /opt/oracle/oradata/conner/undotbsdbf
  /opt/oracle/oradata/conner/usersdbf
  /opt/oracle/testdbf
  
  關閉數據庫
  
  SQL> shutdown immediate;
  Database closed
  Database dismounted
  ORACLE instance shut down
  
  復制文件到新的位置
  
  SQL> ! cp /opt/oracle/testdbf /opt/oracle/oradata/conner/testdbf
  
  啟動數據庫到mount狀態
  
  SQL> startup mount;
  ORACLE instance started
  
  Total System Global Area  bytes
  Fixed Size          bytes
  Variable Size        bytes
  Database Buffers      bytes
  Redo Buffers         bytes
  Database mounted
  SQL> select name from v$datafile;
  
  NAME
  
  /opt/oracle/oradata/conner/systemdbf
  /opt/oracle/oradata/conner/undotbsdbf
  /opt/oracle/oradata/conner/usersdbf
  /opt/oracle/testdbf
  
  修改文件位置
  
  SQL> alter database rename file /opt/oracle/testdbf to /opt/oracle/oradata/conner/testdbf;
  
  Database altered
  
  SQL> alter database open;
  
  Database altered
  
  SQL> select name from v$datafile;
  
  NAME
  
  /opt/oracle/oradata/conner/systemdbf
  /opt/oracle/oradata/conner/undotbsdbf
  /opt/oracle/oradata/conner/usersdbf
  /opt/oracle/oradata/conner/testdbf
  
  SQL>
From:http://tw.wingwit.com/Article/program/Oracle/201311/17678.html
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.