Database movement often occurs during project implementation. For experienced DBAs, database movement is very easy. But for some people who only know about the system and are not very familiar with the database, Oracle's mobile is not that capacity.
For example, after the system is installed, the storage space is expanded, and Oracle needs to be moved and data needs to be moved. Previously, the data can be moved in Oracle8i for Windows 2000. How can I move Oracle9i for AIX 5l now ??? In fact, the operations on different platforms are the same.
1. Copy and move data files
1) Obtain database information
First, check the file content of the database:
Sqlplus "/As sysdba"
? Select * from V $ datafile;
? Select * from V $ controlfile
? Select * from V $ logfile;
2) mobile app data files
Shutdown immediate shut down the database and copy the data file to another directory. The files to be copied include:
System01.dbf
Indx01.dbf
Temp01.dbf
Users01.dbf
Application Data File
3) modify the location of database files
Start Mount Mode
? Startup Mount;
? Alter database rename file 'oracleoradataocpsystem01. dbf' to 'oradataocpsystem01. DBF"
? Alter database rename file 'oracleoradataocpindx01. dbf' to 'oradataocpindx01. dbf ';
Note that you can only change the moved database files, excluding control files, log files, and temp files.
Ii. Mobile Control File
(1) backup spfile content:
Restart the database again:
? Startup;
? Create pfile = 'C: init. ora 'from spfile;
(2) modify the content in the init. ora file:
*. Control_files = 'oradataocpcontrol01. CTL ', 'oradataocpcontrol02. CTL', 'oradataocpcontrol03. CTL'
To change the directory location that has been copied.
Shutdown Database
(3) copy the control file,
Move the three control files to the directory modified above.
(4) import the parameter file
Start with the init. ora parameter:
? Startup pfile = 'oracleinit. ora ';
? Create spfile from pfile = 'oracleinit. ora ';
? Shutdown immediate;
? Startup; start from spfile.
In this way, the file movement control is over.
3. Rebuild or relocate log files
There are two ways to move log files: one is to move (rename) and the other is to re-create.
(1) Move log files
The same method is used to move database files again as to move System database files, but the database must be "Startup Mount.
? Startup Mount
? Alter database rename file 'oracleoradataoralog1. ora 'to 'oradataocporalog1. dbf'
Sample
(2) rebuild the log file
First, create a group and add a log file as the swap file.
Alter database add logfile Group 4 ('$ home/oradata/u01/log4.rdo', '$ home/oradata/u02/log4.rdo') size 1 m;
Then, delete other log groups. You must keep two Log File groups in the system.
Alter database drop logfile member 'oracleoradataocporalog01. ora'
Iv. Rebuilding the Temp File System
When moving the data table space, the temp file cannot be moved. You must create a new temp tablespace and set it to the default temp file system. Then, remove the original temp tablespace to move the tablespace.
> Create temporary tablespace "temp02" tempfile 'oradataocptemp02. dbf' size 500 m extent management local uniform size 10 m;
Then delete the original temp file.
V. Test the database
Restart Oracle Data
$ Sqlplus "/As sysdba"
? Startup;
? Show SGA;
?