Moving database files _oracle in Oracle

Source: Internet
Author: User
The Oracle tutorial you are looking at is moving the database files in Oracle. ----Oracle database consists of three files of data files, control files, and online log files. Due to changes in disk space, or database disk I/O
Performance tuning, and so on, the database administrator may consider moving the database files. The following is an example of a UNIX platform that discusses the moving methods of three database files.

----one. Moving data files:

----can move data files using ALTER database,alter tablespace two ways.

----1. ALTER database method;

----Use this method, you can move data files for any tablespace.

----Step 1. Down database:

$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > SHUTDOWN;
Svrmgr > EXIT;

----Step 2. Move data files with operating system commands:
----Move the data file App1_data.ora 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 and rename the data file with ALTER DATABASE command:

----$ svrmgrl

Svrmgr > CONNECT INTERNAL;
Svrmgr > STARTUP MOUNT;
Svrmgr > ALTER DATABASE RENAME FILE
2 >/ora/oracle7/data1/app1_data.ora to
3 >/ora/oracle7/data2/app1_data.ora;

Step 4. Open database:.
Svrmgr > ALTER DATABASE OPEN;
Svrmgr >select name,status from V$datafile;

----2. ALTER Tablespace Method:
----This method, the data file is required to be neither part of the system table space nor a tablespace containing an active rollback segment or a temporary segment.

----STEP1. Offline the table space in which this data file resides:

$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > ALTER tablespace app1_data OFFLINE;
Svrmgr > EXIT;

STEP2. To move a data file with the operating system command:
App1_data.ora the data file from the/ora/oracle7/
The Data1 directory is moved to the/ORA/ORACLE7/DATA2 directory:
$ mv/ora/oracle7/data1/app1_data.ora/ora/oracle7/data2

STEP3. To change the data file name using the ALTER TABLESPACE command:
$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > ALTER tablespace app1_data RENAME datafile
2 >/ora/oracle7/data 1/app1_data.ora to
3 >/ora/oracle7/data2/app1_data.ora;

STEP4. Put this data file in the Tablespace online:
Svrmgr > ALTER tablespace app1_data ONLINE;
Svrmgr > SELECT name,status from V$datafile;

----two. Mobile Control files:

----control file in INIT. specified in the Ora file. Mobile control files relatively simple, the next database, edit Init.ora, mobile control files, restart
Database.

Step 1. Down database:
$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > SHUTDOWN;
Svrmgr > EXIT;

Step 2: Move the control file with the operating system command.
Ctl3orcl.ora the control file from the/ora/oracle7
The/data1 directory is moved to the/ORA/ORACLE7/DATA2 directory:
$ mv/ora/oracle7/data 1/ctrl3orcl.ora
/ora/oracle7/data2

Step 3. Edit Init.ora File:
Init. Ora files in the $oracle_home/dbs directory,
Modify the parameter "Control_files", which specifies the control file after the move:
Control_files = (/ora/oracle7/data 1/ctrl1orcl.ora,
/ora/oracle7/data1/ctrl2orcl.ora,
/ora/oracle7/data2/ctrl3orcl.ora)

Step 4. To restart the database:
$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > STARTUP;
Svrmgr >select name from V$controlfile;
Svrmgr > EXIT;


----three. Move online log files:
Step 1. To stop a database:
$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > SHUTDOWN;
Svrmgr > EXIT;

Step 2. To move an online log file with the operating system command:
Redolog1.ora an online log file from/ora/oracle7
The/data1 directory is moved to the/ORA/ORACLE7/DATA2 directory:
$ mv/ora/oracle7/data 1/redolog1.ora
/ora/oracle7/data2

Step 3. Mount database, using ALTER DB
command to change the online log file name:.
$ svrmgrl
Svrmgr > CONNECT INTERNAL;
Svrmgr > STARTUP MOUNT CC1;
Svrmgr > ALTER DATABASE RENAME FILE
2 >/ora/oracle7/data 1/redolog1.ora to
3 >/ora/oracle7/data 2/redolog1.ora;

Step 4. Restart 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.