Database movement, during project implementation, often occur, for experienced DBA, database movement is very easy. But for some people who only understand the system, the data is not very understanding, Oracle's move is not that capacity.
For example, when the system installation is complete, the storage space expands, and it is necessary to move the original to Oracle, and data movement is required. Previously, it can be moved in Oracle8i for Windows 2000. What is the movement of Oracle9i FOR AIX 5L now? ? ? In fact, through various platforms, the operation process is exactly the same.
First, copy mobile data files
1) Get database related information
First check the contents of the database:
SQLPlus "/ as sysdba"
? Select * from V $ datafile;
? SELECT * FROM V $ ControlFile
? Select * from V $ logfile;
2), mobile application data file
Shutdown Immediate Turns the database, copying the data file to another directory. The files that need Copy are:
SYSTEM01.DBF
Indox01.dbf
Temp01.dbf
Users01.dbf
Application data file
3) Modify the location of the database file
Start Mount mode
? Startup mount;
? Alter Database Rename File '/oracle/oradata/ocp/system01.dbf' to '/oradata/ocp/system01.dbf "
? Alter Database Rename File '/oracle/oradata/ocp/indx01.dbf' to '/oradata/ocp/indx01.dbf';
Note You can only change the mobile database file, which does not include control files and log files, TEMP files.
two. Mobile control file
(1) Back up the contents of the spfile:
Restart the database again:
? startup;
CREATE PFILE = 'c: /init.ora' from spfile;
(2) Modify the content in the init.ora file:
* .control_files = '/ ORADATA / OCP / Control01.ctl', '/ ORADATA / OCP / Control02.ctl', '/ ORADATA / OCP / Control03.ctl'
Make changes to the directory location that has been copied.
SHUTDOWN database
(3) Copy the control file in the past,
Move the three control files to the directory you modified above.
(4) Pour the parameter file
Launched in the init.ora parameter:
? Startup pfile = '/ oracle / init.ora';
CREATE SPFILE from Pfile = '/ Oracle / Init.ora';
? shutdown immediate;
? startup; start from spfile.
This control file is over.
Third, rebuild or relocate the log file
There are two ways to solve the log file, one is the other of the re-creation.
(1) Move log files
Renovating the database file is the same method as the mobile system database file, just require the database to be "startup mount" mode. ? Startup Mount
? Alter Database Rename file '/oracle/oradata/oralog1.ora' to '/oradata/ocp/oralog1.dbf'
kind
(2) Rebuild log files
Rebate a group group first, add a log file as a swap file.
Alter Database Add Logfile Group 4 ('$ HOME / ORADATA / U01 / LOG4.RDO', '$ Home / ORADATA / U02 / Log4.rdo') Size 1M;
Then delete other log groups, requires two log file groups to be kept in the system.
ALTER DATABASE DROP LOGFILE MEMBER '/ ORACLE/Ordata/ocp/oralog01.ora'
Fourth, rebuild system monitoring (TEMP) file system
When moving the data table space, the TEMP file cannot be moved, where the request can be rebuilt a TEMP table space and set as the system default TEMP file system. Then the album remove the original TEMP table space to achieve the process of mobile tablespace.
> CREATE TEMPORARY TABLESPACE "TEMP02" Tempfile '/oradata/ocp/temp02.dbf' size 500m Extent Management Local Uniform Size 10M;
Then delete the original TEMP file.
V. Test database
Raise Oracle data
$ SQLPLUS "/ as sysdba"
? startup;
? SHOW SGA;
?