Oracle HowTo: how to change the location of Oracle data files in read-only mode

Source: Internet
Author: User

Oracle HowTo: how to change the location of Oracle data files in Oracle Database in read-only mode. There are multiple ways to move the location of data files. I have introduced several methods before: Oracle HowTo: in non-archive mode, how does one change the data file location? Oracle HowTo: How does one move the data file location? The preceding two methods may not be suitable for 24x7 systems with high requirements, because they will make the tablespace unavailable for a long time. In particular, physical copying may take a long time when the tablespace data file is huge. Another method is recommended in this article to make a compromise. The following is a simple step description:

1. putting the tablespace In the read-only status can make the data still accessible to users. alter tablespace tablespace_name read only; 2. physical copy file 3. offlinealter tablespace tablespace_name offline; 4. rename data file alter database rename file 'old _ dir_file 'to 'new _ dir_file'; 5. online alter tablespace tablespace_name online; 6. place the tablespace in read write mode alter tablespace tablespace_name read write; The following is an example step: 1. place the tablespace In the read-only status [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,200 2, Oracle Corporation. all rights reserved. connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0-ProductionWith the Partitioning optionJServer Release 9.2.0.4.0-ProductionSQL> archive log list; database log mode Archive ModeAutomatic archival EnabledArchive destination/opt/oracle/oradata/conner/archiveOldest online lo G sequence 7 Next log sequence to archive 10 Current log sequence 10SQL> select name from v $ datafile; NAME users/opt/oracle/oradata/conner/system01.dbf/opt/oracle/oradata/conner/undotbs01.dbf/opt/oracle/oradata/conner/users01.dbfSQL> alter tablespace users read only; tablespace altered.2. physical copy file SQL>! Cp/opt/oracle/oradata/conner/users01.dbf/opt/oracle/oradata/users01.dbf3. offline SQL> alter tablespace users offline; tablespace altered.4. Modify the file name SQL> alter database rename file '/opt/oracle/oradata/conner/users01.dbf' to '/opt/oracle/oradata/users01.dbf '; database altered.5. online SQL> alter tablespace users online; Tablespace altered.6. SQL> alter tablespace users read write; Tablespace altered. SQL> select name from v $ datafile; NAME alias/opt/oracle/oradata/conner/system01.dbf/opt/oracle/oradata/conner/undotbs01.dbf/opt/oracle/oradata/users01.dbfSQL>

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.