Move database files in ORACLE

Source: Internet
Author: User

The ORACLE database consists of three types of files: data files, control files, and online log files. The database administrator may consider moving database files due to disk space changes or adjustments based on database disk I/O performance. The following uses the UNIX platform as an example to describe how to move three types of database files.
I. Move data files:

You can use alter database or alter tablespace to move data files. 1. alter database method. This method can be used to move data files in any tablespace. STEP 1. database: $ svrmgrlSVRMGR> connect internal; SVRMGR> SHUTDOWN; SVRMGR> EXIT; STEP 2. run the operating system command to move the data file: 'app1' data. ora 'Move from the/ora/oracle7/data1 directory to the/ora/oracle7/data2 Directory: $ mv/ora/oracle7/data1/app1_data.ora/ora/oracle7/data2 STEP 3. mount the DATABASE. Use the alter database command to rename the data file: $ svrmgrl SVRMGR> connect internal; SVRMGR> startup mount; SVRMGR> alter database rename file 2> '/ora/oracle7/data1/app1_dat A. ora 'to3> '/ora/oracle7/data2/app1_data.ora; STEP 4. open the database :. SVRMGR> alter database open; SVRMGR> select name, status from v $ DATAFILE; 2. alter tablespace: This method requires that the data file neither belong to the system tablespace nor to the TABLESPACE containing the ACTIVE rollback segment or temporary segment. STEP1. run the following command to move the TABLESPACE of the data file: $ svrmgrlSVRMGR> connect internal; SVRMGR> alter tablespace app1_data OFFLINE; SVRMGR> EXIT; STEP2. run the following command to move the data file: app1 _ data. ora 'Move from the/ora/oracle7/data1 directory to the/ora/oracle7/data2 directory: $ mv/ora/oracle7/data1/app1_data.ora/ora/oracle7/data2 STEP3. run the alter tablespace command to change the data file name: $ svrmgrlSVRMGR> connect internal; SVRMGR> alter tablespace append data RENAME DATAFILE2> '/ora/oracle7/data 1/append data.ora' TO3> '/ora/oracle7/data2/append data.ora; step 4. ONLINE: SVRMGR> alter tablespace appenders data ONLINE; SVRMGR> select name, status from v $ DATAFILE;
Ii. Mobile control file:
The control file is specified in the INIT. ORA file. The mobile control file is relatively simple. Go to the database, edit INIT. ORA, move the control file, and restart the database.
STEP 1. database: $ svrmgrlSVRMGR> connect internal; SVRMGR> SHUTDOWN; SVRMGR> EXIT; STEP 2. run the operating system command to move the control file: 'ctl3orcl. ora 'Move from the/ora/oracle7/data1 directory to the/ora/oracle7/data2 Directory: $ mv/ora/oracle7/data 1/ctrl3orcl. ora/oracle7/data2 STEP 3. edit INIT. ORA file: INIT. in the $ ORACLE_HOME/dbs directory of the ORA file, modify the parameter "control_files", and specify the moved control file: control_files = (/ora/oracle7/data 1/ctrl1orcl. ora,/ora/oracle7/data1/ctrl2orcl. ora,/ora/oracle7/data2/ctrl3orcl. ora) STEP 4. restart the database: $ svrmgrlSVRMGR> connect internal; SVRMGR> STARTUP; SVRMGR> SELECT name from v $ CONTROLFILE; SVRMGR> EXIT;
3. move online log files:
STEP 1. database stop: $ svrmgrlSVRMGR> connect internal; SVRMGR> SHUTDOWN; SVRMGR> EXIT; STEP 2. run the operating system command to move the online Log File: 'redolog1. ora 'Move from the/ora/oracle7/data1 directory to the/ora/oracle7/data2 Directory: $ mv/ora/oracle7/data 1/redolog1.ora/ora/oracle7/data2 STEP 3. mount the DATABASE and use the alter database command to change the online Log File Name :. $ svrmgrlSVRMGR> connect internal; SVRMGR> startup mount PC3; SVRMGR> alter database rename file 2> '/ora/oracle7/data 1/redolog1.ora' TO3> '/ora/oracle7/data 2/redolog1.ora'; STEP 4. restart the database :. SVRMGR> alter database open; SVRMGR> select member from v $ LOGFILE)

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.