C. After a long period of development, I would like to express my personal understanding here. Here we will talk about Linux Oracle. Sometimes we encounter such a situation where the existing database needs to be transferred from one machine to another. Generally, we use export and import. However, if the database contains a large amount of data and the size of the data file is large, problems may occur during the export and import process, and we cannot tolerate the long process.
In this case, we can simply use the copy command of the operating system to directly transfer the database. The following example applies to Linux Oracle9.2.0.1 on Redhat Fedora Core 1. Other operating systems and Linux Oracle versions are also applicable.
Assume that our database is on server A, $ Linux Oracle_BASE is/Linux Oracle, and $ Linux Oracle_HOME is/Linux Oracle/product/9.2.0. Now we want to transfer this database to server B, and the new $ Linux Oracle_BASE is/u01/Linux Oracle, and $ Linux Oracle_HOME is/u01/Linux Oracle/product/9.2.0. The SID is oralinux.
The procedure is as follows:
1. install Linux Oracle on server B,
Do not create databases during installation. The user's profile can be copied directly from server A. Note that you need to modify the original $ Linux Oracle_HOME location to the current location.
2. if Linux Oracle on server A uses spfile,
Create pfile: create pfile from spfile based on this spfile;
3. Shut down the database on server,
Shutdown immediate. If the database cannot be shut down, you can use online backup. In this case, the database must be in archivelog mode. The transfer principle is the same as that allowed to be closed. We will not discuss it here.
4. Back up all data files on server A, including the following:
A) do not copy all temporary datafile files, such as temp01.dbf)
B) all online redo logs
C) All archive redo logs
D) All control files
E) $ Linux Oracle_HOME/dbs/init <SID>;. ora this file was created in step 2 above)
F) $ Linux Oracle_HOME/dbs/orapw <SID>; this is password file)
G) $ Linux Oracle_HOME/network/listener. ora can be omitted in this step, and can be regenerated later)
H) $ Linux Oracle_BASE/admin/<SID>;/All the directories in the directory, such as udump, cdump, and bdump, can be omitted. You can also create directories manually in the future)
5. Upload all the backup files to the corresponding directory of server B through FTP or other tools. For example, the original $ Linux Oracle_BASE/oradata/<SID>;/system01.dbf on server A is now uploaded to server B $ Linux Oracle_BASE/oradata/<SID>;/system01.dbf.
Make sure that the logical structure of the directory is the same. In fact, the physical structure has changed. On A, $ Linux Oracle_BASE is/Linux Oracle, and on B is/u01/Linux Oracle ). Other files are processed in the same way. If there is no corresponding directory on server B, create it manually.
6. Edit the init <SID> uploaded to server B;
.In the ora file, change all the directory structures involved to the current directory structure in B. For example, in this example, change/Linux Oracle to/u01/Linux Oracle.
7. On server B, sqlplus "/as sysdba" prompts to enter the idle process.
8. create spfile and create spfile from pfile based on the modified pfile;
9. Start the database to the mount state and start up the mount;
10. Modify the location of all data files in the control file,
You can use spool to generate all SQL statements: SQL>; alter database rename file '/Linux Oracle/oradata/oralinux/system01.dbf'
2 to '/u01/Linux Oracle/oradata/oralinux/system01.dbf'; modify all data file locations according to the preceding syntax.
11. Now the database can be used,
Alter database open;
12. Add temporary files to the TEMP tablespace:
Alter tablespace TEMP add tempfile ''/u01/Linux Oracle/oradata/oralinux/temp01.dbf' size 20 M;
13. There will be some follow-up work,
This includes updating the Listener Configuration File on Database B, because 9i instances can be automatically registered to the listener, then it will be registered immediately. If you start the database and then start listening, it will be slightly delayed before registration), modify the/etc/oratab file to use the dbstart and dbshut scripts.
In this way, even if the database is completely transferred, you can send me an email if you have any questions. No problem. As long as all online backups are available, but the backups are online, it is unavoidable to lack some data if your business is busy. For online backup, you must first recover the database. As follows:
- [zhangleyi@as orcl]$ sqlplus "/ as sysdba"
- SQL*Plus: Release 9.2.0.4.0 - Production on Mon Jan 5 17:33:38 2004
- Copyright (c) 1982, 2002, Linux Oracle Corporation. All rights reserved.
- Connected to an idle instance.
- SQL>; startup
- Linux Oracle instance started.
- Total System Global Area 118035836 bytes
- Fixed Size 451964 bytes
- Variable Size 96468992 bytes
- Database Buffers 20971520 bytes
- Redo Buffers 143360 bytes
- Database mounted.
- ORA-01113: file 1 needs media recovery
- ORA-01110: data file 1: '/Linux Oracle/oradata/orcl/system01.dbf'
- SQL>; recover database
- Media recovery complete.
- SQL>; shutdown
- ORA-01109: database not open
- Database dismounted.
- Linux Oracle instance shut down.
- SQL>; startup
- Linux Oracle instance started.
- Total System Global Area 118035836 bytes
- Fixed Size 451964 bytes
- Variable Size 96468992 bytes
- Database Buffers 20971520 bytes
- Redo Buffers 143360 bytes
- Database mounted.
- Database opened.
- SQL>;
- Migration of Linux Oracle Database Files
- Linux Oracle accesses MySQL Client software
- Linux Oracle 10 Gb software installation database
- Linux Oracle can be installed on WMware virtual machines
- Linux management tool installation package and add source